The time complexity of checking the existence of an element in a list is _______.
- O(1)
- O(log n)
- O(n)
- O(n^2)
The time complexity of checking if an element exists in an unsorted list is O(n), where 'n' is the number of elements in the list. It requires searching through the list linearly to find the element.
Loading...
Related Quiz
- A variable name in Python cannot start with a _______.
- When reading a file in text mode in Python, what does the file method readline() return?
- Which operator will return True if both the operands are true?
- What is the purpose of the name variable in Python?
- When creating a test case in the unittest framework, which method is used to contain the individual tests that the test runner will execute?