Sorted vs. Unsorted Address Book Performance Quiz Quiz

  1. Search Complexity

    What is the average time complexity of searching for a contact in an unsorted address book using a linear search?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  2. Sorted Search Efficiency

    What is the average time complexity of searching for a contact in a sorted address book using binary search?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  3. Best Case Unsorted

    In an unsorted address book, what is the best-case time complexity for finding a contact?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  4. Best Case Sorted

    In a sorted address book, what is the best-case time complexity for finding a contact using binary search?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  5. Insertion Impact - Unsorted

    What is the typical time complexity for inserting a new contact into an unsorted address book?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  6. Insertion Impact - Sorted

    What is the typical time complexity for inserting a new contact into a sorted address book while maintaining the sorted order?

    1. A. O(1)
    2. B. O(log n)
    3. C. O(n)
    4. D. O(n log n)
    5. E. O(n^2)
  7. Data Structure Choice

    If search performance is critical and insertions are infrequent, which data structure is most suitable for storing an address book?

    1. A. Unsorted Array
    2. B. Sorted Array
    3. C. Linked List
    4. D. Hash Table
    5. E. Unsorted Linked List
  8. Scenario: Many Inserts

    Consider a scenario with frequent insertions and deletions. Which data structure might be more suitable for managing an address book, even if search performance slightly degrades?

    1. A. Sorted Array
    2. B. Unsorted Array
    3. C. Binary Search Tree
    4. D. Hash Table
    5. E. Stack
  9. Address Book Size

    When would the difference in search performance between a sorted and unsorted address book become significantly noticeable?

    1. A. When the address book contains less than 10 entries.
    2. B. When the address book contains around 100 entries.
    3. C. When the address book contains thousands of entries.
    4. D. Only on very old computers.
    5. E. The performance difference is negligible regardless of size.
  10. Hybrid Approach

    What is a potential hybrid approach to manage very large address books for improved performance?

    1. A. Always use unsorted arrays.
    2. B. Never use sorting.
    3. C. Combine a hash table for fast lookups with a sorted list for range queries.
    4. D. Store the address book in a single string.
    5. E. Use only linked lists.