Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please do all the questions, btw no coding please 7. AVL Tree (20 pts, 8+8+4) You have been asked to write a program to count
please do all the questions, btw no coding please
7. AVL Tree (20 pts, 8+8+4) You have been asked to write a program to count the number of times each word occurs in a text file, and print them grouped according to word length. Below is a sample text file on the left, and the expected output of your program on the right: This is the first line and this line is the ultimate line. is: 2 the: 2 and: 1 this: 2 line: 3 first: 1 ultimate: 1 Note that words are counted ignoring case, and are printed in order of word length. In any group of words of the same length, the printout can be in any order (e.g. the and and are both printed before words of greater length, but they need not be in any specific relative sequence.) You choose to store the words in an AVL tree. Each node in the AVL tree has a word (with its count), and words (alphabetical) are the basis of the AVL ordering a) If there are k distinct words, and n words in all (in the sample input file, k - 7 and n - 12), how much time will it take in the worst case (big O) to store all the words with counts? Show your derivation. Assume that all word-to-word comparisons take constant time, and ignore the time taken to read a word from input. 7. AVL Tree (20 pts, 8+8+4) You have been asked to write a program to count the number of times each word occurs in a text file, and print them grouped according to word length. Below is a sample text file on the left, and the expected output of your program on the right: This is the first line and this line is the ultimate line. is: 2 the: 2 and: 1 this: 2 line: 3 first: 1 ultimate: 1 Note that words are counted ignoring case, and are printed in order of word length. In any group of words of the same length, the printout can be in any order (e.g. the and and are both printed before words of greater length, but they need not be in any specific relative sequence.) You choose to store the words in an AVL tree. Each node in the AVL tree has a word (with its count), and words (alphabetical) are the basis of the AVL ordering a) If there are k distinct words, and n words in all (in the sample input file, k - 7 and n - 12), how much time will it take in the worst case (big O) to store all the words with counts? Show your derivation. Assume that all word-to-word comparisons take constant time, and ignore the time taken to read a word from inputStep 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