Algorithms Interview Exam
Questions with Answers
What is a data structure? - Correct Answers: A way of defining, storing, and retrieving data in a
structural and systematic way.
What is an algorithm? - Correct Answers: A step by step procedure, which defines a set of instructions to
be executed in a certain order to get a desired output.
Why do we do algorithm analysis? - Correct Answers: A problem can be solved in more than one way.
So, many solution algorithms can be derived for a given problem. We must implement the most suitable
algorithm.
What are the criteria of algorithm analysis? - Correct Answers: An algorithm is generally analyzed by two
factors -- *execution time* and *space required* by the algorithm.
What is asymptotic analysis of an algorithm? - Correct Answers: Refers to defining the mathematical
bounds/framing of an algorithms run-time performance.
What are the 3 primary asymptotic notations? - Correct Answers: *Best case* - Ω(n).
*Worst case* - Ο(n) notation.
*Average case* - Θ(n) notation.
What is a linear data structure? - Correct Answers: A data structure that contains sequentially arranged
data items. The next item can be located in the next memory address.
Arrays and lists are examples of linear data structures
What are common operations that can be performed on data structures? - Correct Answers: *Insertion*
- adding a data item.
, *Deletion* - removing a data item.
*Traversal* - accessing and/or printing all data items.
*Searching* - finding a particular data item.
*Sorting* - arranging data items in a pre-defined sequence.
Briefly explain the approaches to developing algorithms? - Correct Answers: *Greedy Approach* -
finding solution by choosing next best option.
*Divide and Conquer* - dividing the problem to a minimum possible sub-problem and solving them
independently.
*Dynamic Programming* - dividing the problem into a minimum number of possible problems and
solving them in a combined manner.
What are some examples of greedy algorithms? - Correct Answers: Traveling Salesman
Prim's Minimal Spanning Tree Algorithm
Kruskal's Minimal Spanning Tree Algorithm
Dijkstra's Minimal Spanning tree Algorithm
Graph - Map Coloring
Graph - Vortex Cover
Knapsack Problem
Job Scheduling Problem
What are some examples of divide and conquer algorithms? - Correct Answers: Merge sort
Quick sort
Binary search
Strassen's Matrix Multiplication
Closest pair (points)