Articles for author: Rohan Singh

Quadratic Probing

Problem Statement Given a hash function, Quadratic probing is used to find the correct index of the element in the hash table. To eliminate the Primary clustering problem in Linear probing, Quadratic probing in data structure uses a Quadratic polynomial hash function to resolve the collisions in the hash table. Example Let there a table ...

Flattening a Linked List

Problem Statement Given a Linked List of size N, where every node of the linked list has either of the two pointer or can have both pointer. The sublinked(vertical linked list) and the horizontal linked list is in sorted order.Flatten this linked list such that all the nodes appear in a single level(horizontally) and the ...

Postorder Traversal without Recursion

Problem Statement Given a tree, we need to traverse the tree in a post-order traversal way and print the nodes of the tree in the post-order traversal order. The traversal should be done without using recursion. In order to proceed with the problem, we need to understand how post-order traversal is done over the tree. ...

Kosaraju Algorithm

Problem Statement Find all strongly connected components in O(V+E) time using Kosaraju’s algorithm. Strongly connected Component(SCC) – In a directed graph a strongly connected component is a component of the graph in which there is a path between every pair of vertices. Example Example of strongly connected component in a graph : Example Explanation In the above Example diagram ...

Rotate Array

“Rotate array” refers to the process of rearranging the elements within an array by shifting each element to a new position. This rearrangement can be performed either clockwise or counterclockwise. Types of Array Rotation in Array Right Rotation In right rotation, the array elements are shifted towards the right. Each element moves to the position ...

List in Data Structure

List is a data structure that stores elements in an ordered and sequential manner. A list can store repetitive elements which means a single element can occur more than once in a list. Takeaways Subsetting is accessing the part of a list from any start index to the end index. What is a List? List is an ordered data ...