Sorting and searching interview questions
13 questions on this data structure, most asked first. Reported by candidates in public interview write-ups and reworded by Scrivio. How the reports are counted
Your progress: 0 of 13 done, 0 saved
Search for an element in a sorted array that has been rotated.
Reported 60 times
Read the solutionBinary searchExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2020, geeksforgeeks.org 2017
Write a bubble sort and state its time complexity.
Reported 30 times
Read the solutionSorting and intervalsExample sources
3 of the write-ups counted: geeksforgeeks.org 2018, geeksforgeeks.org 2021, geeksforgeeks.org 2024
Given an array holding only 0s and 1s, sort it in O(n) time.
Reported 27 times
Read the solutionTwo pointersExample sources
3 of the write-ups counted: aced.io 2020, geeksforgeeks.org 2021, geeksforgeeks.org 2020
Merge all overlapping intervals in a list of intervals.
Reported 23 times
Read the solutionSorting and intervalsExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2014, geeksforgeeks.org 2024
Describe the common sorting techniques and how they compare.
Reported 20 times
Read the solutionData structure basicsExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2026, geeksforgeeks.org 2022
Sort an array containing only 0s, 1s and 2s in a single pass.
Reported 19 times
Read the solutionTwo pointersExample sources
3 of the write-ups counted: geeksforgeeks.org 2017, geeksforgeeks.org 2019, geeksforgeeks.org 2016
Compare merge sort with quick sort.
Reported 18 times
Read the solutionData structure basicsExample sources
3 of the write-ups counted: geeksforgeeks.org 2025, geeksforgeeks.org 2015, geeksforgeeks.org 2023
Write an implementation of quick sort.
Reported 18 times
Read the solutionSorting and intervalsExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2018, geeksforgeeks.org 2019
Find the median of two sorted arrays combined.
Reported 17 times
Read the solutionBinary searchExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2020, geeksforgeeks.org 2019
A sorted array has been rotated by an unknown amount. Find its smallest element.
Reported 17 times
Read the solutionBinary searchExample sources
3 of the write-ups counted: geeksforgeeks.org 2019, geeksforgeeks.org 2012, geeksforgeeks.org 2015
Search for a number in a sorted array using binary search.
Reported 16 times
Read the solutionBinary searchExample sources
3 of the write-ups counted: geeksforgeeks.org 2023, geeksforgeeks.org 2015, geeksforgeeks.org 2024
Explain merge sort and write a complete working implementation.
Reported 15 times
Read the solutionSorting and intervalsExample sources
3 of the write-ups counted: geeksforgeeks.org 2016, geeksforgeeks.org 2020, geeksforgeeks.org 2024
Count the inversions in an array of integers.
Reported 15 times
Read the solutionSorting and intervalsExample sources
3 of the write-ups counted: geeksforgeeks.org 2020, geeksforgeeks.org 2019, geeksforgeeks.org 2019