Algorithms
  • 1. Algorithms are step-by-step procedures or formulas for solving problems. They are a set of instructions that describe how to perform a task or solve a problem effectively. Algorithms are used in various fields such as computer science, mathematics, engineering, and more. They help in organizing data, making decisions, and automating processes. By designing efficient algorithms, we can optimize the use of resources, improve performance, and solve complex problems in a systematic way.

    Which sorting algorithm has a worst-case time complexity of O(n2)?
A) Heap Sort
B) Merge Sort
C) Bubble Sort
D) Quick Sort
  • 2. What data structure is typically used in a Depth-First Search (DFS) algorithm?
A) Array
B) Queue
C) Binary Tree
D) Stack
  • 3. Which algorithm is commonly used to find the shortest path in a graph with non-negative edge weights?
A) Bellman-Ford algorithm
B) Prim's algorithm
C) Dijkstra's algorithm
D) A* search algorithm
  • 4. What does the 'recursion' mean in the context of algorithms?
A) A function that has no return statement.
B) A function that generates random numbers.
C) A function that calls itself in a problem-solving process.
D) A function that iterates over a collection of elements.
  • 5. Which algorithm is used to find the transitive closure of a directed graph?
A) Tarjan's algorithm
B) Floyd's algorithm
C) Kosaraju's algorithm
D) Warshall's algorithm
  • 6. Which of the following is a divide and conquer algorithm?
A) Insertion Sort
B) Bubble Sort
C) Selection Sort
D) Merge Sort
  • 7. What is the worst-case time complexity of the Quick Sort algorithm?
A) O(n)
B) O(log n)
C) O(n log n)
D) O(n2)
  • 8. Which algorithm can be used to find the maximum flow in a flow network?
A) Depth-First Search
B) Bubble Sort
C) Ford-Fulkerson algorithm
D) Binary Search algorithm
  • 9. What is the main advantage of the breadth-first search (BFS) algorithm over depth-first search (DFS)?
A) DFS uses less memory space.
B) BFS is easier to implement.
C) DFS finds the path more quickly.
D) BFS guarantees the shortest path to the goal.
  • 10. Which algorithm is used to find the longest common subsequence between two sequences?
A) Selection Sort
B) Heap Sort
C) Longest Common Subsequence algorithm
D) Radix Sort
  • 11. What is the primary goal of the Floyd-Warshall algorithm?
A) To sort elements in ascending order.
B) To find the shortest paths between all pairs of vertices in a weighted graph.
C) To determine the largest connected component in an undirected graph.
D) To calculate the maximum flow in a flow network.
  • 12. What data structure is typically used in a Breadth-First Search algorithm?
A) Stack
B) Queue
C) Linked List
D) Heap
  • 13. What is the process of making a repetitive sequence shorter by using previous occurrences called?
A) Run-Length Encoding
B) Burrows-Wheeler Transform
C) Differential Encoding
D) Huffman Coding
  • 14. What is the term for the measure of how detailed the instructions are in an algorithm?
A) Scalability
B) Efficiency
C) Granularity
D) Complexity
Created with That Quiz — the site for test creation and grading in math and other subjects.