Category: Yahoo


Find the Deepest Node in a Binary Tree.

Objective: – Given a binary tree, write an algorithm to Find the deepest node in it. Approach: Take two global variable as “deepestlevel” and “value“. starting with level=0, Do the inorder traversal and whenever...


Print All Possible Valid Combinations Of Parenthesis of Given ‘N’

Objec­tive: – Given “n”, generate all valid parenthesis strings of length “2n”. Example: Given n=2 Output: (()) ()() Approach:


Merge Sort in a Linked list

Objective: Given a Linked List, Sort it using merge sort. Example: ->9->3->4->2->5->1 Sorted List: ->1->2->3->4->5->9 Approach: Reference : Merge Sort in array As it Merge sort, we apply the same logic , Divide and...

%d bloggers like this: