| | |
Linked List
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
In order to delete the last node of the singly linked list do this;
1.Take two pointers.
2.Assign 1st pointer to the head and 2nd to the next node.
3.traverse the list till the last node such that 2nd ptr points to last node and 1st ptr oints to the previous node.
4.assign NULL to the 1st ptr .
5.Free the 2nd ptr
1.Take two pointers.
2.Assign 1st pointer to the head and 2nd to the next node.
3.traverse the list till the last node such that 2nd ptr points to last node and 1st ptr oints to the previous node.
4.assign NULL to the 1st ptr .
5.Free the 2nd ptr
PEACE !
This is not true. The STL list implementation is not the only style of linked list. For starters, you can't make a new list with one extra element on the front without modifying the original or copying the whole thing. A reasonable alternative linked list implementation is a singly linked immutable list with reference-counted nodes. Or that could be implemented as a singly linked list with a custom allocator that handles garbage collection. Most of the STL containers are limited in that they're designed to be used in a single-threaded, stateful manner.
![]() |
Similar Threads
- Removing an item from head of linked list (C)
- help implementing singly linked list (C++)
- How to read in a sentence and insert in to linked list? (C++)
- Linked List using pointers (C++ ADT) (C++)
- Why doesn't this remove the last node in a linked list? (C++)
- Cannot figure out how to implement linked list and rbtree for a project! (Java)
- Linked List (C++)
- help by sorting a simply linked list (C)
Other Threads in the C++ Forum
- Previous Thread: sort without camparison?
- Next Thread: Creating a quicksort
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





