Generate binary trees using the function generate bsto

Assignment Help Data Structure & Algorithms
Reference no: EM131794717

Programming Problems 20-22 at the end of Chapter 11 ask for a program to construct a text concordance, which is an alphabetical listing of all the distinct words in a piece of text.

The basic storage structure for such a concordance was an array of ordered linked lists, one for words beginning with A, another for words beginning with B, and so on.

Write a program that reads a piece of text, constructs a concordance that contains the distinct words that appear in the text and, for each word, the line (or page) number of its first occurrence, and then allows the user to search for this concordance. Use an array of BSTs as storage for the concordance.

Problem 20,

Test the function 1eve1ByLeve10 of Exercise 27. Generate binary trees using the function generate BSTO in Problem 14, and then traverse them using 1evel By Level O.

Exercise 27,

Write a function 1eve1ByLeve10 to traverse a tree level by level; that is, first visit the root, then all nodes on level 1 (children of the root), then all nodes on level 2, and so on. Nodes on the same level should be visited in order from left to right. (Hint: Write a no recursive function, and use a queue of pointers.)

Problem 21,

In this section, binary search trees were implemented using pointers, but it also is possible to use an array-based implementation, similar to that for linked lists described in Section 6.6. In this implementation, each node is represented as a class Bi n Node and the BST is stored in an array of Bi n Nodes.

Each Bi n Node object contains three data members: one to store data and two link members that point to the left and the right child, respectively, by storing their indices in the array. Imitating the array-based implementation of linked lists in Section 6.6, do the following:

a. Write appropriate declarations for this array-based implementation of binary search trees.

b. Design and test a class for maintaining a storage pool of available nodes, with operations to initialize it, to get a node from it, and to return a node to it.

Problem 22,

Assuming the array-based implementation of BSTs in Problem 21, write and test a function member search () for searching a BST.

Problem 21,

In this section, binary search trees were implemented using pointers, but it also is possible to use an array-based implementation, similar to that for linked lists described in Section 6.6.

In this implementation, each node is represented as a class Bi n Node and the BST is stored in an array of Bi n Nodes. Each Bi n Node object contains three data members: one to store data and two link members that point to the left and the right child, respectively, by storing their indices in the array. Imitating the array-based implementation of linked lists in Section 6.6, do the following:

a. Write appropriate declarations for this array-based implementation of binary search trees.

b. Design and test a class for maintaining a storage pool of available nodes, with operations to initialize it, to get a node from it, and to return a node to it.

Reference no: EM131794717

Questions Cloud

Determine the total estimated uncollectibles : Determine the total estimated uncollectibles, Credit account titles are automatically indented when amount is entered
Company capital structure weights on a book value basis : What are the company's capital structure weights on a book value basis? (Do not round intermediate calculations and round your answers to 4 decimal places.
Design and test a class for maintaining a storage pool : The data structure used for the concordance is thus constructed from a good sample of those we have been studying: an array of binary search trees.
Discuss methods the controller can use to reduce costs : Name at least two documents a public company would be required to file under the SEC. How often must they be file? Describe what they are.
Generate binary trees using the function generate bsto : Write a function 1eve1ByLeve10 to traverse a tree level by level; that is, first visit the root, then all nodes on level 1.
Write a spell checker that is a program : Write a spell checker, that is, a program that reads the words in a piece of text and looks up each of them in a dictionary to check its spelling.
Evaluate the scenarios for estimating bad debts expense : Evaluate the following scenarios, assuming both companies use the next credit sales as the basis for estimating bad debts expense.
Write a program to process a bst whose nodes contain : Write a program to process a BST whose nodes contain characters. The user should be allowed to select from the following menu of options.
Prepare the property and equipment section of balance sheet : On January 2, 2016, Perry Company purchased land. Prepare the property, plant, and equipment section of the balance sheet as of December 31, 2016.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Investment strategy your knowledge of algorithms

Planning an investment strategy your knowledge of algorithms helps you obtain an exciting job with the acme computer company, along with a $10,000 signing bonus. you decide to invest this money with the goal of maximizing your return at the end of..

  Create a detailed uml class diagram in astah

For each method that you identify, write the post-conditions and then write the associated unit tests. The post-conditions are to be written in the report. Ensure that they are clearly identified.

  Let t be the degree of a btree

Let t be the degree of a BTree. Suppose the size of each object, including the key, stored in the tree is 90 bytes. Also, suppose the size of a BTreeNode pointer is 4 bytes.

  Portfolio planning using optimization

Set this problem up as a linear programming model in Excel, and use Solver to determine how the $10 million should be invested. What is the overall return (in dollars terms)

  Create algorithm which generates access control matrix

Create an algorithm which generates the access control matrix A for any given history matrix H of the Chinese Wall model.

  Implement advanced data structure

CSE250 Fall -  Implementation has to be efficient and you have to work under certain con- straints -  certain simple functionality is best achieved by a data structure that builds on top of other, standard, data structures

  Find the critical path of the project network

For given Example, suppose that the programmers choose not to obtain additional help to complete the project; that is, Bonner will code the modules.

  What are the characteristics of a good algorithm

What is an algorithm? What are the characteristics of a good algorithm and what do you mean by complexity of an algorithm? Explain the meaning of worst case analysis and best case analysis with an example.

  Algorithm to minimize average difference between height

The problem is to assign each skier a ski to minimize the average difference between height of a skier and his/her ski. Give pseudocode and write its asymptotic running time.

  Nbspa stack evaluating the postfix expression lrm using

nbspa stack evaluating the postfix expression lrm using linked list implementationthis step will use the queue

  Create a classification model for letter recognition

Create a classification model for letter recognition using decision trees as a classification method with a holdout partitioning technique for splitting the data into training versus testing

  Create a flowchart to determine the cause of problems

Assume you are the 1st level help desk technician at a average sized corporations. Your job is to handle the initial calls from corporation  computer users with personal computer related problems.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd