Articles for category: Data Structures and Algorithms

Complete Binary Tree

A binary tree is called complete binary tree when all the level of binary tree is completely filled except possibly the last level, which is filled from left side. In other words all the nodes are as far left as possible in complete binary tree. Takeaways Benefits : Introduction to Complete Binary Tree A binary ...

Circular Queue

Explore the utility of circular queues in operating systems, crucial for managing process execution through FIFO principles. Often termed ‘Ring Buffer,’ this data structure efficiently stores processes, ensuring seamless resource allocation. Unlike traditional queues, a circular queue optimizes space by overwriting old entries when full, enabling continuous operation and execution management within computing environments. Explanation: ...

B+ Tree

A B+ Tree is simply an extended version of a B Tree, in which the values or pointers are stored at the leaf node level, making the various operations on it relatively easier. The root node has a minimum of two children. Each node except root can have a maximum of m children and a ...

Radix Sort Algorithm

Radix Sort is a non-comparative algorithm that sorts the data in lexicographical (dictionary) order using Counting Sort as a subroutine. It is ideal for sorting integers digit by digit and strings character by character, it distributes elements into buckets by digit value, sorting repeatedly from least to most significant digit for final order. Radix Sort ...

1-D Dynamic Programming Problem

1 dimensional dynamic programming(DP) problems are problems that can be solved with the use of DP on a 1-D (1-dimensional) array. Scope of Article Takeaways Approach to solving 1-D DP problems: What is a 1-D Dynamic Programming Problem? Before we move to discussing a 1D dp problem, let’s define dp -- dynamic programming. Dynamic programming ...

Top View of Binary Tree

The top view of a binary tree consists of the set of nodes that are visible when the tree is viewed from the top. We are given a binary tree and we have to print the top view of it. The output nodes must be printed starting from the left-most horizontal level to the rightmost ...

Time Complexity

Whenever we are thinking of a solution to a problem, there can be N number of solutions. For instance, any problem can be solved in multiple different ways. But the Question that arises here is, how can we recognize the most efficient solution if we have a set of different solutions? To answer this question ...

Euler’s Totient Function

Totient function (denoted by $\phi:\mathbb{N} \rightarrow \mathbb{N}$ ), also known as phi-function or Euler’s Totient function, is a mathematical function which counts the number of integers in the range $[1, n]$ (both inclusive) that are co-prime to $n$ or we can say whose GCD with n is 1. Note: $$\gcd(a, b) = 1$$ Example of ...

Primality Test

The Primality test is an algorithm for determining whether a given positive integer is a prime number or not.There are many methods to check whether a number is prime or not, like, the School Method, Trial Division Method, Fermat Primality test, and Miller-Rabin Primality test. Scope of the Article Takeaways Algorithm for determining whether a ...