# Category: algorithm

## Unraveling the Depth-First Search Algorithm in Graphs: A Comprehensive Guide

Graphs, with their intricate connections, hold vast amounts of information. Traversing through a graph in a systematic manner is essential for analyzing and extracting valuable insights. One of the fundamental graph traversal algorithms is...

## Exploring the Breadth-First Search Algorithm in Graphs: A Comprehensive Guide

Graphs are powerful data structures that model relationships between entities. When analyzing graphs, traversing them efficiently becomes essential. One of the fundamental graph traversal algorithms is the Breadth-First Search (BFS). In this blog post,...

## Find nCr

The problem of finding the value of nCr (n choose r) arises in various mathematical and combinatorial scenarios. nCr represents the number of ways to choose r elements from a set of n elements,...

## Find next greater number with same number of set bits

The problem of finding the next greater number with the same number of set bits is an interesting challenge in computer programming. Given a positive integer, the goal is to find the smallest possible...

## 0 – 1 knapsack problem and solution

The 0/1 Knapsack problem is a classic optimization problem in computer science and mathematics. Given a set of items with their weights and values, and a knapsack with a maximum weight capacity, the goal...

## Find K-th smallest element in an array

In many programming scenarios, it becomes necessary to find the K-th smallest element in an array. This problem can be solved using various algorithms, each with its own time complexity. In this blog post,...

## Kadane’s Algorithm, algorithm and time complexity, with example in C,C++,Python and java

The Maximum Subarray Sum problem is a classic programming challenge where we need to find the contiguous subarray with the largest sum within a given array. Kadane’s Algorithm provides an elegant solution to this...

## Find largest subarray with sum 0 in an array, algorithm and time complexity, with example in C,C++,Python and java

One common problem in programming is finding the largest subarray with a sum of 0 within a given array. In this blog post, we will explore an algorithm that efficiently solves this problem. Additionally,...

## Find missing number among 1 to n, in the given array of size n-1, algorithm and time complexity with example in C,C++,Python and java

It is not uncommon to encounter scenarios where we need to find a missing number from a given array containing elements from 1 to N, where N is the expected size of the array....

## Find subarray with a given sum, algorithm and time complexity with example in C,C++,Python and java

In programming, it is common to encounter scenarios where we need to find a subarray within a larger array that has a specific sum. This task can be solved efficiently using a variety of...