Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Leftist tree/ leftist heap

Assoume you give away points to the 100 best Students.

Assume you have n > 100 students and all studnets have a diffrent amount of points. Let 0 be the middle from the scale. If the point are lower, the Student is a bad one, if its a higher amount of points the student is a good one. Also assume the Datatype where the students are saved is a leftist tree/heap but only 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 that you 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 the student 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 your Distancevalue by 1 if its >1. Wich operations do he have to use and 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 by words 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(n log n). again describe the algorithm by words and why the runtime is respected.

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

305 mg of C6H12O6 in 55.2 mL of solution whats the molarity

Answered: 1 week ago