Tag Archives: divide-and-conquer

Merge sort linkedlist

Given a linked list. Use mergesort to sort this list. Time complexity is O(nlogn). package com.pli.project.algorithm.sort; import java.util.LinkedList; import java.util.List; /** * Created by lipeng on 2015/5/5. */ public class LinkedListMergeSort { public static void main(String[] args) { Node n1 = new Node(1); Node n2 = new Node(5); Node n3 = new Node(9); Node n4… Read More »

Qaz

This problem is from careercup, link Problem description: 1. qaz is a value for a number where this number is less than the other next values which have indexes larger than the index of this number. for example: 33 , 25 , 26 , 58 , 41 , 59 -> qaz of (33) = 3… Read More »