quig / linked-list

Just a challenge done in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python Program to Reverse a linked list

An exercice I worked on with my young brother in law to learn about Python programming and TDD.

Exercice

Given pointer to the head node of a linked list, the task is to reverse the linked list. We need to reverse the list by changing links between nodes.

Examples

Input : Head of following linked list
1->2->3->4->NULL Output : Linked list should be changed to, 4->3->2->1->NULL

Input : Head of following linked list
1->2->3->4->5->NULL Output : Linked list should be changed to, 5->4->3->2->1->NULL

Input : NULL Output : NULL

Input : 1->NULL Output : 1->NULL

About

Just a challenge done in Python


Languages

Language:Python 100.0%