## Check if array is sorted using recursion

Objective: Given an array of integer write a recursive solution to check if array is sorted. Example: int [] a = {1,2,3,4}; Output: true int [] a = {1,2,3,4,2}; Output: false Approach: This problem can...

Skip to content# Category: Recursion

## Check if array is sorted using recursion

## Maximum Subarray OR Largest Sum Contiguous Subarray Problem – Divide and Conquer

## Maximum difference between two elements where larger element appears after the smaller element

## Dynamic Programming – Count all paths in 2D Matrix with Obstructions in it

## Swap Nodes in pairs in a Linked List by changing links

## Convert BST to Greater Sum Tree

## Reverse a Linked List in groups of given size ‘K’

## Get the Sum of all left leaves in a Binary tree

## Convert binary tree to its Sum tree

## Delete the Binary Tree

## Search the Element in a binary tree – With and Without Recursion

## Tree Traversals

## Dynamic Programming – Maximum Product Cutting Problem.

## Dynamic Programming – Longest Common Subsequence

## Dynamic Programming – Rod Cutting Problem

@tutorialhorizon

Objective: Given an array of integer write a recursive solution to check if array is sorted. Example: int [] a = {1,2,3,4}; Output: true int [] a = {1,2,3,4,2}; Output: false Approach: This problem can...

Objective: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. Example: int [] A = {−2, 1, −3, 4, −1, 2, 1, −5, 4}; Output:...

Objective: Given an array A[], write an algorithm to find Maximum difference between two elements where larger element appears after the smaller element or in other words find A[i] and A[j] such that A[j]-A[i]...

Objective: Given two dimensional matrix, write an algorithm to count all possible paths from top left corner to bottom-right corner. You are allowed to move only in two directions, move right OR move down....

Objective: Given a linked list write an algorithm to swap nodes in pairs by changing links . Earlier we have seen “Swap Every Kth node in a Linked List“, where we have seen how...

Objective: Given a binary search tree (BST), convert it into greater sum tree. What is greater sum tree: Greater sum tree is a tree in which every node contains the sum of all the...

Objective: Given a linked list and integer ‘k’, write an algorithm to reverse the linked list in groups of size ‘k’. Example: Approach: Earlier we have seen how to reverse a linked list, solution...

Objective: Given a binary tree, find the sum of all the nodes which are left as well as leaves nodes. Example: Approach: Approach is quite simple. Do the inorder traversal check if...

Objective: Given a binary tree, write an algorithm to convert it into its Sum tree. What is Sum tree: Sum tree of a binary tree, is a tree where each node in the converted...

Objective: Given a binary tree, write an algorithm to delete it. This is one of the basic problem in trees. if you are new to trees then this problem will help you build your...

Objective: Given a binary tree and a given number x, Write an recursive algorithm to search the element in the tree. This is one of the very basic problems of tree. If you are...

There are multiple ways to in which you can traverse a tree. In this article we will see these traversals in detail. If you are new to trees then I would recommend that you...

Objective: Given a rope of length n meters, write an algorithm to cut the rope in such a way that product of different lengths of rope is maximum. At least one cut has to...

Objective: Given two string sequences, write an algorithm to find the length of longest subsequence present in both of them. These kind of dynamic programming questions are very famous in the interviews like Amazon,...

Objective: Given a rod of length n inches and a table of prices pi, i=1,2,…,n, write an algorithm to find the maximum revenue rn obtainable by cutting up the rod and selling the pieces....

%d bloggers like this: