[Need Help] to write a function to remove all matching nodes from a linked list...

Discussion in 'C Programming' started by aredo3604gif@yahoo.com, Apr 16, 2005.

  1. Guest

    I have coded a serie of singly linked lists in ANSI C which I have to
    use.
    The lists are then stored in a serie of buckets with chained hash
    table technique.
    In the various lists there are nodes that carry the same type of data
    in some of their node fields and some don't. In the various nodes ,
    the struct datatype, there is a flag set to 1 for items that I need to
    remove. In the removing condition I have to add another match with an
    internal data field in the node.

    Now, what I need is a working code to pass the function the **head of
    the list taken from the bucket, then iterate down the list and remove
    all matching items wherever they could be down the list (which
    obviously must include the condition of removing the whole list) and
    finally ensure that dereferencing to the passed (*head) will have the
    pointer in the bucket point to the correct new first item if needed
    (since it could be removed). And have the list in a fully working
    final state with only the items to be removed as per-search conditions
    not there anymore.

    I could write functions to add a node at the head, to destroy the
    whole list, to update fields in node and find data but I can't code
    this function and I need a working code to look at or to use directly
    with little changes to matching conditions while iterating down the
    list.

    Could anyone please help me ?
     
    , Apr 16, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. CR
    Replies:
    5
    Views:
    3,178
    Brian MacBride
    Dec 24, 2003
  2. Kieran Simkin
    Replies:
    7
    Views:
    380
    Kieran Simkin
    May 11, 2004
  3. fool
    Replies:
    14
    Views:
    513
    Barry Schwarz
    Jul 3, 2006
  4. joshd
    Replies:
    12
    Views:
    674
    John Carson
    Oct 2, 2006
  5. KL

    Nodes and Linked List

    KL, Jan 24, 2007, in forum: C++
    Replies:
    3
    Views:
    289
    Michal Nazarewicz
    Jan 26, 2007
Loading...

Share This Page