1 1 vote which sorting algorihm is used if we have a telephone directory wit 1,00,000 entries ? Algorithms algorithms normal sorting + – moin 1.6k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply senbihan commented Mar 29, 2017 reply Follow flag The best algorithm to sort 100000 entries of a telephone directory is Radix sort. Considering each number is 10 digit, the run time of radix sort is O(n*k) , i.e, O(106) If we use merge-sort to sort the directory, then the run time is O(nlgn) i,e, O(105 x 13.28) i.e, O(1.3x106) 2 2 replyShare Samujjal Das commented May 3, 2017 reply Follow flag Make this an answer. 0 0 replyShare Please log in or register to add a comment.
0 0 votes we should use heap sort or even merge sort can be used Shashank Kumar Mishr answered Mar 7, 2017 Shashank Kumar Mishr comment Share Follow See all 2 Comments 2 2 Comments reply moin commented Mar 7, 2017 reply Follow flag yes i understand your logic that merge and heap work better for larger inputs. but, the answer is Bucket sort. please anyone can explain this? 0 0 replyShare Kamal Pratap commented Mar 8, 2017 i edited by Kamal Pratap Mar 12, 2017 reply Follow flag Actually, the algorithm is decided based upon how much information do we have about the data. If we dont have any information about the data whatsoever that is about to sort, its better to apply merge sort. Now if suppose the data to be sorted is not already sorted we should apply quick sort for its better partitioning the data for recursive calls. Now, the question says telephone directory, the answer bucket sort might be correct because bucket sort is applied when there is chunks of data that is already sorted or in close range and maybe you could think of telephone directory numbers that are very close to each other in a region or so. That makes the data fit for bucket sort. 0 0 replyShare Please log in or register to add a comment.