university-skills

Basic Skills acquired in semesters in Programming

View on GitHub

ASSIGNMENT 11: Trees

  1. WAP to insert and delete a node from the BST. Solution

  2. WAP for Tree Traversal in Pre-order. Solution

  3. WAP for Tree Traversal in In-order. Solution

  4. WAP for Tree Traversal in Post-order. Solution

  5. WAP to search the element in a Binary search tree. Solution

  6. Read n ints and make a binary search tree (BST). Do k search operations to print results as y/n. Solution Input: (n, x_i, k, y_i) 4 2 1 4 3 3 3 7 1 Output: y n y

  7. Read n ints and make a BST in the same order. Print the tree in preorder, inorder and postorder traversals. Separate characters by ‘_’. Implement using C programming. Solution Input: (n, x_i) 4 2 1 4 3 Output: 2_1_4_3_ 1_2_3_4_ 1_3_4_2_

  8. Read 2n ints. Use each half to create two BSTs in the given order. Find if the two trees are identical. Print y/n. There are T test cases. Implement using C programming. Solution Input: (T, n, x_i) 3 3 1 2 3 1 3 2 1 2 3 2 3 1 2 1 3 2 3 1 Output: n n y