on datastructure plz solve this

R

raju

i am having a single linked list say 5 node are present, and one
pointer that is pointing to 3rd node using this pointer only i have to
come to the 1st node..... or how can i get back to the 1st node........
 
H

Haroon Shafiq

raju said:
i am having a single linked list say 5 node are present, and one
pointer that is pointing to 3rd node using this pointer only i have to
come to the 1st node..... or how can i get back to the 1st node........

<OT>
first of all you should be careful posting your homework assignments in
news groups, your teacher might also be monitoring them. you might be
accused of using unfare means.
secondly this is not the right group to ask, try some datastructure
related group.
</OT>
 
C

Chris Dollin

raju said:
i am having a single linked list say 5 node are present, and one
pointer that is pointing to 3rd node using this pointer only i have to
come to the 1st node..... or how can i get back to the 1st node........

(a) this is not a C question.

(b) if it were a C question, you haven't given us enough information;
what code have you already tried? What, exactly, went wrong?

(c) You can't. If you're careless enough to lose the pointer to the
list head, you can't backtrack. In the words of the doctor,
"don't do that.".
 
T

tmp123

raju said:
i am having a single linked list say 5 node are present, and one
pointer that is pointing to 3rd node using this pointer only i have to
come to the 1st node..... or how can i get back to the 1st node........

Some tipical posibilities are:

a) (obvious, but mandatory to remark): do you need to go again to 1st
node?. Review your algorithm to see if it is mandatory or not.
b) (also obvious): Keep a pointer to list head
c) Look for information about "double linked list".
....

Kind regards.

PS: Some prereplies to next 20 post: a) I've googled for
"datastructure" and in the first 5 answers there are 4 related to
language specific groups (including this one). In order to forward to
another group, I've decided to provided a few more keywords. b) I do
not debate why a person looks for information in groups instead of in a
book or teacher.
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top