Thread: Linked List

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    6

    Linked List

    How do i write a linked list function to insertatN value?

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    156
    What do you have so far?

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    6
    I just wanted to get an idea how to start it i don't know where to begin

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    155
    brgin by reading the tutorial on linked lists at this site or read about linked lists in your favorite textbook (hardcopy or online version either one) or do a search on linked lists from this board.

    In general you need to decide on an algorhythm as to where you want to do the inserting first. Then you need an algorhythm to find the appropriate spot in the list for the insertion based on the first algorhythm. Once you have found the correct spot for the insertion, insertions themselves can be as simple as assigning the new node/link to the NULL pointer at the tail of the list, or breaking internal link(s) and creating new links to insert the new node/link into the middle of the list, or assigning the head node to the node pointer in the new node and then the new node to head. The details to do all this should be a good primer. You will learn much more by reading one of them than by copying someone else's code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Linked list program need help !!!
    By dcoll025 in forum C++ Programming
    Replies: 1
    Last Post: 04-20-2009, 10:03 AM
  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, 09:07 PM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM