Interview Q&A / Data Structures & Algorithms
Data Structures & Algorithms interview questions
Arrays, linked lists, hashing, trees and patterns, with line-by-line code and complexity.
Prefer rapid revision? Practise Data Structures & Algorithms short interview answers →
- How do you implement merge sort in JavaScript?
Recursively split the array into two halves until single elements remain, then merge the sorted halves by repeatedly taking the smaller front element. It runs in O(n log n) time with O(n) extra space.
BeginnerQuick answerCoding1 min read