Articles for category: Data Structures and Algorithms

Suffix Trees

A suffix tree is a popular tool for analysing text strings. A Suffix Tree for a given text is a compressed trie that contains all of the text’s suffixes. It’s a type of digital tree that reveals the structure of a string and its subsets using algorithmic methods. Scope In this article: Takeaways Applications of ...

Queue

The Queue in data structure is an ordered, linear sequence of items. It is a FIFO (First In First Out) data structure, which means that we can insert an item to the rear end of the queue and remove from the front of the queue only.A Queue is a sequential data type, unlike an array, ...

Sorting Algorithms

Sorting refers to the process of arranging a list or a sequence of given elements(that can be numbers or strings, etc.) or data into any particular order, which may be ascending or descending.Sorting is basically useful whenever we want our data to be in an ordered form. To make our lives easier, we have sorting ...

Persistent Segment Tree

A persistent data structure is a data structure that can retain its past forms when an update operation is applied to it. A Persistent Segment Tree is used when we want to implement persistency in a Segment Tree. A persistent segment tree can can preserve its past states and can handle updates at the same ...

Stable Sorting Algorithm

A sorting algorithm is a process of reorganizing the elements in a meaningful order. Sorting Algorithms help us to reorganize a large number of items into some specific order such as highest to lowest, or vice-versa, or even in some alphabetical order. They take some input, perform some operations over them and return a sorted ...

Hamiltonian Path

In graph theory, there are different types of walks, paths, and cycles that can be observed in connected graph components like Hamiltonian Path, Euler’s Path, Euler’s Circuit which is named after Euler as he defined them first. These paths and circuits commonly appear in different problems. Hamiltonian Paths are simply a permutation of all vertices ...

Recursion and Backtracking

Recursion and Backtracking are important problem solving approaches. Recursion may also be called as the alternative to our regular iterative approach of solving any problem. Recursion provides us with an elegant way to solve complex problems, by breaking them down into smaller problems and with fewer lines of code than iteration. However, not every recursive ...

Extended Sieve

Sieve of Eratosthenes is an ancient algorithm of mathematics that is used to calculate prime numbers belonging to a certain range of positive integers. The Extended sieve is a modification to the standard Sieve algorithm using which one can calculate prime numbers present in a larger range of numbers efficiently. Scope Takeaways Time complexity is ...

Trie Data Structure

Trie data structure is an advanced data structure used for storing and searching strings efficiently. Trie comes from the word reTRIEval which means to find or get something back. Dictionaries can be implemented efficiently using a Trie data structure and Tries are also used for the autocomplete features that we see in the search engines. ...

Nim Game

The Nim Game is a combinatorial game that involves a number of piles of stones/coins and two players playing the game. In each turn, one player chooses a pile and removes a non-zero number of stones/coins from the pile. The person who cannot make a move loses in the end. We explore the Nim Game ...