Articles for category: Data Structures and Algorithms

Sliding Window Maximum

Problem Statement Given an array aa, and an integer kk, find the maximum element for every contiguous subarray of size kk. Examples Example 1 Input : Output : Explanation : Example 2 Input : Output : Explanation : Constraints Approach 1: Brute Force The first approach that comes to our mind while reading the problem, is to run ...

Types of Queue

In the real world, a queue is defined as a row of elements in which one element enters from one side and exits from the other. Similarly, in data structures, the queue exhibits the same property, i.e., we can add an element from the rear end, which is also known as the tail of the ...

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 ...

Primitive Data Structure

The data structures are nothing but a meaningful way of arranging, and storing the data in the computer for efficient utilization and processing depending upon the situation. A primitive data structure can store the value of only one data type. For example, a char data structure (a primitive data structure) can store only characters. The ...

Application of Graph in Data Structure

Graph is a collection of edges and vertices that help us visualize various problems in a graphical way. Scope of the Article Takeaways Graphs help us visualize complex problems in a simpler way by visualizing entities as vertices and the relationships they carry as edges. Introduction to Graph in Data Structure In this article, we ...

Traversal of Binary Tree

Before jumping into the traversal of binary tree algorithms, let’s define a Tree as a data structure first. That will help you to grasp the concepts in a more meaningful way. The tree is a hierarchical data structure that is defined as a collection of nodes. In a tree, nodes represent the values and are ...

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 ...

Classification of Data Structure

The data structures are nothing but a meaningful way of arranging, and storing the data in the computer for efficient utilization and processing depending upon the situation. A primitive data structure can store the value of only one data type. The size of a primitive data structure is known as it can store can only ...

Abstract Data Type

A data type defines the type of data structure. A data type can be categorized into a primitive data type (for example integer, float, double etc.) or an abstract data type (for example list, stack, queue etc.). In this article, we will discuss about Abstract Data Types (ADT). Takeaways Abstract data type in data structure ...

Deque in Data Structure

In this article, we are going to learn about the topic deque in data structure. Before getting started with the deque in data structure let us get a short overview of what is a data structure in this article. Deque in data structure: A deque is a linear data structure, which stands for Double Ended ...