100% Guaranteed Results


ADS – HOMEWORK9 Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

ALGORITHMS AND DATA STRUCTURES (CH08-320201)
Prof. Dr. Michael Sedlmair
Computer Science & Electrical Engineering
Problem 1: Hash Tables (5+8 = 13 points)
(a) Given the sequence < 3,10,2,4 >, apply the double-hashing strategy for open addressing to store the sequence in the given order in a hash table of size m = 5 with hash functions h1(k) = k mod 5 and h2(k) = (7.k) mod 8. Document all collisions and how they are resolved (provide computations).
(b) Implement a hash table that supports insertion and querying with open addressing using linear probing. The implementation should be consistent with the following class specification:
class Node{ public:
int key; int value;
Node(int key, int value);
} class HashTable{ private: Node **arr; int maxSize; int currentSize;
public:
HashTable(); hashCode(int key); void insertNode(int key, int value); int get(int key); bool isEmpty();
}
5
10
15
Problem 2: Greedy Algorithms (2 + 6 = 8 points)
(b) Assuming an unsorted sequence of activities, derive a greedy algorithm for the activity-selection problem that selects the activity with the final starting time. Your solution should not simply sort the activities and then select the activity.
Remarks
• Exercises marked with a * are bonus problems. These count towards your number of points for this homework. The maximum number of official points can not be exceeded.
2

Reviews

There are no reviews yet.

Be the first to review “ADS – HOMEWORK9 Solved”

Your email address will not be published. Required fields are marked *

Related products