Data Structures, Algorithms and Programming.
Wednesday, January 16, 2008
Deleting last but one node in Single Linked List
void DeleteLastButOneNode(Node ** head)
{
Node * temp = *head;
while(temp->next->next != NULL)
temp = temp->next;
temp->num = temp->next->num;
free (temp->next);
temp->next = NULL;
}
Complexity: SIMPLE.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
OpenNickle
View my complete profile
Category
A Warm Welcome
Algorithm
Arrays
Binary Tree
C++
Constructor
Double Linked List
FAQ
Inspiration
Material
numeric
Operators
Others
Queue
Single Linked List
Stack
String Manipulation
Blog Archive
►
2009
(4)
►
February
(1)
►
January
(3)
▼
2008
(33)
►
December
(8)
►
November
(5)
►
October
(4)
►
September
(1)
►
August
(1)
►
July
(3)
▼
January
(11)
Best Method to find the missing interger in a arra...
Finding the middle of a single linked list
Reversing a single linked list recursively
Print the contents of a Single Linked List in reve...
Deleting last but one node in Single Linked List
Finding the loop in Single Linked List
Size of Empty class
Swapping 2 numbers without using one more variable
Multipling a number by 7 without using * or + oper...
Making a class Non Derivable in C++
x+(~x+1)
►
2007
(1)
►
December
(1)
No comments:
Post a Comment