Searching and Hashing

14 flashcardspar MariaE
Réviser ces flashcardsGratuit · répétition espacée · iPhone, Android, Mac et web

Toutes les cartes

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);
    }
Réviser les 14 cartes gratuitement

Plus de flashcards : Informatique

1.2.2 application generation22 cartesInformatique · AnglaisSabs2023c programming18 cartesInformatique · AnglaisHaseeb1968computer shahaan13 cartesInformatique · AnglaisIsmatDirectory Services and Attributes177 cartesInformatique · AnglaisAydenIntro to IT - WGU129 cartesInformatique · AnglaisSamSection 2: Networking93 cartesInformatique · AnglaispzxliAI Applications (Vietnamese)73 cartesInformatique · VietnamienTonyComputers in society:261 cartesInformatique · AnglaisCalLecture 1 + Lecture 1 (IDK)50 cartesInformatique · AnglaisAmoghCommunications Technology in Information Systems42 cartesInformatique · Anglais—Griffith—Bits & Data Representation Study Guide37 cartesInformatique · AnglaisSgDatabase31 cartesInformatique · AnglaisFaizah

Tous les decks : Informatique

Révise ces decks dans l’app

Gratuit sur iPhone, Android, Mac et le web. Ajoute n’importe quel deck à ton compte en un tap.

Télécharger dans l’App StoreDisponible sur Google Play
Réviser les 14 cartes gratuitement