i want to know the exact and correct definition of a linear list.should i mention about predesessor of every element too?or mentioning only one sucsessor for each element is enough to define a linear list.pls give an answear asap.i am really confused about it.

Recommended Answers

All 4 Replies

Edited post (again :P)

I guess I would say something like: "A linear list is a list in which each element has a single unique successor and/or predecessor, with the first and last element having no (a 'NULL') predecessor and successor respectively.".

More information at:
Linked lists

[10]->[20]->[30]->[40] = Single linked linear list
[10]<-->[20]<-->[30]<-->[40] = Double linked linear list.
X--->[10]-->[20]-->[30]-->[40]---X = Single linked Circular list.
X--->[10]<-->[20]<-->[30]<-->[40]<---X = Double linked circular list.

bt what is the need to mention about predecessor?coz starting from the first element if every element posesses one sucsessor then from that we can automatically conclude that every element except the last has a unique predecessor.pls explain with an example if it is not true.

bt what is the need to mention about predecessor?coz starting from the first element if every element posesses one sucsessor then from that we can automatically conclude that every element except the last has a unique predecessor.pls explain with an example if it is not true.

Your wording was a bit sloppy so:

If you mean to say:
"If every element possesses one *unique* successor in a double linked list can we conclude that every elements predecessor except the *first* (which has no predecessor) is unique"

Then yes.

But the reason I say ''successor and / or predecessor'' is because the last element only has a predecessor (and no successor).
And in a single-linked linear list there are *no* predecessors at all. (You can only go forward)

Also when it comes to homework some teachers often want to know the ''full thing'', they don't want to know that you can conclude some 'extra' fact from what you wrote, or that it is implied by the answer.

thanks a lot for clearing all my confusion.actually i slipped the thing that linear link lists dont have any predecessor.so i am stuck there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.