GsFGs important questions

Recursion:

1. Reverse stack using only push(), pop() and isempty(): http://www.geeksforgeeks.org/reverse-a-stack-using-recursion/

2. Backtracking: Tug of war: http://www.geeksforgeeks.org/tug-of-war/

3. Permutations of a string: http://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/

Linked Lists:

1. 3 sum problem (from 3 diff linked lists): http://www.geeksforgeeks.org/find-a-triplet-from-three-linked-lists-with-sum-equal-to-a-given-number/

Trees:

1. Find a pair with given sum in BST: http://www.geeksforgeeks.org/find-a-pair-with-given-sum-in-bst/

2. Morris Traversal: http://www.geeksforgeeks.org/morris-traversal-for-preorder/

Explained: http://stackoverflow.com/questions/5502916/explain-morris-inorder-tree-traversal-without-using-stacks-or-recursion

3. BST from preorder: http://www.geeksforgeeks.org/construct-bst-from-given-preorder-traversal-set-2/

4. Boundary traversal Binary Tree: http://www.geeksforgeeks.org/boundary-traversal-of-binary-tree/

5. Parallel inorder search: http://www.geeksforgeeks.org/merge-two-bsts-with-limited-extra-space/

6. Find largest BST in a tree:

a. http://www.geeksforgeeks.org/find-the-largest-subtree-in-a-tree-that-is-also-a-bst/

b. http://leetcode.com/2010/11/largest-binary-search-tree-bst-in_22.html [Prefer]

7.Check if a binary tree is sum tree: http://www.geeksforgeeks.org/check-if-a-given-binary-tree-is-sumtree/

8. Print BST keys in a given range: http://www.geeksforgeeks.org/print-bst-keys-in-the-given-range/

9. Get the level of a node: http://www.geeksforgeeks.org/get-level-of-a-node-in-a-binary-tree/ (Important, also used in printing all nodes at a distance k from root)

10. Sorted order printing of an array: http://www.geeksforgeeks.org/sorted-order-printing-of-an-array-that-represents-a-bst/

11. Root to leaf path sum equal to a given number: http://www.geeksforgeeks.org/root-to-leaf-path-sum-equal-to-a-given-number/ (important to know how to return bool)

12. Level order in spiral (using recursion, complexity is O(n^2)) http://www.geeksforgeeks.org/level-order-traversal-in-spiral-form/

Advertisements

Leave a comment

Filed under Algorithms

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s