Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(please do not use GPT) (please do not use GPT) (please do not use GPT) (please do not use GPT) (please do not use GPT)
(please do not use GPT)
(please do not use GPT)
(please do not use GPT)
(please do not use GPT)
(please do not use GPT)
Programming Homework Assignment 3: Trees and Heaps Instructions: 1. This assignment is due in one week from today. 2. Submit your solutions as separate source code files in c or c++. 3. Include comments in your code to explain the logic and any assumptions made. 4. Clearly indicate which question you are answering. 5. Late submissions will not be accepted. Task 1: Binary Trees Operations (Total: 20 marks) Task 1.1: Expression Tree Evaluation (10 marks) Implement a program that takes a postfix expression (in the form of a string) and constructs an expression tree. Then, evaluate the expression using the constructed tree. Example: - Input: "23*5+" - Output: 17 (Explanation: (23)+5=6+5=11 ) Task 1.2: Mirror Image of Binary Tree (10 marks) Implement a function to create and return the mirror image of a binary tree. The mirror image of a binary tree is obtained by swapping the left and right subtrees of every node. Task 2: Binary Search Trees Operations (Total: 20 marks) Task 2.1: Kth Smallest Element (10 marks) Implement a function to find the Kth smallest element in a Binary Search Tree. Task 2.2: Range Search in BST (10 marks) Implement a function to find and print all elements in a Binary Search Tree that lie in a given range [k1, k2], where k1 and k2 are integers. Task 3: Heap Operations - Priority Queue (Total: 20 marks) Task 3.1: Huffman Coding Tree (10 marks) Implement a program to construct a Huffman coding tree given a set of characters and their frequencies. Use a min-heap to efficiently construct the tree. Task 3.2: Priority Queue for Task Scheduling (10 marks) Extend the task scheduler implemented in the previous assignment to use a min-heap for efficient task scheduling. Task 4: K-D Trees Operations (Total: 20 marks) Task 4.1: Constructing a K-D Tree (10 marks) Implement a function to construct a K-D tree from a given set of points in a 2D plane. Task 4.2: Nearest Neighbor Search (10 marks) Implement a function to perform nearest neighbor search in a K-D tree. Given a query point, find the nearest point in the K-D tree. Evaluation Criteria: - Correctness and completeness of code implementation. - Adherence to programming best practices. - Clarity of code documentation and comments. - Demonstration of understanding of data structures and their applications. Good luck! Programming Homework Assignment 3: Trees and Heaps Instructions: 1. This assignment is due in one week from today. 2. Submit your solutions as separate source code files in c or c++. 3. Include comments in your code to explain the logic and any assumptions made. 4. Clearly indicate which question you are answering. 5. Late submissions will not be accepted. Task 1: Binary Trees Operations (Total: 20 marks) Task 1.1: Expression Tree Evaluation (10 marks) Implement a program that takes a postfix expression (in the form of a string) and constructs an expression tree. Then, evaluate the expression using the constructed tree. Example: - Input: "23*5+" - Output: 17 (Explanation: (23)+5=6+5=11 ) Task 1.2: Mirror Image of Binary Tree (10 marks) Implement a function to create and return the mirror image of a binary tree. The mirror image of a binary tree is obtained by swapping the left and right subtrees of every node. Task 2: Binary Search Trees Operations (Total: 20 marks) Task 2.1: Kth Smallest Element (10 marks) Implement a function to find the Kth smallest element in a Binary Search Tree. Task 2.2: Range Search in BST (10 marks) Implement a function to find and print all elements in a Binary Search Tree that lie in a given range [k1, k2], where k1 and k2 are integers. Task 3: Heap Operations - Priority Queue (Total: 20 marks) Task 3.1: Huffman Coding Tree (10 marks) Implement a program to construct a Huffman coding tree given a set of characters and their frequencies. Use a min-heap to efficiently construct the tree. Task 3.2: Priority Queue for Task Scheduling (10 marks) Extend the task scheduler implemented in the previous assignment to use a min-heap for efficient task scheduling. Task 4: K-D Trees Operations (Total: 20 marks) Task 4.1: Constructing a K-D Tree (10 marks) Implement a function to construct a K-D tree from a given set of points in a 2D plane. Task 4.2: Nearest Neighbor Search (10 marks) Implement a function to perform nearest neighbor search in a K-D tree. Given a query point, find the nearest point in the K-D tree. Evaluation Criteria: - Correctness and completeness of code implementation. - Adherence to programming best practices. - Clarity of code documentation and comments. - Demonstration of understanding of data structures and their applications. Good luck
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started