Question DSA-LL-0003
EasyWhat is the time complexity of accessing the k-th element of a linked list?
- A.
O(log k)
- B.
O(1)
- C.
Show answer and explanation
Answer: C
There is no random access; you must follow k links from the head.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Linked Lists question
What is the time complexity of accessing the k-th element of a linked list?
O(log k)
O(1)
Answer: C
There is no random access; you must follow k links from the head.
O(k)
O(n²)