Demonstrate O(1) dict lookup vs O(n) list search
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Demonstrate O(1) dict lookup vs O(n) list search. Create a list and dict both containing range(100000). Check if 99999 is in each. Print both boolean results and print 'Dict lookup is O(1)'.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.