Question: 1) Part a) Given a binary tree T and a node v T, write a function to print the label of inorder successor of each

1)

Part a) Given a binary tree T and a node v 1) Part a) Given a binary tree T and a node v T, write a function to print the label of inorder successor of each node of the tree rooted at v. Use only the functions isExternal(v), leftChild(v), rightchild(v), label(v) of the tree T and for printing use print statement (e.g. print "Inorder successor of ", label(v), "=",label(w)). Your algorithm should use only O(1) additional space complexity.

Prove the correctness of your algorithm and derive the time complexity of your algorithm.

part b

Show diagrammatically all stages of min-heap construction with the following keys stored in an array in that order: 26; 9; 8; 22; 6; 14; 11; 15; 10; 7; 13; 12; 25; 5; 13 You should use the efficient O(n) heapify algorithm.

Part c

Implement a function HEAP DELETE(A,i) that deletes the item in location i from heap A and still maintains the heap property. Your implementation should run in O(log n) time for an n-element min-heap. Prove the time-complexity of your algorithm.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!