1. What is an algorithm?
• An algorithm is a step-by-step procedure or a set of rules for
solving a specific problem or accomplishing a particular task.
2. What are the key properties of a good algorithm?
• The key properties of a good algorithm are correctness,
efficiency, clarity, and generality. A good algorithm should
produce the correct output, be efficient in terms of time and
space complexity, be easy to understand, and applicable to a
wide range of inputs.
3. What is the difference between an algorithm and a program?
• An algorithm is a high-level description of a solution to a
problem, whereas a program is the implementation of that
algorithm in a specific programming language.
4. What is the time complexity of an algorithm?
• Time complexity measures the amount of time an algorithm
takes to run as a function of the input size. It helps analyze how
the running time increases with the size of the input.
5. What is the space complexity of an algorithm?
• Space complexity measures the amount of memory an
algorithm requires as a function of the input size. It helps
analyze how the memory usage increases with the size of the
input.
6. What is the "Big O" notation used for in algorithm analysis?
• "Big O" notation is used to express the upper bound or worst-
case time complexity of an algorithm. It provides a way to
describe how the algorithm's performance grows as the input
size increases.
7. What is the difference between the average-case and worst-case
time complexity of an algorithm?
• The worst-case time complexity represents the maximum
amount of time an algorithm takes to complete for any given
input of size 'n'. The average-case time complexity represents
the expected or average amount of time an algorithm takes to
complete for random inputs of size 'n'.
8. What is the difference between recursion and iteration?
• Recursion is a technique where a function calls itself to solve a
smaller version of the problem until it reaches the base case.