# Find the sum of the largest increasing branch in an n-ary tree

Finding the sum of the largest increasing branch in an n-ary tree can be a difficult task. This article provides an example C++ program that can help you find the sum of the largest increasing branch in an n-ary tree. An n-ary tree is a tree in which every node has at most n children.Read More »

# An algorithm to move all zeros to rightmost in an integer array.

Given an integer array, which contains some ‘k’ zeros. We aim to move all ‘k’ zeros to the right of most of the integer array. Let us see this with an example. Algorithm Iterate through each integer in the array and take a variable “pos,” representing the end of the array at first. If theRead More »

# Find if there exists a pair with a given sum in a sorted array.

Given an array of integers which are in ascending order and a sum. Our aim is to find if there is any pair of integers which total is equal to input sum. Let us discuss this problem with below example. Above example contains numbers 4 & 9 which sum is equal to our input. WeRead More »

# Find all possible combinations of decodings of a number.

Given an encoding number as explained below, we aim to print all combinations of decoding strings to that input number. The encoding number is as follows. Defining a recursion for this problem is very simple. Let us see the recursion tree for the input number. Let us now write the code for this recursion algorithm.Read More »

# Eliminate Duplicate Characters in a Sentence Quickly and Easily!

Given a string of characters, we aim to remove all its alternate duplicate characters in that string in-place. Let’s look at an example to demonstrate how we can quickly and easily remove all alternating duplicate characters from a string of characters. We can solve this issue by creating an integer array of constant size 127.Read More »

# Unlocking Maximum Palindromic Length With Powerful Recursion And Dynamic Programming

A substring is a sequence of characters which has been extracted from a larger string. For example, let’s consider the string “Hello World”. We can form the substring “Hello” by selecting the first five characters of the string. Let’s see the following another example. In order to calculate the length of a substring, we needRead More »

# 0/1 Knapsack problem example with recursion and dynamic programming solutions

The farmer has a knapsack with a capacity of “N” kgs, and he has products which weigh more than N kgs. He wants to fill the knapsack in such a way that he can maximize the money he can make from selling the products in the knapsack. He cannot cut the products, but he hasRead More »

# Activity selection(Interval scheduling maximization) problem greedy approach

Given a set of activities (tasks) with its start time and end times. We aim to find all non-overlapping activities in the given interval. Let’s understand the problem with the following example. This scheduling problem can be solved using the greedy approach, to solve this we first need to sort all activities based on theirRead More »

# Coin change problem (Find all number of combinations that formed a sum amount with given denominations)

Our objective is to find the number of different combinations of coin denominations that can be used to make up a given monetary amount. Given a set of coin denominations and the target amount, we aim to determine the various ways in which these coins can be arranged to reach the desired total. To betterRead More »