sorting a linked list

R

ram

I have created a long link list...and now need to sort it according to
the index value(of type double) of each node.Can someone point me
toward an efficient algorithm to sort it after creation.
I cannot order it during creation as I am able to calculate the index
value only after I have created the whole list.

Thanks
 
J

Jason Xie

hercules said:
Please read data structure!! you can find many algorithm there!

Quick sort is the best one.

But in fact many algorithms in book doesn't work well, you must perfect it
before you put it into you code.
 
J

John Tsiombikas (Nuclear / the Lab)

ram said:
I have created a long link list...and now need to sort it according to
the index value(of type double) of each node.Can someone point me
toward an efficient algorithm to sort it after creation.

Mergesort is the best alg. I can think of right now for list sorting.

also if you need a book on the topic, I would suggest Sedgewick's
"Algorithms in C", I have the C++ version and it is the best book I've
seen for the algorithms and data structures...

-- Nuclear / the Lab --
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top