Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer The Following Multiple Choice Questions And Choose the Correct Answer (A-D). Question 1: In the lectures, we saw three different ways of implementing a

Answer The Following Multiple Choice Questions And Choose the Correct Answer (A-D).

Question 1:

In the lectures, we saw three different ways of implementing a map. Arrange them in order of the efficiency of looking up an arbitrary item, with the fastest option first and the slowest option last.

Question 1 options:

A.

hashtable < unsorted list of pairs < sorted list of pairs

B.

sorted list of pairs < unsorted list of pairs < hashtable

C.

sorted list of pairs < hashtable < unsorted list of pairs

D.

hashtable < sorted list of pairs < unsorted list of pairs

Question 2:

You're writing the built-in software for a cheap mobile phone. In the phonebook application, you need to store a collection of names, each of which is associated with a phone number. You've been warned that the user might have two friends with the same name.

Which of the following C++ standard library classes would be best for this?

Question 2 options:

A.

std::set

B.

std::multiset

C.

std::map

D.

std::multimap

Question 3:

A hash collision is...

Question 3 options:

A.

when a hash function returns two different outputs for two different inputs

B.

when a hash function always returns the same output for the same input

C.

when a hash function returns two different outputs for the same input

D.

when a hash function returns the same output for two different inputs

Question 4:

You're setting up a hashtable, and you have a pretty good estimate of how many items you'll usually need to store in it.

How many hash buckets should you configure your hashtable with to get the best performance?

Question 4 options:

A.

Many fewer buckets than items stored

B.

Slightly fewer buckets than items stored

C.

Slightly more buckets than items stored

D.

Many more buckets than items stored

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

More Books

Students also viewed these Databases questions