Menu

Leftist Tree Leftist Heap Assoume Give Away Points 100 Best Students Assume N 100 Students Q43797964

Leftist tree/ leftist heap

Assoume you give away points to the 100 best Students.

Assume you have n > 100 students and all studnets have adiffrent amount of points. Let 0 be the middle from the scale. Ifthe point are lower, the Student is a bad one, if its a higheramount of points the student is a good one. Also assume theDatatype where the students are saved is a leftist tree/heap butonly with the Operations:

init(k) -> O(1)
makes a tree with with the key “k”

insert(D,k) -> O(log n)
inserts a key “k” into the tree D

delete-min(D) -> O(log n)
deletes the smalles element from tree D

relocate(D,k,y) -> O(n)
first delete(D,k) than changes k to y and insert(D,k) after thatyou replaced the key “k” by “y”

merge(D1,D2) -> O(log n)
merges two trees

O(x) -> Runtime x // Big O

The key x of a student k is the value from the points. If thestudent is lower in the tree from k in D, so k gets more points,that means the student at the top root gets the lowest points.

i) Assume Studnet k is a better student than k’. Does k 100%gets more points than k’? explain why/why not?

ii) Assume a imp offers you a deal.He offers you to lower yourDistancevalue by 1 if its >1. Wich operations do he have to useand why you should take this offer/why not?

iii)Assume that you want to get the 100 baddest students.because you want give them any points. Describe a algorithm bywords or pseudocode how you can get them in a runtime of O(log n)explain why the runtime is respected.

iv) now you want to get the best students in a runtime of O(nlog n). again describe the algorithm by words and why the runtimeis respected.

Expert Answer


Answer to Leftist tree/ leftist heap Assoume you give away points to the 100 best Students. Assume you have n > 100 students and a…

OR