Searching Algorithms and Complexity

Searching Algorithms and Complexity

Assessment

Quiz

Professional Development

Professional Development

Medium

Created by

Harshith J Poojary

Used 1+ times

FREE Resource

Student preview

quiz-placeholder

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Sneha is looking for her favorite book in a shelf filled with various books. What is linear search and how does it work?

Linear search uses a hash table to find elements efficiently.

Linear search requires the list to be sorted before searching.

Linear search is a sequential search algorithm that checks each element in a list one by one.

Linear search is a binary search algorithm that divides the list in half.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Vanya is looking for a specific book in a library that has its books sorted by title. She wants to find the book quickly. Explain how she can use the binary search algorithm to locate the book.

Binary search requires an unsorted list to function properly.

Binary search checks every element in the list sequentially.

Binary search can only be used with numerical data types.

Binary search is an efficient algorithm for finding an item from a sorted list of items by repeatedly dividing the search interval in half.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Naira is searching for her favorite book in a library that has a collection of n books arranged randomly. What is the time complexity of her search in the worst case?

O(log n)

O(1)

O(n)

O(n^2)

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Neha is searching for a specific book in a library that has a collection of books organized in alphabetical order. What is the time complexity of her search using binary search in the worst case?

O(log n)

O(1)

O(n log n)

O(n)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Arjun is looking for a specific book in a library. He can either check each book one by one (linear search) or use the library's catalog to find the book quickly (binary search). How does the efficiency of linear search compare to binary search?

Binary search is less efficient than linear search.

Linear search is faster than binary search.

Binary search is more efficient than linear search.

Both searches have the same efficiency.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Myra is searching for a specific book in her messy room. In which scenarios would she prefer linear search over binary search?

When the data is unsorted or when dealing with small datasets.

When the dataset is structured as a tree

When the data is sorted and large

When searching for multiple elements at once

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Vanya is searching for her favorite book in a library that has a collection of books arranged in a single row. What is the best case time complexity of her linear search for the book?

O(n^2)

O(n)

O(log n)

O(1)

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?