December 29, 2018

Write a utility function to create linked list from a sequence of items – using iteration and recursion

While working on linked data-structures, we have to create linked lists regularly. To ease that process, we can create a utility function, which creates linked list from given data and returns head of the new linked list. Our functions will accept a variable argument and it will return a Node. We are using Node class […]

Read more
December 29, 2018

Create a Node class using java generic – for linked list

This class can not be used in any practical scenario. Because, the data part is going to be a lot different. While learning the datastructures and algorithms, this class is going to be very useful. While working on any linked datastructures, we create a class which acts as a node. And, It has following fields. […]

Read more
December 26, 2018

Find length of a linked list using recursion

You can read about calculating length of a linked list by iterative method here. In recursion, the iterative loop or explicit loop is replaced by recursive function calls. In recursive calls, a stack is used to store values calculated during the recursion. And when stack unfolds, the recursion calls are replaced by those values. Let […]

Read more