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 Gleasons owned a large piece of property. Part of it was subject to a public drainage easement. Taub went into the drainage area with a bulldozer and removed 16,000 cubic feet of dirt to use as...
-
Arcadia Plastics follows the philosophy of transferring people from job to job within the organization. Management believes that job rotation deters employees from feeling that they are stagnating in...
-
Costco Wholesale Corporation is Americas largest membership retail company. According to its letter to stockholders: Our mission is to bring quality goods and services to our members at the lowest...
-
Cepeda Company manufactures backpacks. During 2014, Cepeda issued bonds at 10%interest and used the cash proceeds to purchase treasury stock. The following financial information is available for...
-
Production Budget and Direct Materials Purchases BudgetsPeanut Land Inc. produces all - natural organic peanut butter. The peanut butter is sold in 1 2 - ounce jars. The sales budget for the first...
-
Thunder Attractions, an amusement park, is considering a capital investment in a new exhibit. The exhibit would cost 136,000 and have an estimated useful life of 5 years. It will be sold for 60,000...
-
EXplain whico this nucliode makeup a Pair from isobars or isotons or isotops 1 2 14 14 14 B, C,NiO, 0] C,NIOI
-
One of the areas in balanced scorecard objective measurements is to evaluate the competencies using specific, measurable, attainable, relevant and time-bound (SMART) approach. In what ways do you...
-
Holding constant the effects of bank branching (X11), what is the level of total assets that minimizes the average operating expense ratio?
-
Congratulations! You've landed a job as a paralegal making big bucks working for a law firm that represents athletes across numerous sports. One of the partners has come to you and asked that you do...
-
Litwick is a company that sells light bulbs with LED technology. The following is their typical income and costs. Sales Retailer price 4,000 units $10.00 per unit Variable costs Fixed costs $6.00 per...
-
discuss the summary and general analysis incorporating course concepts showcasing the differences between Financial and Management accounting. Please incorporate numerical examples.
-
ML 6 Add subtract multiply and divide polynomials 5WQ Divide If the polynomial does not divide evenly include the remainder as a fraction 5t 49t 3 t 10 D
-
The manager of a local convenience store is expanding his line of small toy items. To price these new items, the manager is looking at the prices being charged by competing retailers in his area. For...
-
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...
-
Revise cash collections budget (Learning Objective 4) Turn to the original Whitewater Sporting Goods Data Set item 4. Suppose \(70 \%\) of sales are cash and \(30 \%\) are credit. Revise Whitewater's...
-
Revise inventory, purchases, and cost of goods sold budget (Learning Objective 4) Refer to the original Whitewater Sporting Goods Data Set item 5. Suppose cost of goods sold averages \(75 \%\) of...
-
Revise cash payments for purchases (Learning Objective 4) Refer to the original Whitewater Sporting Goods Data Set item 5. Suppose Whitewater Sporting Goods pays for \(60 \%\) of inventory purchases...
Study smarter with the SolutionInn App