0% found this document useful (0 votes)
8 views2 pages

TCS302 Assignment 3&4

Uploaded by

mohitbhaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

TCS302 Assignment 3&4

Uploaded by

mohitbhaji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

DATA STRUCTURES WITH ‘C’ (TCS302)

ASSIGNMENT-3 and 4
Date of Submission: 29th November 2024
1. Write a C program to validate if a binary tree is BST or not.
Input 1: - 4
/ \
2 5
/\
1 3

Output 1: - Yes

2. Given a BST and a number K, WAP to find Kth smallest element in the BST.
3. Given a BST and a number K, WAP to find Kth largest element in the BST.
4. WAP to count the number of nodes in BST having information in multiples of k.
5. WAP to count the total number of nodes in a binary tree which have at least one
child.
6. WAP to display Preorder traversal of binary tree using iterative approach.
7. WAP to sort an array of strings using insertion sort algorithm.
8. Differentiate between linear and binary search. Write the recursive code for linear and
binary search.
9. A file contains the following characters with the frequencies as shown below. If
Huffman coding is used for data compression, determine:
i. Huffman code for each character
ii. Average code length
iii. Length of Huffman encoded message (in bits)
Character: A B C D E F
Probability: 0.5, 0.35, 0.5, 0.1, 0.4, 0.2
10. What do mean by hashing? What are different collision resolution techniques? Given
key= {43, 135, 72, 23, 99, 19, 82, 72} use different collision resolution technique to
store the data. (use h(k)= k mod 10)
11. Traverse the following binary tree in Preorder, Postorder and Inorder traversal.
12. Draw an expression tree using the following expression: (G*H)-P/Q-(R*S) +T^U
13. Sort the following list using heap sort technique, display each step also write pseudo code
for the algorithm. (20, 12, 25, 6, 10, 15, 13, 21, 18, 33).
14. Construct an AVL tree using the following keys: 40, 20, 60, 10, 30, 50, 70, 80, 90, 100.

You might also like