30% Therapy – 40% Practice – 30% Work project

Found 1861 Articles for Data Structure

Updated on 15-Jul-2024 14:19:03

187 Views

A heap is a data structure which is based on tree. This tree is a complete binary tree which consists of N nodes and log N height. The elements whose priority is highest or lowest can be easily removed. This heap structure is displayed in the form of an array. The heaps can be used to derive maximum and minimum values. Heap is of two types which are Min Heap and Max heap and in this article, we will see the difference between them. What is Min Heap? The key in the Min Heap is available at the root node. …

Updated on 03-Nov-2023 15:28:07

2K+ Views

Linked List The linked list is a linear data structure containing elements called nodes. Each node consists of two main components: data (payload of that node) and a pointer to the next node in the list. They are simple and efficient to use providing easy allocation and deallocation of memory. Doubly Linked List Doubly linked list is a special type of linked list which again consists of a basic element called nodes. Each node consists of three main components: data (payload of that node), a pointer to the previous node of the sequence and a pointer to the next …

Updated on 03-Nov-2023 15:12:14

569 Views

In today’s world with a large amount of data and interconnected systems, a vast amount of data is created and stored across various machines. One challenging challenge is to sort this data stored across multiple devices. Sorting being a fundamental operation in computations is used for optimal retrieval, search and analysis of data. But with distributed systems and various interconnected machines, this task of sorting becomes difficult and important. Problem Statement Given an array containing N linked lists that depict N different machines. Each of these linked lists contains some variable number of numbers in sorted order. The task is …

Updated on 03-Nov-2023 15:10:40

422 Views

Segment TreeA segment tree is a tree data structure used for storing intervals and segments. It is a static structure, i.e. it cannot be modified once it is built. Segment trees are used to handle range queries on an array or a similar linear data structure.In a segment tree, we divide an input array into segments and precompute the values for these segments. Each node in a segment tree depicts an interval or segment of the array. The root node represents the entire array and each child node represents the segments formed by dividing the parent node. This division leads …

Updated on 03-Nov-2023 15:06:10

551 Views

Segment Tree − A segment tree is a tree data structure used for storing intervals and segments. It is a static structure, i.e. it cannot be modified once it is built. Segment trees are used to handle range queries on an array or a similar linear data structure.In a segment tree, we divide an input array into segments and precompute the values for these segments. Each node in a segment tree depicts an interval or segment of the array. The root node represents the entire array and each child node represents the segments formed by dividing the parent node. This …

Updated on 03-Nov-2023 15:01:03

336 Views

In computer science, binary matrix holds a very strong position containing a lot of information as the data is depicted using 0’s and 1’s which is the language of computers. In binary matrix, unique row refers to a row that is not identical to any other row in the matrix. Each unique row contains unique information that is not present anywhere else in the matrix except the row itself. Discovering these unique rows give information about relationships between rows, patterns in the matrix and identification of critical elements. Problem Statement Given a binary matrix mat[] containing 0’s and 1’s. The …

Updated on 03-Nov-2023 14:57:58

361 Views

Trie − A trie is a tree-based data structure used to store and retrieve a dynamic set of strings.Compressed Trie − A compressed trie is a variation of the trie data structure used for storing and searching dynamic sets of strings. Memory usage is minimised by sharing common prefixes.In a compressed trie, nodes with only one child are merged with their parent nodes compressing the common prefixes into a single edge.Suffix Tree − A suffix tree is a data structure used in string processing to store and search for all suffixes of a given string. It represents all possible suffixes …

Updated on 03-Nov-2023 14:52:20

441 Views

Anagrams − An anagram is a word or a phrase formed by rearranging the alphabets of another word or phrase, usually once. Some examples of anagrams are given below − Top – Pot Silent – Listen Post – Stop Dog – God Problem Statement Given an array of words arr[]. For the given array print all the anagrams together. Sample Example 1 Input arr[] = {“star”, “god”, “vile”, “save”, “evil”, “care”, “arts”, “race”, “dog”, “vase”} Output arts star care race dog god evil vile save vase …

Updated on 03-Nov-2023 14:49:01

205 Views

Given a scenario of a company where meetings are held during fixed time slots. These slots might be overlapping or distant. Thus, optimizing meeting efficiency is important in order to accommodate maximum meetings without any conflicts between schedules. In the problem given, we’ll be going through such an optimizing meeting efficiency problem.Problem StatementGiven a two-dimensional array time[][] containing the start time and end time of all the meetings that are scheduled for that day. The task is to find the time interval when most of the meetings are occurring.Sample Example 1Input: time[][] = {{1, 5}, {2, 6}, {3, 7}, {4, …

Updated on 03-Nov-2023 14:45:34

213 Views

In order to design efficient data structures for specific operations, the time and space complexity of the given operations for the data structure created is important. Looking into some basic operations and how they can be efficiently optimized −insert() − Inserts an element to the data structureDynamic Arrays, Hash Tables, Binary Search Trees and Balanced Search Trees like AVL Trees or Red-Black Trees are the most efficient choice of data structures providing O(1) complexity for insertions operation.delete() − Deletes an element from the data structureHash tables approach the deletion process in O(1) time while Binary Search Trees and Balanced Search …

Translate »