Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 4 pages
Exam (elaborations)

EECS 281 – Hashing || 100% Accurate Answers.

Document preview thumbnail
Preview 1 out of 4 pages

EECS 281 – Hashing || 100% Accurate Answers.

Content preview

EECS 281 – Hashing || 100% Accurate Answers.
For which of the following applications would a hash table NOT be appropriate? Select all
that apply.

a.) printing out all of the elements in sorted order
b.) storing passwords that can be looked up by uniqname
c.) returning a person's name given their phone number
d.) finding the k-th largest element in an array
e.) creating an index for an online book correct answers a, d

Two pairs (a,b) and (c,d) are symmetric if b = c and a = d. Suppose you want to find all
symmetric pairs in the array. The first element of all pairs is distinct.
For example, given {(14, 23), (11,2), (52,83), (49,38), (38,49), (2,11)}, the symmetric pairs
are {(11,2), (2, 11)} and {(49,38), (38,49)}

What is the average-case time complexity of accomplishing this task if yo use the most
efficient algorithm? If hashing is involved, assume that both search and insert methods work
in O(1) time.

a.) O(1)
b.) O(log n)
c.) O(n)
d.) O(n log n)
e.) O(n^2) correct answers c.) O(n)

Use a hashtable! The first element of each pair is the key, and the second element is the
value.

Go through the array once. For each current pair, check if the current second element is in the
hashtable, and if it is, check that its value is the same as the current first element. If it
matches, it's a symmetric pair.

What is the complexity for finding a value given a key and inserting a key into the hash table
on average? What is the worst case? correct answers Average: O(1)
Worst Case: O(n)

struct Student {
string name;
int year;
bool cs_major;
};

vector<Student> all_students;

How would I add a student in to all_students? correct answers
all_students.emplace_back("Maya", 3, true);

What are the two basic operations that Dictionary ADT's support? correct answers insert and
search

Document information

Uploaded on
November 19, 2025
Number of pages
4
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$10.84

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
SirAnton
3.7
(118)
Sold
791
Followers
438
Items
39797
Last sold
6 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions