doubly linked list

M

murali@pune

Hi,
I want to insert a node in an sorted doubly linked list of integers in
ascending order. The list should not have duplicate nodes. I need an
algorithm (assuming an object oriented language)

bye
 
T

Timbo

murali@pune said:
Hi,
I want to insert a node in an sorted doubly linked list of integers in
ascending order. The list should not have duplicate nodes. I need an
algorithm (assuming an object oriented language)
Well, write one then!
 
B

bugbear

murali@pune said:
Hi,
I want to insert a node in an sorted doubly linked list of integers in
ascending order. The list should not have duplicate nodes. I need an
algorithm (assuming an object oriented language)

If reading the list is (much) more common
than writing, simply use a list, mark it as
"dirty" on write, and sort it on read if "dirty",
restting the dirty flag.

This would also be nicely polymorphic w.r.t
sorting and List interfaces.

BugBear
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top