subject

Write a program to create a binary search tree where each node has a counter to store how many times its value occurs in the tree, and then prints the pre-order, in-order and post-order transversals of the modified tree. The values that occur more than once are followed with their quantity noted in parenthesis. Input from the keyboard a single line of integer numbers separated by spaces. Assume proper input and no more than 30 values. Output to the screen the pre order, in order, and post order traversals on separate lines. Quantities larger than one are denoted with parenthesis. Each row must be properly labeled and use a minimum of one space between each number. Use a tree data structure. Refer to the sample output below. Sample Run:
Enter up to 30 integer values: 7 1 5 7 4 4 1 8 9 7 1 4 2 2 3 5 6 7 12 14 11 12
Pre Order: 7(4) 1(3) 5(2) 4(3) 2(2) 3 6 8 9 12(2) 11 14
In Order: 1(3) 2(2) 3 4(3) 5(2) 6 7(4) 8 9 11 12(2) 14
Post Order: 3 2(2) 4(3) 6 5(2) 1(3) 11 14 12(2) 9 8 7(4)

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:00, rah45
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
image
Computers and Technology, 24.06.2019 21:30, erickamiles1797
How do i copy and paste equations and pictures like math graphs, to post on this site to get my questions answered?
Answers: 2
image
Computers and Technology, 25.06.2019 08:00, sswd
Most computers today support the standard, in which the computer automatically configures new devices as soon as they are installed and the pc is powered up.
Answers: 1
image
Computers and Technology, 25.06.2019 08:20, Dweath50
E-commerce builds on traditional commerce by adding the flexibility that networks offer and the availability of the internet. - true or false
Answers: 1
You know the right answer?
Write a program to create a binary search tree where each node has a counter to store how many times...

Questions in other subjects:

Konu
English, 10.06.2020 04:57