Velocity Reviews > doubly linked list

murali@pune
Guest
Posts: n/a

 03-23-2006
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

Chris Dollin
Guest
Posts: n/a

 03-23-2006
murali@pune wrote:

> 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)

The you've come to the wrong place, twice over, because C isn't an
object-oriented language, and you've asked an algorithm question,
not a language question.

What's more, if you can't work out an answer to this question yourself,
with what you know about doubly-linked lists (and if you /don't/ know,
go and find out), asking someone else for solutions isn't going to

Build up some test cases, starting with the easy ones: insert into the
empty list, the singleton list (three cases), two elements (five or ten
cases), eliminating duplication and aiming for a general solution.

--
Chris "x.f(y) == f(x, y) == (x, y).f" Dollin
The shortcuts are all full of people using them.

Ralph A. Moritz
Guest
Posts: n/a

 03-23-2006
murali@pune wrote:
> 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)

so why are you posting to comp.lang.c again?

--
Ralph Moritz