Deletion in linked list

This is a discussion on Deletion in linked list within the C Programming forums, part of the General Programming Boards category; Hi, how to delete duplicates(repeated nodes) in a linked list? In my program, It is asking for the user to ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    2

    Deletion in linked list

    Hi,


    how to delete duplicates(repeated nodes) in a linked list?

    In my program,

    It is asking for the user to enter the node to be deleted,

    If that node occurs multiple times, then the multiple occurences of that node alone should be deleted.

    pls help me out..

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    A quick approach would be to use two loops. For each node in the outer loop, run through an inner loop from that node and onward. If any node is equal to the one in the outer loop, remove it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help sorting a linked list. Beginner
    By scarlet00014 in forum C Programming
    Replies: 1
    Last Post: 09-27-2008, 06:16 PM
  2. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  3. Reverse function for linked list
    By Brigs76 in forum C++ Programming
    Replies: 1
    Last Post: 10-25-2006, 10:01 AM
  4. Template Class for Linked List
    By pecymanski in forum C++ Programming
    Replies: 2
    Last Post: 12-04-2001, 08:07 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21