7. Word Count (20 pts;6+7+7) You have been asked to write a program to count the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7. Word Count (20 pts;6+7+7) 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, is: 2 and this line is the second line. the: 2 and: 1 this: 2 line: 3 first: 1 second: 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 implement the program using an AVL tree to count the frequencies of words. Each node in the AVL tree has a word (with its count), and words (alphabetical) are the basis of the AVL ordering. a) Show the final AVL tree after all the words from the sample input file have been inserted. (Remember that words will be inserted one at a time as they are read in, but you only need to show the final tree, not all the intermediate trees). Make sure you show balance factors at all the nodes. There is only one correct AVL tree answer, according to the AVL insertion algorithm you have learned in class. 7. Word Count (20 pts;6+7+7) 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, is: 2 and this line is the second line. the: 2 and: 1 this: 2 line: 3 first: 1 second: 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 implement the program using an AVL tree to count the frequencies of words. Each node in the AVL tree has a word (with its count), and words (alphabetical) are the basis of the AVL ordering. a) Show the final AVL tree after all the words from the sample input file have been inserted. (Remember that words will be inserted one at a time as they are read in, but you only need to show the final tree, not all the intermediate trees). Make sure you show balance factors at all the nodes. There is only one correct AVL tree answer, according to the AVL insertion algorithm you have learned in class.
Expert Answer:
Answer rating: 100% (QA)
Note As per the question No programming language was specifi... View the full answer
Related Book For
Posted Date:
Students also viewed these accounting questions
-
You have been asked to write a program that calculates the total price for a picnic lunch that the user is purchasing for a group of friends. Your program should: Ask the user to enter her budget for...
-
Write a program to count the number of times the words in an input text file occur. The WordCount Structure Define a C++ struct called WordCount that contains the following data members: An array of...
-
Write a program to count the number of times the words in an input text file occur. The WordCount Structure Define a C++ struct called WordCount that contains the following data members: An array of...
-
For publicly traded companies, the Sarbanes-Oxley Act prescribes fines and prison time for knowingly falsifying financial information. Further, investors of the company may be able to successfully...
-
The three accounts shown below appear in the general ledger of Herrick Corp. during 2014. Instructions From the postings in the accounts, indicate how the information is reported on a statement of...
-
The Game Over computerized football game has far exceeded demand expectations. In order to increase the availability of different models of the game, the manufacturer has decided to begin producing...
-
The Lowe Company's income statement and comparative balance sheets as of December 31 of 2019 and 2018 are presented below: During the year, Lowe Company sold equipment for \(\$ 27,000\) cash that...
-
The Fitzgerald Company maintains a checking account at the Bank of the North. The bank provides a bank statement along with canceled checks on the last day of each month. The October 31, 2007 bank...
-
Explain in detail the meaning of the following terms: a) Cross-hedging and minimum variance hedge ratio b) Payoff of an American put option d) The Value-at-Risk (VaR) measure
-
You are meeting with executives of Cooper Cosmetics Corporation to arrange your firms engagement to audit the corporations financial statements for the year ending December 31. One executive suggests...
-
Do you think integrative approach to negotiation is more effective that distributive approach? ( long explanation) Critically discuss hypothetical situations where either style of negotiation would...
-
Are management buy-in or buyouts necessarily beneficial for the existing owners of the firm?
-
a)Mona, who has just turned 63 years old has just retired. She will have taxable income of $96,000 this year. She has asked you about collecting her CPP benefits. She would receive $1,000 each month...
-
Hello, Profs. Please, I need assistance in my c# programming code most precisely on - static void SaveJournal() and class Journal as both FileManager and entry are both underlined in red. Here is the...
-
Windsor, Inc.had the following accounts and balances: Accounts payable$4900 Equipment$34300 Accounts receivable520 0Land34400Buildings? Unearned service revenue10500 Cash14950 Total stockholders'...
-
Discuss the challenges and opportunities in harnessing ocean energy resources, including wave, tidal, and ocean thermal energy conversion (OTEC), and the technological innovations required to...
-
A piston - cylinder device, as shown in Figure 2 below, with a volume of 0 . 5 0 m 3 contains water at 3 2 5 kPa ( State 1 ) . Initially, 2 5 % of the mass is liquid and 7 5 % of the mass is vapor....
-
l ask this second time correnct answer is 38,01 can we look pls Consider a non-conducting rod of length 8.8 m having a uniform charge density 4.5 nC/m. Find the electric potential at P, a...
-
During the summer of 2009, Theresa Babineaux began and incorporated a small lawn mowing service. The following information relates to the rst two months of business. Required: (a) move up text (1)...
-
The following information has been obtained from Sardy Corp.s 2009 income statement and beginning and ending 2009 balance sheets. Required: Prepare the operating activities section of a statement of...
-
Cousins, Inc. sells ladies clothing. Customers may pay with (1) cash or check, (2) national credit card (which charges a 1%servicefee), or (3) in house credit with terms 2/10, n/30. The following are...
-
Veering off the mission is one of the key challenges in the boardroom. Why is mission focus so essential to an organization?
-
How do you convince a new member to go through orientation if he has already served on numerous boards and feels he understands what board service is all about?
-
List specific examples of a board not meeting the duties of care, loyalty, and obedience.
Study smarter with the SolutionInn App