1>Given an NxN matrix with unique integers : Find and print positions of all numbers such that it is the biggest in its row and also the smallest in its collumn .
eg : In 3 x 3 with elements
1 2 3Given a Singly Linked List which has data members sorted in ascending order. Construct aBalanced Binary Search Tree which has same data members as the given Linked List.
Examples:
Input: Linked List 1->2->3
Output: A Balanced BST
2
/ \
1 3
Input: Linked List 1->2->3->4->5->6->7
Output: A Balanced BST
4
/ \
2 6
/ \ / \
1 3 4 7
Input: Linked List 1->2->3->4
Output: A Balanced BST
3
/ \
2 4
/
1
Input: Linked List 1->2->3->4->5->6
Output: A Balanced BST
4
/ \
2 6
/ \ /
1 3 5
4>
Inorder Tree Traversal without recursion and without stack!
No comments:
Post a Comment