Articles for category: Data Structures and Algorithms

Print Right View of a Binary Tree

The right view of binary tree is the set of nodes seen by an observer as standing to the right of a given binary tree. The nodes visible to the observer will be the rightmost nodes at each level. All the other nodes (which will lie to the left of the rightmost nodes) will be ...

Kargers Algorithm for Minimum Cut

In graph theory, a cut is a set of edges removal of which divides a connected graph into two non-overlapping (disjoint) subsets. The minimum cut (or min-cut) is defined as the minimum number of edges, when removed from a graph, divide the graph into two disjoint sets. A randomized contraction algorithm $i.e.$ Karger's Algorithm is ...

Kargers Algorithm for Minimum Cut

In graph theory, a cut is a set of edges removal of which divides a connected graph into two non-overlapping (disjoint) subsets. The minimum cut (or min-cut) is defined as the minimum number of edges, when removed from a graph, divide the graph into two disjoint sets. A randomized contraction algorithm $i.e.$ Karger's Algorithm is ...

Decision Tree Algorithm

The Decision Tree algorithm is one of the many algorithms that work on the concept of supervised learning. This algorithm can be used to solve both regression and classification-based use cases. It performs excellently when used in classification-based tasks in general and generates a tree-based structure on the dataset. As this algorithm mainly makes decisions ...

The Knapsack Problem

The Knapsack Problem is an Optimization Problem in which we have to find an optimal answer among all the possible combinations.There are three types of knapsack problems : 0-1 Knapsack, Fractional Knapsack and Unbounded Knapsack. In this article, we will discuss 0-1 Knapsack in detail. Scope of Article What is 0-1 Knapsack Problem In the ...

Threaded Binary Tree

A binary tree is a data structure where every node can have up to two children. There are different ways of traversing through the tree, one of them is in-order traversal. In inorder traversal, you visit the nodes “in order”, which means if the binary tree were a binary search tree, an inorder traversal would ...

Principle of Inclusion and Exclusion

The Principle of Inclusion and Exclusion (PIE) is a fundamental counting tool in combinatorics and probability theory. It adeptly determines the total elements that fulfill one or multiple criteria while eliminating redundancies. By aggregating individual counts and deducting shared elements, PIE ensures accurate outcomes. For instance, in quantifying individuals who own either a cat or ...

State Space Reduction in Dynamic Programming

State space reduction is the process that is used to decrease the number of states in a dynamic programming solution in an optimal way. It is specific to a given problem and usually involves reducing the size of its dimensions by a constant value. Scope of Article Takeaways The primary principle of dynamic programming is ...

Combinatorics

Combinatorics is a branch of mathematics concentrating on counting, arrangement, and combination of elements within sets to satisfy specific criteria. It delves into the principles and methods used to solve problems related to permutations, combinations, graph theory, etc. Essential to fields such as computer science, cryptography, and statistics, combinatorics plays a pivotal role in understanding ...

Open Addressing

Open Addressing, also known as closed hashing, is a simple yet effective way to handle collisions in hash tables. Unlike chaining, it stores all elements directly in the hash table. This method uses probing techniques like Linear, Quadratic, and Double Hashing to find space for each key, ensuring easy data management and retrieval in hash ...