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.
Insert a node at a specific position in a linked list
Insert a node at a specific position in a linked list
+ 0 comments public static SinglyLinkedListNode insertNodeAtPosition(SinglyLinkedListNode llist, int data, int position) { SinglyLinkedListNode newNode = new SinglyLinkedListNode(data);
if (position == 0) { newNode.next = llist; return newNode; } else { SinglyLinkedListNode temp = llist; for (int i = 1; i < position; i++) { temp = temp.next; } newNode.next = temp.next; temp.next = newNode; return llist; } }
+ 0 comments Here is the solution of Insert a node at a specific position in a linked list Click Here
+ 0 comments Great stuff, i really like your way of explaining. Now could you please have a look on my site and let me know about it.
+ 1 comment My solution in Java by two ways: iteration and recursion https://github.com/tuphan22028238/DSA/tree/main/BTLinkedList
+ 0 comments Certainly, I'd appreciate it if you could share your recommendations for the top websites where I can find the highest-quality gold available in the market.
Load more conversations
Sort 1453 Discussions, By:
Please Login in order to post a comment