Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: All programs must use the appropriate C + + features. Objective: Enhance the provided Treap class to incorporate additional functionalities that will help in

Note: All programs must use the appropriate C++ features.
Objective:
Enhance the provided Treap class to incorporate additional functionalities that will help in
understanding the use of augmented data structures in tree-based algorithms and OOP
principles.
Tasks:
You are provided with a basic implementation of a Treap class that includes methods for
insertion, deletion, search, etc. Your task is to modify the Treap class so that
each node can keep track of the sum of keys of nodes under this node, including
itself. Then, print the sum for each node.
For example, nodes under node 20 include node 10,22,5 and 12.
each node can keep track of the count of all nodes under this node, including itself.
Then, print the count for each node.
Add a new function to the Treap class to return the count of nodes without children
(leaf nodes). Then, print this count.
Add a new function to the Treap class to return the count of nodes with only one
child. Then, print this count.
Add a new function to the Treap class to return the count of nodes with two
children. Then, print this count.
Input & Output:
You need to provide test cases in the main function to test each additional functionality.
Submit:
1, all C++ source code
2, week10.txt: a txt file contains all the source code.
3, week10.docx or week10.pdf, this document should include
the screenshot of printing the treap, with key and priority
the screenshots for each of these five tasks.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

Students also viewed these Databases questions

Question

Discuss the six purposes of performance management. page 340

Answered: 1 week ago