Course topic 12

Self-study

The topic for this week is Hash tables.

The following links will take you to the video-lectures and the accompanying slides:

Hashtables

How is a key used in a hash table?
Suppose in a hash table we want to store two keys \(k1\) and \(k2\) and their accompanying records. Assume \(k1\) is stored before \(k2\). If \(k1\) and \(k2\) point to the same bucket, how is this situation handled in open hashing?
Suppose in a hash table we want to store two keys \(k1\) and \(k2\) and their accompanying records. Assume \(k1\) is stored before \(k2\). If \(k1\) and \(k2\) point to the same bucket, how is this handled in closed hashing?
Which of the following are properties of a good hash function? (More than 1 property may be correct.)
Suppose we are using the std:unordered_map container from STL. For which of the following situations will it be necessary for us to provide our own hash function?
Rehashing is necessary when …
Suppose we are using a hash table with open-hashing. What is the load factor of such a hash table?
Suppose we are using a hash table with open-hashing. Suppose we want to search for key \(k\) in the hash table. From an runtime efficiency viewpoint, what is the worst possible situation for this search operation?
Suppose we are using a hash table with open-hashing and that our hash function does a good job at uniformly distributing the keys amongst the buckets. To determine when rehashing is done, an upper limit on the load factor must be set. The value of this upper limit is a compromise between what two things?
Which of the following statements is the most accurate regarding the runtime efficiency of one search operation in a hash table?
What is a central question, related to this course, whose answer can be found in this week’s videos?
Of the following topics, which do you think deserves further discussion/explanation during the weekly consultation session?
Were there any parts of the video lectures that were particularly difficult? Particularly interesting? Something about which you wish to learn more?

Extra links on the topic:

Week12 - Glossary

Submit weekly exercises

Questions to be submitted this week

Course topic 13

Self-study

The topics for this week are the following: (i) Binary search trees, (ii) Balanced binary search trees

The following links will take you to the video-lectures and the accompanying slides:

Binary search trees

Suppose all the keys in a binary search tree (BST) are unique. Let \(x\) and \(y\) be two nodes in the BST whose keys are \(x.key\) and \(y.key\). Which of the following statements are always true? (More than 1 statement may be true.)
Suppose all the keys in a binary search tree (BST) are unique. When searching for a particular \(k\) key using a standard BST search algorithm, the algorithm reaches a leaf \(x\). Which of the following is true?
To obtain all the keys of a binary search tree in ascending order …
Suppose all the keys in a binary search tree (BST) are unique and we want to insert a new node having key \(k\) into the BST using the standard insert algorithm. What can be said about the position of the new node?
Suppose all the keys in a binary search tree (BST) are unique and let the tree have at least 1000 nodes. Let \(x\) be a leaf in the BST whose key is \(x.key\). If a new node \(y\) having key \(y\) is being inserted, which of the following claims is true?

Balanced binary search trees and the efficiency of binary search tree operations

Suppose a binary search tree (BST) has been formed by adding \(n\) nodes to an empty BST and \(n > 1000\). In addition suppose that we are performing a search for a key that does not occur in the BST. The worst case runtime efficiency for such a search is linear in \(n\). Which of the following properties does not correspond to a BST having this worst case runtime efficiency?
Suppose a rotation is performed on BST \(B1\) with the result being BST \(B2\). Which of the following is not a possible consequence of the rotation?
Which of the following is not true for an AVL binary search tree?
Suppose a binary search tree (BST) has been formed by adding \(n\) nodes to an empty BST and \(n > 1000\). Consider two alternatives: (I) in forming the BST nothing special is done to try to keep it balanced, (II) the BST is formed using either an AVL or a red-black BST. What advantage do we gain by in using alternative (II)?
What is a central question, related to this course, whose answer can be found in this week’s videos?
Of the following topics, which do you think deserves further discussion/explanation during the weekly consultation session?
Were there any parts of the video lectures that were particularly difficult? Particularly interesting? Something about which you wish to learn more?

Extra links on the topic:

A site where you can visualize operations on binary search trees

Week13 - Glossary

Submit weekly exercises

Questions to be submitted this week

Course topic 14

The only video this week is a blooper collection .

Blooper collection (mostly in Finnish)

Extra links on the topic:

The Introduction to Algorithms course of MIT

Submit weekly exercises

There are no more exercises to be submitted.