0
The question is related to the link list in data structures in c , how can we add data in the middle using only one pointer!!
We need to create a link list in c and than we need to add data between 2 addresses but the catch here is we need to use only one pointer (space complexity - saving space) I already know how we can do it using 2 pointers but need to know about using only one pointer Please provide a proper example and explanation of that code Your help is appreciated, thank you đââïž
5 Answers
0
Can you explain how you do it using 2 pointers? and BTW, what pointer type are we talking about here?
Would help those who wanted to help if you could share your tryout code bit link (in post Description)
0
Technically youâll always be using more than one pointer (or ref) as each node has a pointer to the next.
Iterate list to get size.
Create new obect (node).
Change pointers next (for previous node at specific insertion point).
I can post an example if you like.
0
DavX there is a method which allows with one pointer i need that , i have examples of two pointers so i don't think I'll need that đ
0
Anand,
Did you mean to "insert" a new node in between two nodes given their addresses?
0
Ipang it doesn't work like that