Algorithm_Questions_and_Answers_Extended
Algorithm_Questions_and_Answers_Extended
1. What is an Algorithm?
An algorithm is a finite set of instructions or logic, written in order, to accomplish a certain predefined
task.
An algorithm must be clear, finite, effective, and should produce the desired output.
Time complexity is the computational complexity that describes the amount of time an algorithm
Space complexity is the amount of memory space required to solve a problem as a function of the
input size.
Big-O notation is a mathematical representation used to describe the upper bound of an algorithm's
Recursion is a method where the solution to a problem depends on solutions to smaller instances of
A greedy algorithm builds up a solution piece by piece, choosing the next piece that offers the most
immediate benefit.
Dynamic programming is a method for solving complex problems by breaking them down into
simpler subproblems and solving them just once, storing their solutions.
Backtracking is an algorithmic technique for solving problems recursively by trying to build a solution
incrementally.
A heuristic algorithm is one that finds a good enough solution for a problem quickly when classic
BFS is a traversal algorithm for graphs that starts at a source node and explores all neighboring
nodes at the current depth before moving to nodes at the next depth level.
DFS is a traversal algorithm for graphs that explores as far as possible along a branch before
backtracking.
A sorting algorithm is used to rearrange a given array or list elements according to a comparison
Quick Sort is a sorting algorithm that uses the divide and conquer approach to sort elements by
Linear Search is a simple searching algorithm that checks each element of the list sequentially until
Hashing is the process of converting an input into a fixed-size string of characters, which is usually a
hash code.
A hash table is a data structure that maps keys to values for highly efficient lookup.
The input is the data provided to the algorithm, and the output is the result obtained after executing
Pseudocode is a high-level description of an algorithm, intended for humans rather than machines.
NP-completeness refers to a class of problems for which no efficient solving algorithm has been
The traveling salesman problem is a classic optimization problem that asks for the shortest possible
route that visits each city and returns to the origin city.
The knapsack problem is a problem in combinatorial optimization where the goal is to maximize the
The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding
The Tower of Hanoi is a mathematical puzzle where you move a set of disks from one rod to
A sorting algorithm is stable if it preserves the relative order of records with equal keys.
Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent
Insertion Sort is a simple sorting algorithm that builds the final sorted array one item at a time.
Selection Sort is a sorting algorithm that repeatedly selects the smallest element from the unsorted
Merge Sort is a divide and conquer algorithm that splits the array into halves, sorts them, and then
Radix Sort is a non-comparative sorting algorithm that sorts integers by processing individual digits.
A priority queue is a data structure where each element has a priority and elements are served
Graphs can be represented using adjacency lists, adjacency matrices, or incidence matrices.
A spanning tree is a subset of a graph that connects all the vertices together without forming any
cycles.
Prim's Algorithm is used to find the minimum spanning tree of a graph by selecting the smallest
Kruskal's Algorithm finds the minimum spanning tree by sorting all edges and adding them one by
Dijkstra's Algorithm finds the shortest path between a source node and all other nodes in a weighted
graph.
The Floyd-Warshall Algorithm is a graph algorithm for finding shortest paths in a weighted graph