Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Mathematisch-Naturwissenschaftliche Fakultät

Institut für Informatik, Anja Rey

Exercise Sheet 5
for the lecture on

Advanced Programming and Algorithms


Submission until Monday, 21th November, 12:30 pm.
Discussion in the exercise classes on 28th November and 2nd December, 2022.

Problem 1 to hand in: Data Structure


Describe a data structure that can store keys from a set M with |M | = m elements. Keys
can be stored multiple times in the data structure. The following methods should be
mananged by the data structure:

• initialise(): set up an empty instance in O(m),

• insert(x): insert a new key x ∈ M into the instance in O(1),

• search(x): search for the first occurence of a given key x in O(1),

• delete(x): delete all occurences of a given key in O(1), and

• count(x): count all occurences of a given key in O(1).

Describe each of these methods (intuitively or in pseudocode) and explain why their
running times are fulfilled.

Problem 2 for discussion: tba

You might also like