How do i write a linked list function to insertatN value?
How do i write a linked list function to insertatN value?
What do you have so far?
I just wanted to get an idea how to start it i don't know where to begin
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.