How to find the Length of Loop in Linked List | C++ Implementation

Given a Linked List, we have to find does loop exist in Linked List and if yes, find the length of loop.

Selection sort | C++ Implementation

Selection sort is an in-place sorting algorithm. In the input array there is a sorted portion and an unsorted portion. The algorithm repeatedly finds the smallest element in the unsorted...

Merge Sort | C++ Implementation

Merge sort follows *divide-and-conquer* approach. It divides an array of n elements into two subarrays of n/2 elements each. Then it sort the two subarrays recursively using merge sort. And...

Insertion Sort | C++ Implementation

Insertion sort is an efficient algorithm for sorting a small number of elements. The algorithm selects an element from the unsorted array and put it in the proper position in...

Doubly Linked List | C++ Implementation

A node in a doubly linked list contains a data item and a node pointer to the next node. In a singly linked list we can traverse only in one...

Singly Linked List | C++ Implementation

A node in a singly linked list contains a data item and a node pointer to the next node. In a singly linked list we can traverse only in one...

Quicksort | C++ Implementation

The algorithm selects an element as pivot. The input array is divided into two subarrays. All elements in left subarray are less than pivot and all elements in right subarray...

Heapsort | C++ Implementation

Heapsort is implemented using heap data structure. Heap helps us to represent binary tree without using any pointers. Using heap an array can be viewed as a binary tree and...