priority item priority queue (heapo(logno(logndeletes highestpriority item comparison of special-purpose structures table shows the big times for stacksqueuesand priority queues these structures don' support searching or traversal sorting as with the choice of data structuresit' worthwhile initially to try slow but simple sortsuch as the insertion sort it may be that the fast processing speeds available in modern computers will allow sorting of your data in reasonable time (as wild guessthe slow sort might be appropriate for under , items insertion sort is also good for almost-sorted filesoperating in about (ntime if not too many items are out of place this is typically the case where few new items are added to an already sorted file if the insertion sort proves too slowthen the shellsort is the next candidate it' fairly easy to implementand not very temperamental sedgewick estimates it to be useful up to , items only when the shellsort proves too slow should you use one of the more complex but faster sortsmergesortheapsortor quicksort mergesort requires extra memoryheapsort requires heap data structureand both are somewhat slower than quicksortso quicksort is the usual choice when the fastest sorting time is necessary howeverquicksort is suspect if there' danger that the data may not be randomin which case it may deteriorate to ( performance for potentially non-random dataheapsort is better quicksort is also prone to subtle errors if it is not implemented correctly small mistakes in coding can make it work poorly for certain arrangements of dataa situation that may be hard to diagnose table comparison of sorting algorithms sort average worst bubble ( selection ( ( insertion ( ( shellsort ( / ( quicksort ( *logno( comparison extra memory ( poor no fair no good no / -no good no