## Level Order Traversal, Print each level in separate line.

Objective: Given a Binary tree , Print each level of a tree in separate line. NOTE : This problem is very similar ” Create Linked Lists of all the nodes at each depth “...

Skip to content# Category: Recursion

## Level Order Traversal, Print each level in separate line.

## Find whether if a Given Binary Tree is Balanced?

## Get the Height of a Node in a Binary Tree

## Find the Maximum Depth OR Height of a Binary Tree

## Reverse a Linked List – Part 2

## Swap Every Kth Node in a LinkedList

## Find the n’th Node from the end of a given Linked List

## Find the Loop in a Linked list, find its length and Break the Loop

## Reverse a Linked List

## Count All Paths from Top left to bottom right in Two Dimensional Array including Diagonal Paths

## Print All Paths from Top left to bottom right in Two Dimensional Array

## Merge or Combine Two Sorted Linked Lists

## Print All Elements of Two Dimensional Array in Spiral

## Quick Sort Implementation

## Find Whether Given String is palindrome or Not.

@tutorialhorizon

Objective: Given a Binary tree , Print each level of a tree in separate line. NOTE : This problem is very similar ” Create Linked Lists of all the nodes at each depth “...

Objective: Given a binary tree, Find whether if a Given Binary Tree is Balanced? What is balanced Tree: A balanced tree is a tree in which difference between heights of sub-trees of any node...

Objective: Given a binary tree, find the height of a given node in the tree. Input: A Binary Tree and a node Output: Height of a given node in the tree. Example: Approach:

Objective: Given a binary tree, find the height of it Input: A Binary Tree Output: Height of a binary tree Example: Approach:

This post is the extension of our earlier post Reverse a linked list. Here We have provided the better recursive solution in which we start reversing the list from the end. Objective: Reverse the...

Objective: Given a linked list, swap every kth node in that. If at the end of the list remaining nodes are less than k, leave them untouched. Input: A linked list, A number k....

Objective: Given a linked list and integer ‘n’, write an algorithm to find the nth node from the end in the Linked List. Example: Original List : ->1->2->8->3->7->0->4 Output : 3rd Element from the...

Objective: In a given linked list, check whether it contains the loop in it, if yes then find the Loop length and break the loop. Loop in a linked list means the last node...

Objective: Reverse the given linked list. Input: A Linked List Output: Reversed Linked List Example: Input : ->30->25->20->15->10->5 Reversed : ->5->10->15->20->25->30 NOTE : Click Reverse a Linked List – Part 2 to see the...

Objective: Count all the paths from left top corner to right bottom corner in two dimensional array. Input: Two Dimensional array Output: No of paths. Approach : 1. Recursive Recursive solution to this problem...

Objective: Print all the paths from left top corner to right bottom corner in two dimensional array. Input: Two Dimensional array Output: Print all the paths. Note: At the End of the article you...

Objective: Given two sorted linked lists, objective is to merge both the lists in sorted order. Input: Two sorted linked list List a, List b. Example: List a : ->2->6->18 Listb: ->1->3->17->19 Merged List:...

Objective: This question was asked in Amazon interview for the Software development Engineer position, Write an algorithm to print all the elements of two dimensional array in spiral. Example : Input: Two dimensional array...

Objective: Write an algorithm to sort an array in increasing or decreasing order using Quick Sort. Input: An Array arrA[] Output: A sorted array. Approach: Choose any element from the array and call it as...

Objective : Write an algorithm to find Whether Given String is palindrome or Not. Input: A String, Output: true or false on whether string is palindrome or not Approach: Use recursive approach Compare first...

%d bloggers like this: