Question DSA-QUE-0080
HardA queue is implemented with a Python list using pop(0). Why is this slow?
- A.
It uses too little memory
- B.
Lists can't store numbers
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Queues and Deques question
A queue is implemented with a Python list using pop(0). Why is this slow?
It uses too little memory
Lists can't store numbers
Sign up free to see the answer and a step-by-step explanation.
pop(0) is O(1)
pop(0) shifts every remaining element, costing O(n)