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 summarizes the running time for various sorting algorithms the column labeled comparison attempts to estimate the minor speed differences between algorithms with the same average big times (there' no entry for shellsort because there are no other algorithms with the same big performance table comparison of sorting algorithms sort average worst comparison extra memory bubble selection insertion shellsort quicksort mergesort heapsort ( ( ( ( / ( *logno( *logno( *logno( ( ( ( / ( ( *logno( *lognpoor fair good -good fair fair no no no no no yes no graphs graphs are unique in the pantheon of data storage structures they don' store general-purpose dataand they don' act as programmer' tools for use in other algorithms insteadthey directly model real-world situations the structure of the graph reflects the structure of the problem when you need graphnothing else will doso there' no decision to be made about when to use one the primary choice is how to represent the graphusing an adjacency matrix or adjacency lists your choice depends on whether the graph is fullwhen the adjacency matrix is preferredor sparsewhen the adjacency list should be used the depth-first search and breadth-first search run in ( timewhere is the number of verticesfor adjacency matrix representation they run in ( +etimewhere is the number of edgesfor adjacency list representation minimum spanning trees and shortest paths run in ( time using an adjacency matrix and (( + )logvtime using adjacency lists you'll need to estimate and for your graph and do the arithmetic to see which representation is appropriate external storage in the previous discussion we assumed that data was stored in main memory howeveramounts of data too large to store in memory must be stored in external