Articles for category: Data Structures and Algorithms

Complete Roadmap To Learn DSA

Data Structures and Algorithms is the most important subject in the world of Software and Computer Science. Data Structures and Algorithms are the base of every application which is built using coding, it can be a web application or a mobile application. It is used to solve any problem most efficiently. The **utilization of time and space ** ...

Data Structures and Algorithms Made Easy

Data Structures is a way to arrange data, and algorithms are the sequence of steps we would take to solve a given problem using those data structures. Data Structures and Algorithms (short for DSA) are an essential part of a programmer’s life; whether you are a Competitive Coder or a keen Developer, Data Structures are a ...

Analysis of Algorithm

An algorithm is a step-by-step set of instructions, which are meaningful and used to solve any particular problem. To perform every process, there is a set of Algorithms, which lets us know how to proceed with the problem and solve it in some steps. The analysis of an algorithm is a technique that measures the performance of an ...

Majority Element in an Array

Problem Statement You are given an array arr[] containing n integers including duplicates. Write a program to find the majority element in an array if it is present. Else print no Majority Element Found. An element is called a majority element when it appears more than n/2 times in an array of length n. Example Input-1 Output-1 Explanation 9 appears 5 times which is ...

Time and Space Complexity of Binary Search

Binary Search is an efficient algorithm designed for searching within a sorted list of items. Its approach involves iteratively dividing the search space in half, until the target element found in the array. The time complexity of the Binary Search Algorithm is $O(log_2{n})$, Where n is the size of the sorted linear array. It means ...

Types of Trees in Data Structures

A tree represents a hierarchical arrangement of nodes, forming a non-linear data structure. Each node in the tree holds a value and points to its child nodes, creating a branching structure akin to a natural tree. This hierarchical organization facilitates efficient storage and retrieval of data. Types of Trees in Data Structure According to the ...

How to Reverse a Stack Using Recursion?

Given a stack, write a program to reverse the order of the elements inside the stack using recursion. The element at the top should be moved to the bottom and so on. This program must use only standard stack operations – push(item), pop(), top(), size(), and isEmpty(). Example: Input: $23, 56, 82, 90$ Output: $90, ...

Strassen’s Matrix Multiplication

Problem Statment Consider two matrices X and Y each of the size N*N. We want to calculate the resultant matrix Z which is formed by multiplying the given two matrices i.e, X and Y. Example Let’s consider the below matrices for multiplication. Matrix A has a size N*M and matrix B has a size A*B. ...

Suffix Arrays

Suffix arrays are very powerful data structures in terms of their applications in the field strings and string algorithms like pattern searching, string matching algorithms, the longest common prefix of two strings, counting the number of substrings, and in the field of biology some problems like DNA sequencing which uses suffix arrays to efficiently find the ...