## 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 “...

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:

This post is the extension of – Two numbers represented by a linked list, Number Stored in REVERSE order Objective: Two numbers represented by a linked listwhere each node contains single digit. The digits...

We have similar post – Two numbers represented by a linked list, Number Stored in FORWARD order Objective: Two numbers represented by a linked list where each node contains single digit. The digits are...

Objective: Write a program to Reverse the binary representation of a number Example: Input : 30 Output : 15 Explanation: binary representation of 30 is : 11110 reverse of binary representation : 01111 decimal...

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: Write an algorithm to replace all spaces in a given string with ‘%20’. You can consider that string has enough space at the end of the string to hold the extra characters. Input:...

Objective: Given Two linked list, check whether both list intersect each other, if yes then find the starting node of the intersection. Intersection point means end of one linked list is linked with some...

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: 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...

%d bloggers like this: