Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program to implement the AVL tree paradigm. Your AVL tree implementation should deal with nodes, each of which has a key and

image text in transcribed

Write a C program to implement the AVL tree paradigm. Your AVL tree implementation should deal with nodes, each of which has a key and a count. Your program reads keys in file A4.data f18.txt, and inserts them into the tree. A key is a character string like flr830, and the count is an integer which serves as the frequency count of the key. For example, if the same key has been inserted into the tree three times, there is only one node for the key and the count value of the node is 3. Your program should show a menu with the following options: 1. Initialization 2. Find 3. Insert 4. Remove 5. Check Height, Size, and Total Count 6. Find All (above a given frequency) 7. Exit escription: The user of your program enters1-7 to select the options . When option 1 is selected, your program should open that file, read and insert keys into the AVL tree on the word by word basis. The data file is provided along with this assignment handout If option 2 is selected, your program should ask for a key, then search the AVL tree that your program has created, and display the key and its frequency count if it finds the key or display No such key if it could not find the key in the tree. For option 3, your program should ask for the key to be inserted and then search for the position where the key should be placed. Your insertion function shall increase the count if the key has already been in the AVL tree, or carry out the actual insertion if the key is a new one (set the count to be 1) For option 4, your program should ask for the key to be removed and then search for the matching key. If it could not find the given key, it should display No such key. If it finds the key, it removes the tree node only if the frequency count of the key is 1, or it decreases the count of the node by one otherwise . When option 5 is selected, your program should compute and display the height and the size of the AVL tree, which is the number of nodes, and the total count (sum of all the counts) . When option 6 is selected, your program should ask for a positive integer, and then display all keys whose frequency counts are greater than or equal to the given integer Option 7 terminates your program Write a C program to implement the AVL tree paradigm. Your AVL tree implementation should deal with nodes, each of which has a key and a count. Your program reads keys in file A4.data f18.txt, and inserts them into the tree. A key is a character string like flr830, and the count is an integer which serves as the frequency count of the key. For example, if the same key has been inserted into the tree three times, there is only one node for the key and the count value of the node is 3. Your program should show a menu with the following options: 1. Initialization 2. Find 3. Insert 4. Remove 5. Check Height, Size, and Total Count 6. Find All (above a given frequency) 7. Exit escription: The user of your program enters1-7 to select the options . When option 1 is selected, your program should open that file, read and insert keys into the AVL tree on the word by word basis. The data file is provided along with this assignment handout If option 2 is selected, your program should ask for a key, then search the AVL tree that your program has created, and display the key and its frequency count if it finds the key or display No such key if it could not find the key in the tree. For option 3, your program should ask for the key to be inserted and then search for the position where the key should be placed. Your insertion function shall increase the count if the key has already been in the AVL tree, or carry out the actual insertion if the key is a new one (set the count to be 1) For option 4, your program should ask for the key to be removed and then search for the matching key. If it could not find the given key, it should display No such key. If it finds the key, it removes the tree node only if the frequency count of the key is 1, or it decreases the count of the node by one otherwise . When option 5 is selected, your program should compute and display the height and the size of the AVL tree, which is the number of nodes, and the total count (sum of all the counts) . When option 6 is selected, your program should ask for a positive integer, and then display all keys whose frequency counts are greater than or equal to the given integer Option 7 terminates your program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions