3 Matching Annotations
  1. Dec 2023
    1. if (num_elements + 1 >= table_slot_size) { table_slot_size = table_slot_size * 2; LinkedList** newTable = new LinkedList*[table_slot_size]; for (int i = 0; i < table_slot_size; i++) { newTable[i] = nullptr; }

      initialize a new table with empty values.

    2. int idx = this->get_hash_index(name); if (table[idx] == NULL) { table[idx] = new LinkedList; // msh } ListNode* n = new ListNode(name); table[idx]->insert(n); num_elements++; return true; }

      this is the actual insertion of your new node. All previous is to handle the cases of it being full or already existing

    3. }

      this goes through the linked list, taking the head of the list using pop, then shoving it into the new list at it's hash index. It considers that if the new one is empty, a linked list must be dynamically allocated.