Can anyone tell me about Linked list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can anyone tell me about Linked list?

what is logic for deleting duplicate elements from linked list?

17th Jul 2017, 10:21 AM
S@¢#in S#i£K€
1 Answer
0
Delete Node at a given position in a linked list head pointer input could be NULL as well for empty list Node is defined as class Node { int data; Node next; } the head and position of the data to be deleted are passes to the function delete. */ Node Delete(Node head, int position) { // Complete this method Node temp=head; if(position==0) { return temp.next; } int count=0; while(count<position-1) { temp=temp.next; count++; } temp.next=temp.next.next; return head; }
17th Jul 2017, 1:28 PM
Yuvarani Ramu
Yuvarani Ramu - avatar