Sorting linked list

mccaugh at uiucdcsb.CS.UIUC.EDU mccaugh at uiucdcsb.CS.UIUC.EDU
Wed Apr 2 17:13:00 AEST 1986


 If you happen to know the size (= no. of nodes) in the linked list), why not:

 1) Make one pre-pass thru the list, initalizing corresponding slots of an
   "index vector" to the addresses of the nodes; then:

 2) use quicksort thru the index vector to sort the list?

    For a list of n > 2 nodes, expected performance will be O(n lg n).



More information about the Comp.lang.c mailing list