We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
this solution works..test it after a long time of trying to solve this.
i still have a doubt..
The head node at first has a 2 so it is 2-null
The sequence of operation then is given as..
3 0, 3-2-null
5 1, 3-5-2-null
4 2, 3-5-4-2-null
2 3, 3-5-4-2-2-null
10 1, 3-10-5-4-2-2-null (should this be the result instead of 3-10-5-4-2?)
correct me if i am wrong!
Thank you.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
this solution works..test it after a long time of trying to solve this. i still have a doubt.. The head node at first has a 2 so it is 2-null The sequence of operation then is given as.. 3 0, 3-2-null 5 1, 3-5-2-null 4 2, 3-5-4-2-null 2 3, 3-5-4-2-2-null 10 1, 3-10-5-4-2-2-null (should this be the result instead of 3-10-5-4-2?) correct me if i am wrong! Thank you.