Data Structures and Algorithms

In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data,i.e., it is an algebraic structure about data.
Data structures serve as the basis for abstract data types (ADT). The ADT defines the logical form of the data type. The data structure implements the physical form of the data type.
Different types of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, relational databases commonly use B-tree indexes for data retrieval, while compiler implementations usually use hash tables to look up identifiers.

Data Structure

By Mohammed Afzal

● Published At Apr 2022

This blog tries to accumulate all the resources that are required to learn Data Structures and Algorithms. It is a one-stop blog for all that you need to know about various data structure and the numerous algorithms under one roof.... Keep reading ..

Recursion

Recursion is a function which calls itself in its definition. In each call, the same function is called in order to solve the smaller version of the same problem till that problem becomes smaller enough for which we know the answer.

Problems

In technical interviews and competitive programming contests, problems related to recursion are frequently asked. A beginner might find it challenging

Types Of Recursion

By Soumya Agrawal

● Published At Nov 2021

In this blog, we will cover the recursion and its types with the help of some examples.... Keep reading ..

Tail Recursion

By Yogesh Kumar

● Published At Nov 2021

This blog will learn about Tail Recursion and its implementation with code and examples.... Keep reading ..

Different ways to add parentheses

By Shreya Deep

● Published At Nov 2021

In this article, we’ll learn the different ways of adding parentheses to group numbers and operators.... Keep reading ..

Object Oriented Programming(OOP)

Object-Oriented programming, or OOPs, as the term implies, refers to a programming language that utilizes the concepts of class and object. The main aim of OOPs is to implement real-world entities such as polymorphism, inheritance, encapsulation, abstraction, etc. The popular object-oriented programming languages are c++, java, python, PHP, c#, etc
This category brings to you the various concepts of OOPs.

Inheritances

In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object or class, retaining similar implementati

Abstraction In Java

By Deeksha Sharma

● Published At Oct 2021

In this blog, we are going to ace an essential concept of java that is an abstraction in java. This is an important concept in object-oriented programming.
... Keep reading ..

Design Parking System

By Aditya Narayan Joardar

● Published At Nov 2021

This article thoroughly discusses the Design Parking System using various examples, explanations, and codes.... Keep reading ..

Linked List

A linked list is a linear data structure that consists of nodes. Each Node contains a data field and a pointer to the next Node. In Linked List, unlike arrays, elements are not stored at contiguous memory locations but rather at different memory locations. The various elements in a linked list are linked together using pointers. There are majorly two types of Linked list: Singly Linked List and Doubly Linked List. This category contains all the information you need to know about Linked Lists.

Introduction

The linked list is a type of linear data structure formed by interconnected nodes. These nodes are linked to each other using pointers such that each

Circular Linked List

A linked list in which the next pointer of the tail points to the head of the linked list is known as a cyclic linked list. This enables us to start t

Doubly Linked List

Ever wondered what if we wanted to travel both ways in a linked list, then how is it possible? Easy-peasy, just like the next node reference in singly

Problems

In technical interviews and competitive programming contests, problems related to linked lists are frequently asked. A beginner might find it challeng

Why is Quick Sort preferred for Arrays and Merge Sort for Linked Lists?

By Mehak Goel

● Published At Dec 2021

This article will explain the major reasons behind using quick sort for arrays and merge sort for linked lists.
... Keep reading ..

Application of Linked List Data Structure

By Firdausia Fatima

● Published At Jan 2022

In this blog, we will explore the application of linked list data structure.... Keep reading ..

Linked List remove() Method in Java

By Firdausia Fatima

● Published At Jan 2022

In this blog, we will discuss three variations of the linked list remove method in Java.... Keep reading ..

Quicksort on a Singly Linked List

By Yogesh Kumar

● Published At Apr 2022

This article will discuss one of the essential sorting algorithms- Quicksort on a singly linked list. We will look at its basic concepts, definitions, algorithms, and implementation in Java.
... Keep reading ..

How to Convert all LinkedHashMap Values to a List in Java

By Riya

● Published At Jan 2022

This article will discuss how we can convert all LinkedHashMap values to a list in java.... Keep reading ..

Difference between a singly linked list and a doubly linked list

By Ishita Chawla

● Published At Dec 2021

This blog will discuss the differences between a singly linked list and a doubly linked list.
... Keep reading ..

Stack

When talking about Data Structures and algorithms associated with them, we need to talk about Stacks. A stack is a linear data structure, which follows a particular order in which operations can be performed. These operations may be FILO (First In Last Out) or LIFO(Last In First Out).
Stacks can be implemented using arrays and linked lists manually, while languages like C++, Java, and Python have built-in classes, STLs, and libraries to implement them.
In this category, we will look into all operations and problems related to Stacks.

Introduction

Stack is an abstract data type (ADT) that follows Last in First Out (LIFO). This means that the element which is added last in the stack will be acces

Problems

Problems on stack usually involve use cases in computer science when there is a need to revisit or re-track a stored set of data. A stack data structu

Queue

In the field of Data Structures in Computer Science, queues are a very important data structure. A Queue is a linear data structure, which is simply a collection of entries that are tracked in order, such that the addition of entries happens at one end of the queue, while the removal of entries takes place from the other end.
In this category, we will look into all operations and problems related to Queue.

Introduction

The queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and

Simple Queue

The simplest basic queue is the simple queue, in which insertion occurs at the 'front' of the queue and deletion occurs at the 'end' of the queue. Mem

Circular Queue

A circular queue is a linear data structure that operates on the FIFO principle. Unlike, a normal queue, it doesn't have a tail. It only has a head as

Double Ended Queue(Deque)

A deque is a very useful data structure as it provides all functionalities that a stack and a queue do. It is a linear data structure that has a front

Problems

The problem with the queue data structure is very frequently asked in the interviews of product-based companies. Firstly you need to solve the basic q

Difference between Queue and Deque in C++

By Rhythm Jain

● Published At Dec 2021

This article discusses how Queue and Deque varies in C++.... Keep reading ..

Advantages of Circular Queue over Linear Queue

By Shreya Deep

● Published At Nov 2021

This blog will give you details about the Advantages of a circular queue over a linear queue.... Keep reading ..

Queue of Pairs in C++ STL

By Ishita Chawla

● Published At Dec 2021

This blog will discuss the topic of the queue of pairs in C++ STL with examples.... Keep reading ..

Backtracking

When studying algorithms related to solving computing problems, it is important to look into the Backtracking algorithm. The Backtracking algorithm essentially refers to searching and going through every possible combination in order to solve a particular computing problem. Broadly classifying, the backtracking algorithm can be divided into 3 further categories. These include searching for all feasible solutions, searching for the best solution, and searching for any feasible solution. In this category, we will look into every dimension of the backtracking algorithm in great detail.

Introduction

Backtracking is basically an improvement of the brute force approach. It checks all the possible ways. In backtracking, we search with one possible or

Problems

What’s interesting about backtracking is that we back up only as far as needed to reach a previous decision point with an as-yet-unexplored alternativ

Heap and Priority Queue

They are the built-in form of a tree, which stores all the elements in a particular order.
There are majorly two types of Heaps or priority queues that came into action:
Min-Heap:
Elements are stored in such a way that the minimum element will always be on the top.
Max-Heap:
Elements are stored in such a way that the maximum element will always be on the top.
The time complexity of push and pop operations in heaps and priority queues is O(log(N)) and it requires O(N) space.

Introduction

Heaps and Priority Queues are the data structures that are very helpful when we require to sort elements dynamically which means if we add or remove a

Types of Heap

There are two types of the heap: Min Heap and Max heap.
Min Heap: The value of the parent node should be less than or equal to either of its childr

Priority Queue

Priority queues are an essential concept in Data Structures and Algorithms, with various applications in Dijkstra, Prim, and scheduling algorithms. Sy

Problems

There are many popular problems based on Heap and Priority Queue. Some of them are Special Array Operation, Monk and Champions League, AND choices, an

HashMap

A HashMap is a data structure that can map specific keys to certain values. The keys and values could be anything. Hashmaps can retrieve data faster than arrays and linked lists. A hashmap can check the presence of a particular key in O(1) time.

Introduction

Hashmaps are very handy data structures in the world of competitive programming. They can be implemented using hash functions. Most of the operations

Problems

Hashmaps are generally used when we want to store key-value pairs, where keys are unique values. Key and values can be of any datatype. They are most

Binary Tree

A binary tree is another example of a data structure similar to a linked list, but instead of each node pointing to the very next node linearly, each node points to the two nodes, hence making this an example of a non-linear data structure. The tree structure is a way of representing the hierarchical nature of a structure in a graphical form. In the Abstract data type of trees, the order of the elements is not essential. If we need ordering information, linear data structures like a linked list, stacks, queues, etc., can be used.

Operations on Binary Tree

A binary tree is one of the most important data structures in real-world applications. So knowing the binary tree inside out is essential to make it i

Traversals

Traversals are usually the very first operation performed on any data structure. From searching, inserting, deleting a specific element in a data stru

Views

There are four types of views in a Binary Tree. The views are Left view, Right view, Bottom view, and Top view. In the Left view, we need to print all

Problems

Binary Trees is a very famous topic from which questions are asked in the interviews of the Top Product-Based Companies. Hence, you must solve differe

Binary Tree using dstructure library in Python

By Aman kumar Chourasiya

● Published At Jan 2022

In this blog, we will discuss the binary tree data structure in python which is implemented in the dstructure library. We will also see various pre-defined functions in the library.... Keep reading ..

Types of Binary trees

By Malay Gain

● Published At Oct 2021

There are a few types of Binary Trees commonly known. In this article, we will discuss them.... Keep reading ..

Create a Balanced Binary Tree using leaf Nodes of a Binary Tree without using Extra Space

By Riya

● Published At Feb 2022

This article will discuss how to create a balanced binary tree using leaf nodes of a binary tree without using extra space, its C++ implementation, and its time and space complexity.... Keep reading ..

N-Ary Trees

By Aditya Narayan Joardar

● Published At Nov 2021

This article will discuss the N-Ary Tree Data Structure, which has many applications.... Keep reading ..

Binary Search Tree

A binary search tree is a specific type of binary tree that is either empty, or each node in the tree contains a key, and all keys in the left subtree are less (numerically or alphabetically) than the identifier in the root node; all keys in the right subtree are greater than the identifier in the root node and the left and right subtrees are also binary search trees.

Operations on Binary Search Tree

We can mainly do three types of operations on Binary Search Trees. We can insert, delete and search for an element in the Binary Search Tree. The time

Problems

Binary Search Trees is a very famous topic from which questions are asked in the interviews of the Top Product-Based Companies. Hence, you must solve

Introduction to Binary Search tree

By Ranjul Arumadi

● Published At Oct 2021

A binary tree is a non-linear data structure. A Binary search tree is an improved version of a binary tree that provides efficient methods to implement various operations in a data structure. It has multiple applications.... Keep reading ..

Difference between binary tree and binary search tree

By Shreya Deep

● Published At Dec 2021

In this article, we will compare binary trees and binary search trees... Keep reading ..

Inbuilt Binary Search in Different Languages

By Riya

● Published At Feb 2022

This article will discuss binary search and inbuilt binary search functions in different languages like C++, java.... Keep reading ..

AVL Tree

An AVL tree is a self-balancing binary search tree. It is named after its inventors Adelson-Velsky and Landis who were the first to propose the concept of dynamically balanced trees. In an AVL tree, the heights of the left and right subtrees of any node differ by at most one. Rebalancing is done whenever the height-balanced property is violated. Since it is height-balanced, the time complexities of all the operations are search, insertion or deletion is O(log n) in both the average and worst cases.

Operations on AVL Tree

The basic operations of an AVL tree entail performing the same actions that would be performed on an unbalanced binary search tree. Still, alterations

Self Balancing Binary Search Trees

By Soumya Agrawal

● Published At Mar 2022

In this article, we will be covering an exciting topic Self Balancing Binary Search Trees.... Keep reading ..

Introduction To AVL Trees

By Yukti Kumari

● Published At Oct 2021

This article discusses the introduction to AVL trees, their advantages, representation, properties and various operations performed on them.... Keep reading ..

Graph

A graph is an abstract data type that can represent complex, non-linear relationships between objects. There are different classifications of a graph, such as undirected or directed graphs, cyclic or acyclic graphs, weighted and unweighted graphs, etc. In computer science, graphs are the most extensively used data structure. This section will improve your graph understanding. We'll be dealing with a lot of graph-based problems and their solutions.

Introduction

In computer science, graphs are the most extensively used data structure. This section will improve your graph understanding. We'll be dealing with a

Traversal

The process of exploring each vertex in a graph is known as graph traversal. Every problem on the graph includes traversing in some way. To avoid gett

Operations on Graph

In Computer Science, a Graph is a non-linear data structure that finds its use in numerous real-life problems ranging from Social Networking applicati

Minimum Spanning Tree(MST)

The spanning tree's cost is equal to the sum of the weights of all the tree's edges. Many spanning trees are possible. The spanning tree with the lowe

Problems

Minimum Spanning Tree(MST) is a standard problem that can be solved using Prim's and Kruskal's algorithm. Apart from solving the general problems, It

Dynamic Programming

Dynamic Programming is a technique of doing an optimization over recursion. We store the answer for the overlapping subproblems and use that result if we need the answer for the same problem in the future. Hence, we save the time of re-computing the answer for the same problem. It is a great technique that helps us to reduce the exponential time complexity to polynomial time complexity.

Introduction

Dynamic Programming (DP) is an algorithmic technique used when solving an optimization problem by breaking it down into simpler subproblems and utiliz

0-1 Knapsack and Variations

Knapsack simply means bag. A bag of given capacity. We have to pack n items into this bag, and every item has some weight and value. We have to make s

LCS and Variations

The longest common subsequence of two strings is the length of the longest subsequence, which is common to both the given strings. It is a classical D

Expression Matching

Expression Matching is a problem based on the practical application of dynamic programming. Regular expressions, often known as regexes, are character

Stock Variations

We all know about arrays as a data structure, but then where are they practically used?
An important application of arrays in competitive programming

Problems

All of us have heard of dynamic programming and know that it is used in various applications asked in interviews, but what are those applications?
So

Greedy Algorithms

As the name implies, a greedy technique always chooses the option that appears to be the best at the time. This means it will make a locally optimal decision to arrive at a globally optimal solution.
For example, if you want to travel from point A to point B, there are numerous options, such as walking, cycling, car, air, etc.
However, if you need to arrive in the shortest amount of time, you'll estimate the time from all possible options and then choose wisely which will be the most efficient. You must compare the current option with the previous option to select the optimal solution. This is referred to as the greedy technique.
In computer science, we frequently employ greedy techniques. This category revolves around greedy techniques and uses them in solving optimization problems.

Standard Greedy Problems

The greedy algorithm is one of the most easy-to-understand algorithms. We have to choose the local best option and build up a solution. To get better

Advanced Greedy Problems

The greedy algorithm is a very important topic when it comes to competitive programming and also for product-based companies. Introducing some variant

Trie

Trie is a tree-based data structure that stores a set of strings. Each node has the same number of pointers as to the number of characters in the alphabet. It is extracted from the word "retrieval," as words and strings can be retrieved from the structure by traversing down a branch path of the tree.
In computer science, it is also called a digital tree or prefix tree.

Introduction and Implementation

The basic Trie operations are:
Insertion of a node.
Searching of a node.
Deletion of a node.
Here is the implementation of the Trie data structure

Problems

With the help of Trie, we can solve different problems like
1. Longest Prefix Matching
2. Print unique rows in a given boolean matrix
3. Imple

Suffix Data Structures

A suffix array is a sorted array of all suffixes of a given string which can be constructed by doing a DFS traversal on a Suffix tree. It is widely used in areas such as data compression, bioinformatics, and, in general, in any area that deals with strings and string matching problems.

Suffix Tree

The Suffix Tree is a trie that contains all suffixes of a string. This data structure is used in solving string-related problems like pattern matching

Generalized Suffix Tree

By Ujjawal Gupta

● Published At Mar 2022

In this blog, we will discuss the Generalized suffix tree.... Keep reading ..

Suffix Array Construction (Brute Force N ^ 2 LogN)

By Yukti Kumari

● Published At Jan 2022

This article explains the concept of suffix arrays and explains the naive algorithm for suffix array construction.... Keep reading ..

Sparse Table

Sparse Table Construction (SUM QRY)

By Malay Gain

● Published At Mar 2022

In this article, we will learn how to solve range sum query using the sparse table.
... Keep reading ..

Range Min Using Sparse Table

By Malay Gain

● Published At Mar 2022

In this article, we will learn how to solve range minimum query using the sparse table.
... Keep reading ..

String Processing

String Hashing

By Ujjawal Gupta

● Published At Jan 2022

In this blog, we will learn what string hashing is and how it is helpful in comparing two strings efficiently.... Keep reading ..

Z Algorithm

By Ujjawal Gupta

● Published At Mar 2022

In this blog, we will discuss the Z Algorithm.... Keep reading ..

Aho Corasick Algorithm

By Ujjawal Gupta

● Published At Mar 2022

In this blog, we will discuss the Aho Corasick Algorithm.... Keep reading ..

Time and Space Complexity

A good algorithm is one that takes less time in execution and saves space during the process. For the same, we have time complexity and space complexity which represent the amount of time and memory used by the algorithm respectively.

## Top Problems related to Data Structures and Algorithms

MergeSort Linked List

Binary Search

Colour The Graph

Insertion in a Priority queue -Max Heap

Properties of MST in a Undirected Graph

Print Reverse LinkedList

Generate all parenthesis

Delete Alternate Nodes

Sum Tree

Longest Common Subsequence

Delete a Node from Linked List

Find a Node in Linked List

Is Node Present?

Remove leaf nodes in Tree

Preorder Binary Tree

Postorder Binary Tree

Running Median

Left View Of Binary Tree

Detect Cycle in a Undirected Graph

Cycle Detection in a Singly Linked List

Detect and Remove Loop