The aim of the thesis is the implementation of a structure which functions as both a maximum and tree as a binary search tree. In particular, each node i of the tree stored value pair (pi, ei) where pi is the priority and ei the price of the item. Priorities for pi, the pairs form tree maximum while in prices ei, forming a binary search [url removed, login to view] the following figure shows the steps to delete the pair (47,13). Essentially the pair relegated successively in the tree with a series of successive simple rotations to be stored in the tree leaves whenever and easily deleted. At each step, the rotation on the node that hosts the pair (47,13) and one of his two children, namely who has the highest priority. Eg in step (a) node (47,13) has two kids (42,10) and (36,24). The rotation occurs between the node (47,13) and (42,10) ie with a child who has the highest priority.
In the same figure appears and the process of importing following the steps from the end to the beginning. Specifically in figure (f) The introductory element (47.13), taking into account only the values ei. Then, a series of revolutions per pair (47,13) rises higher in the tree to the point that it ceases violating the basic property of the tree maxima (steps (f) - (a)).
a) Implement the functions of insertions and deletions.
b) Implement a function Find_second_next that takes as argument an element a and finds the second smallest among all elements ei of the tree that is larger than a. For example, if executed Find_second_next (11) to the tree shape (s) will be refunded the item 13.
c) Implement the operation Print_between which accepts as arguments two numbers, k1, k2 (k1 <k2) and will print all elements ei of the tree with values in the interval [k1, k2].
Will be delivered the source code printed and on CD along with the object code. Particular attention should be paid to proper documentation of your program. It is therefore your code to be accompanied by a separate document that will provide a detailed description of your techniques. Also, within the source code should be 'dense' comments couched in Greek.