CSE 2320 - Assignments - Assignment 10

Submit to Blackboard before the deadline. You will be able to revise your answers until the deadline with no penalty.

IMPORTANT: By submitting your answers, you are certifying that these answers have been exclusively your own work. All students enrolled in this course are expected to adhere to the UT Arlington Honor Code:

I pledge, on my honor, to uphold UT Arlington's tradition of academic integrity, a tradition that values hard work and honest effort in the pursuit of academic excellence. I promise that I will submit only work that I personally create or contribute to group collaborations, and I will appropriately reference any work from other sources. I will follow the highest standards of integrity and uphold the spirit of the Honor Code.


(Programming) Task 1 (70 pts.)

Implement insertions for 2-3-4 trees, by completing the code given in file 234_trees.c. In particular, the following functions in that file are left incomplete, and your task is to complete them. The main function allows you to test your code. The loop in the main function asks the user at each iteration to enter a command, and there are three options: The program prints out the contents of the tree after each insertion.

IMPORTANT: to simplify the implementation, assume that the tree does not contain duplicate keys. When we have a function call insert(my_tree, item) where my_tree already contains a key equal to item.key, the function does nothing, i.e., it refuses to insert the item. Note that this case is already handled in the code that you are given, in the implementation of the int insert(tree my_tree, Item item) function.

Submit your function in a program called 234_trees.c.


Task 2 (15 points)

Suppose that we have a search tree where the largest number of edges in a path from the root to an internal node (i.e., to a node containing one or more items) is K. Specify, as functions of K, both the minimum and maximum number of items that the tree can contain, in each of the following cases:


Task 3 (15 points)

Suppose that we have a search tree that contains N items in total. Note that N is the number of items, not the number of nodes. Specify, as functions of N, both the minimum and maximum possible depth of the tree, in each of the following cases.

Sample input and output from my code can be seen at output.txt.

IMPORTANT: For the purposes of this task, the depth of the tree is the largest number of edges in any path from the root to an internal node (i.e., to a node containing one or more items).


How to submit

The assignment should be submitted via Blackboard. Submit a ZIPPED directory called Firstname_Lastname.zip. No other forms of compression are accepted, contact the instructor or TA if you do not know how to produce .zip files. The zipped directory should contain the following documents:

As stated on the course syllabus, programs must be in C or Java, and must run on omega.uta.edu. If you want to do this in any language other than C, you have to re-implement in that language all the code that is currently provided and implemented in C. If you want to use another language or platform, you must obtain prior written approval via e-mail by the instructor.

IMPORTANT: Pay close attention to all specifications on this page, including file names and submission format. Even in cases where your answers are correct, points will be taken off liberally for non-compliance with the instructions given on this page (such as wrong file names, wrong compression format for the submitted code, and so on). The reason is that non-compliance with the instructions makes the grading process significantly (and unnecessarily) more time consuming. Contact the instructor or TA if you have any questions.


Back to the list of assignments.