Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Reverse a Linked List

void reverse()
	{
		node* current, * prev, * temp;
		current = head;
		prev = NULL;
		while (current != NULL)
		{
			temp = current->next;
			current->next = prev;
			prev = current;
			current = temp;
		}
		head = prev;
	}
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #Reverse #Linked #List
ADD COMMENT
Topic
Name
9+6 =