Articles for category: Data Structures and Algorithms

What Representation of Data Structure in Memory Known as?

Representation of data structure in memory is known as Abstract Data Type. Abstract data types can be a list, stack, or queue which will be used to represent different data structures in memory. What is Abstract Data Type ? An abstract data type is a concept that tells us about the operations and data on which the operations can be performed without showing its ...

What are Data Structures in C?

Data Structures in C is a way of storing and organizing data in the computer memory so that it can be processed efficiently. Using the data structures in C, we can make our program to be able to utilize the memory efficiently as well as improve it’s performance. Depending on how the elements are organized ...

Unbounded Knapsack

Problem Statement Given a knapsack weight W and a set of N items with certain values(benefit or profit) val, and weights wt, find the maximum amount that could make up the exact knapsack weight.In Unbounded Knapsack, you may select an item multiple times. Example N = 4 W = 10 val[] = {15, 25, 20, ...

Types of Binary Tree

Binary trees are a fundamental data structure with various types. The two primary types of binary tree are full binary trees, where each node has either two children or no children, and complete binary trees, which are filled from left to right at each level. Additionally, there are balanced types of binary tree, such as ...

Triplet Sum in Array

Problem Statement An array of integers and a target sum are given, find out if there is any triplet whose sum is equal to the given target sum exists in the array or not, print the triplet, if a triplet sum in array is present and return true. Otherwise, return false. Example Input-1 Output-1 Explanation ...

Uniform-Cost Search Algorithm

The Uniform Cost Search Algorithm is a search algorithm to find the minimum cumulative cost of the path from the source node to the destination node. It is an uninformed algorithm i.e. it doesn’t have prior information about the path or nodes and that is why it is a brute-force approach. What is the Uniform ...

Wave Array

Problem Statement Sort an unsorted array arr of length n in a waveform. An array is said to be in wave form if it satisfies the following conditions: Example Example Explanation Input: arr = [7, 7, 11, 3, 4, 5, 15] Output: [4, 3, 7, 5, 11, 7, 15] or any other array in wave form. Explanation: In the ...

Two Pointer Algorithm

A reference to an object is a pointer. In some circumstances, memory-mapped computer hardware or another value located in computer memory is the value that is stored in that object’s memory address. To put it another way, a variable with an array’s address is likewise a pointer. As an example, we estimated the size of ...

Trapping Rain Water Problem

Problem Statement The width of each and every bar on to an elevation map is 1. Determine how much water it can hold after it rains by computing the heights of the elevation map bars, which are represented by n non-negative integers. Example Input: Output: Example Explanation Representation of above input heights is given below in ...