(Complete Exam Review)|Complete Verified Questions
Provided with A+ Graded Rationales Latest Updated 2026
Finiteness
An algorithm must always have a finite number of steps before it ends, with a defined
endpoint or output.
Definiteness
An algorithm needs to have exact definitions for each step to ensure clear and straightforward
directions.
Input
An algorithm requires one or more inputs, which are values supplied to the algorithm from a
predetermined range of acceptable values.
Output
One or more outputs must be produced by an algorithm, which is the outcome after every
step has been completed.
Effectiveness
An algorithm's stages must be straightforward enough to be carried out in a finite time using
fundamental operations.
Generality
An algorithm should be able to solve a group of issues rather than being limited to a single
particular case.
Modularity
This feature allows an algorithm to break a problem down into small modules or steps.
Correctness
An algorithm's correctness is defined as when the given inputs produce the desired output.
Maintainability
The algorithm should be designed in a straightforward way so that no significant changes are
needed when redefining it.
,Functionality
It takes into account various logical steps to solve a real-world problem.
Robustness
Robustness refers to an algorithm's ability to define a problem clearly.
User-friendly
If the algorithm is difficult to understand, the designer will not explain it to the programmer.
Simplicity
If an algorithm is simple, it is easy to understand.
Extensibility
Your algorithm should be extensible if another designer or programmer wants to use it.
Brute Force Algorithm
A straightforward approach that exhaustively tries all possible solutions, suitable for small
problem instances.
Recursive Algorithm
A method that breaks a problem into smaller, similar subproblems and applies itself
repeatedly until reaching a base case.
Encryption Algorithm
Utilized to transform data into a secure, unreadable form using cryptographic techniques.
Backtracking Algorithm
A trial-and-error technique used to explore potential solutions by undoing choices that lead
to incorrect outcomes.
Searching Algorithm
Designed to find a specific target within a dataset, enabling efficient retrieval of information.
Sorting Algorithm
Aimed at arranging elements in a specific order to enhance data organization and retrieval.
Hashing Algorithm
Converts data into a fixed-size hash value for rapid data access and retrieval in hash tables.
,Divide and Conquer Algorithm
Breaks a complex problem into smaller subproblems, solves them independently, and
combines their solutions.
Greedy Algorithm
Makes locally optimal choices at each step in the hope of finding a global optimum.
Dynamic Programming Algorithm
Stores and reuses intermediate results to avoid redundant computations, enhancing
efficiency.
Randomized Algorithm
Utilizes randomness in its steps to achieve a solution, often used in situations where an
approximate or probabilistic answer suffices.
Base Case
This is the condition under which the recursion stops. It represents the simplest instance of
the problem, which can be solved directly without further recursion.
Recursive Case
This is the part of the algorithm that breaks the problem down into smaller instances of the
same problem and then calls the algorithm recursively on these smaller instances.
Stack
Each recursive call is placed on the system call stack. When the base case is reached, the stack
begins to unwind as each instance of the function returns its result.
Factorial Calculation
The factorial of a number n (denoted as n!) is defined as O! = 1 (Base Case) and N! = n * (n-1)!
for n > O (Recursive Case).
Advantages of Recursion
Recursive solutions are often more elegant and easier to understand than their iterative
counterparts.
Direct Translation
Some problems are naturally recursive, like tree traversals, making recursion the most
straightforward approach.
, Disadvantages of Recursion
Recursive algorithms can be less efficient due to the overhead of multiple function calls and
potential stack overflow issues for deep recursion.
Memory Usage
Recursion can consume more memory because each function call adds a new frame to the call
stack.
When to Use Recursion
When a problem can naturally be divided into similar sub-problems (e.g., tree traversal,
searching algorithms like binary search).
Linear Search
Linear search is the simplest search algorithm that works by sequentially checking each
element of the array or list until the target element is found or the end of the collection is
reached.
Time Complexity of Linear Search
O(n), where n is the number of elements in the array, because in the worst case, the
algorithm may need to check every element in the array.
When to Use Linear Search
When the array or list is small, unsorted, or when simplicity is more important than
performance.
Binary Search
Binary search is much more efficient than linear search but requires the array or list to be
sorted. It works by repeatedly dividing the search interval in half.
Time Complexity of Binary Search
O(log n), where n is the number of elements in the array.
Best Case of Binary Search
O(1) — The target element is the middle element.
Average Case of Binary Search
O(log n) — The target element is not immediately found but within the sorted array.
Worst Case of Binary Search