Searching and Hashing

14 Karteikartenvon MariaE
Diese Karteikarten lernenKostenlos · Spaced Repetition · iPhone, Android, Mac & Web

Alle Karten

1
Most hash tables are not full.
  • TRUE
  • FALSE
2
Any function can be a hash function if it produces an integer that is suitable to be used as an array index.
  • TRUE
  • FALSE
3
If a class overrides the method equals, it should not override the method hashCode.
  • TRUE
  • FALSE
4
If the method equals considers two objects to be equal, then the method hashCode must return the same value for both objects.
  • FALSE
  • TRUE
5
Calling the method hashCode more than once on an object that has not been altered should return the same value.
  • FALSE
  • TRUE
6
The size of a hash table should always be an even number.
  • TRUE
  • FALSE
7
In open addressing with linear probing, a successful search for an entry that corresponds to a given search key could potentially follow a different probe sequence used to add the entry to the hash table.
  • FALSE
  • TRUE
8
True or False
  • TRUE
9
Calculate the hash code for “ACE” with g = 7, given Unicode 'A' = 65, 'C' = 67, 'E' = 69
Answer: 65 * 9 + 67 * 3 + 69 * 1 = 855
10
Given a hash table length of 29, what index will the value 371 map to?
Answer: 371 % 29 = 23
11
What is λ for a hash table with 500 locations and 200 entries that uses open addressing?
Answer: 200 / 500 = 0.40
12
What are the two categories for collision resolution?
[A] Linear Probing [B] Buckets
13
Which of the following are 4K+3 prime numbers? a) 6863 b) 857
a) 6863 YES b) 857 NO
14
Given the following possible implementations of the hashCode method, which of these would be valid implementations for a class's hashCode method?
  • @Override
    public int hashCode() {
    return 42;
    }
  • @Override
    public int hashCode() {
    return this.id;
    }
  • @Override
    public int hashCode() {
    return this.name.hashCode() * 31 + this.age;
    }
  • @Override
    public int hashCode() {
    return (int) (Math.random() * 1000);
    }
Alle 14 Karten kostenlos lernen

Mehr Karteikarten: Informatik

1.2.2 application generation22 KartenInformatik · EnglischSabs2023c programming18 KartenInformatik · EnglischHaseeb1968computer shahaan13 KartenInformatik · EnglischIsmatDirectory Services and Attributes177 KartenInformatik · EnglischAydenIntro to IT - WGU129 KartenInformatik · EnglischSamSection 2: Networking93 KartenInformatik · EnglischpzxliAI Applications (Vietnamese)73 KartenInformatik · VietnamesischTonyComputers in society:261 KartenInformatik · EnglischCalLecture 1 + Lecture 1 (IDK)50 KartenInformatik · EnglischAmoghCommunications Technology in Information Systems42 KartenInformatik · Englisch—Griffith—Bits & Data Representation Study Guide37 KartenInformatik · EnglischSgDatabase31 KartenInformatik · EnglischFaizah

Alle Decks: Informatik

Lerne diese Decks in der App

Kostenlos auf iPhone, Android, Mac und im Web. Füge jedes Deck mit einem Tipp zu deinem Konto hinzu.

Laden im App StoreJetzt bei Google Play
Alle 14 Karten kostenlos lernen