top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How do you reverse LinkedList in place in Java?

+1 vote
How do you reverse LinkedList in place in Java?
posted Jun 29, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

There can be two solution for reversing linked list
1. Iterative
2. Recursive


Logic for this would be:
Have three nodes i.e previousNode,currentNode and nextNode
When currentNode is starting node, then previousNode will be null
Assign to previousNode to reverse the link.
In each iteration move currentNode and previousNode by 1 node.


answer Jun 30, 2015 by Karthick.c
Similar Questions
0 votes

How to implement a circular linked list in Java? Please provide all necessary functions?

+1 vote

Given a singly linked list of integers, write a function in java that returns true if the given list is palindrome, else returns false

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.