Question DSA-HEAP-0076
HardWhat does heapq.nlargest(k, data) cost for n items?
- A.
O(k)
- B.
O(n log k)
- 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
Heaps and Priority Queues question
What does heapq.nlargest(k, data) cost for n items?
O(k)
O(n log k)
Sign up free to see the answer and a step-by-step explanation.
O(n log n)
O(n²)