[an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive] Skip to the content of the web site.In this sub-project, you will modify the class:
A Leftist heap is a node-based heap which is balanced. You are expected to implement or modify the member functions which are listed.
The run time of each member function is specified in parentheses at the end of the description.
For the most part, this function simply calls the corresponding function on the root. The exceptions are size and empty (there is no requirement for each node in the heap to know the size of its descendant sub-tree), and pop is converted into a push of one sub-tree into the other. The clear function also requires a few assignments.
The class has no friends.
A class which implements an leftist heap, a balanced min-heap structure.
All class members are already implemented.
Implemented.
Perform a traversal of the tree structure inserting the objects into the new tree. The structure of the tree need not be identical; for example a copy of a heap with a root of 2 may have left and right children 4 and 7, respectively, while the copy may have the children reversed. Even the null-path length of the root may be different between the original and the copy.
You may use any linked list, stack or queue data structure from either Project 1 or 2 to perform the traversal of the tree that is being copied. If you wish, you may use the Standard Template Library (STL) stack or queue classes. Please see std::queue and std::stack at cplusplus.com.
If you use your own linked list, stack or queue data structure, you must include those files with your submission. If you use the STL, you are not required to submit any other files.
It calls clear.
This class has five accessors which may have to be modified:
This class has three mutators which may have to be modified:
Copyright ©2005-2008 by Douglas Wilhelm Harder. All rights reserved.