CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is the quickest sorting method to use?
Category C Interview Questions
Rating (4.0) By 71 users
Added on 10/22/2004
Views 16729
Rate it!
Answers:

The answer depends on what you mean by quickest. For most sorting problems, it just doesn?t matter how quick the sort is because it is done infrequently or other operations take significantly more time anyway. Even in cases in which sorting speed is of the essence, there is no one answer. It depends on not only the size and nature of the data, but also the likely order. No algorithm is best in all cases.

There are three sorting methods in this author?s ?toolbox? that are all very fast and that are useful in different situations. Those methods are quick sort, merge sort, and radix sort.


The Quick Sort
The quick sort algorithm is of the ?divide and conquer? type. That means it works by reducing a sorting
problem into several easier sorting problems and solving each of them. A ?dividing? value is chosen from the input data, and the data is partitioned into three sets: elements that belong before the dividing value, the value itself, and elements that come after the dividing value. The partitioning is performed by exchanging elements that are in the first set but belong in the third with elements that are in the third set but belong in the first Elements that are equal to the dividing element can be put in any of the three sets?the algorithm will still work properly.


The Merge Sort
The merge sort is a ?divide and conquer? sort as well. It works by considering the data to be sorted as a
sequence of already-sorted lists (in the worst case, each list is one element long). Adjacent sorted lists are merged into larger sorted lists until there is a single sorted list containing all the elements. The merge sort is good at sorting lists and other data structures that are not in arrays, and it can be used to sort things that don?t fit into memory. It also can be implemented as a stable sort.

The Radix Sort
The radix sort takes a list of integers and puts each element on a smaller list, depending on the value of its least significant byte. Then the small lists are concatenated, and the process is repeated for each more significant byte until the list is sorted. The radix sort is simpler to implement on fixed-length data such as ints.



THE QUICKEST FORM OF SORTING IS BUBBLE SORTING ,SELECTION SORTING AND INSERTION SORTING



 Posted by: Rohit    

Contact Rohit  Contact Rohit

first of all you should know about the conditions properly...

if limits of input numbers are such that we can easily construct an array...
then we can use counting sort for quick sorting .
it takes only O(n) time.



 Posted by: shubham    

Contact shubham  Contact shubham

buble sort because it s a simple and in this prosess campare he value with other it easy to find but its take time quite larger than merge sort but easy



 Posted by: aniket yadav    

Contact aniket yadav  Contact aniket yadav

hashing is basically the best and the quickest sorting
technique.Provided that the hash function should be appropriately chosen.



 Posted by: vedant swami    

Contact vedant swami  Contact vedant swami

merge sort is the best sorting process and quicke.



 Posted by: abhishek shukla    

Contact abhishek shukla  Contact abhishek shukla

it is better to use quicksort. the trick of quicksort lies in choosing the pivot element.we have O(n) worst case time algorithm to find out the median of the given input. so if we use that as a pivot then quicksort always gives O(nlogn) time complexity



 Posted by: Prosenjit Ghosh    

Contact Prosenjit Ghosh  Contact Prosenjit Ghosh


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
How can I sort things that are too large to bring into memory?
View Answer
What is the easiest searching method to use?
View Answer
What is the quickest searching method to use?
View Answer
What is hashing?
View Answer
How can I sort a linked list?
View Answer
How can I search for data in a linked list?
View Answer
How do you redirect a standard stream?
View Answer
How can you restore a redirected standard stream?
View Answer
What is the difference between text and binary modes?
View Answer
How do you determine whether to use a stream function or a low-level function?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/1047/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.64