Order from us for quality, customized work in due time of your choice.
Please follow the instructions and answer the questions. The course textbook is attached
Algorithms Midterm Exam
Instructions:Write your answers clearly and concisely.
For coding questions, you may use pseudocode or a programming language of your choice.
Ensure your code is well-commented to explain your logic.
—
Multiple Choice Questions:
1. What is the time complexity of the “Two Sum” problem using a brute-force approach?
– A) O(n)
– B) O(n log n)
– C) O(n^2)
– D) O(log n)
2. Which sorting algorithm performs best for nearly sorted arrays?
– A) Bubble Sort
– B) Insertion Sort
– C) Merge Sort
– D) Quick Sort
3. The Master Theorem is used to analyze the time complexity of algorithms based on:
– A) Recurrence Relations
– B) Dynamic Programming
– C) Graph Theory
– D) Sorting Algorithms
4. Which dynamic programming technique is suitable for problems involving string manipulation?
– A) Longest Increasing Subsequence
– B) Climbing Stairs
– C) Minimum Path Sum
– D) Edit Distance
5. Which algorithm is used for finding the shortest path in a weighted graph with non-negative weights?
– A) Dijkstra’s Algorithm
– B) Breadth-First Search
– C) Depth-First Search
– D) Bellman-Ford Algorithm
6. NP-Complete problems are a subset of problems that are:
– A) Polynomial-time solvable
– B) NP-Hard and solvable in polynomial time
– C) NP-Hard but not solvable in polynomial time
– D) Solvable in logarithmic time
7. The “Partition to K Equal Sum Subsets” problem is categorized as:
– A) Dynamic Programming problem
– B) Graph Theory problem
– C) NP-Complete problem
– D) Sorting problem
8. Which data structure is typically used for implementing a priority queue efficiently?
– A) Linked List
– B) Queue
– C) Stack
– D) Heap
9. Which of the following is not a type of binary tree traversal?
– A) Pre-order
– B) Post-order
– C) In-order
– D) Side-order
10. The complexity of binary search algorithm is:
– A) O(log n)
– B) O(n)
– C) O(n^2)
– D) O(1)
11. Which of the following algorithms is used to find the strongly connected components in a graph?
– A) Dijkstra’s Algorithm
– B) Prim’s Algorithm
– C) Kosaraju’s Algorithm
– D) Kruskal’s Algorithm
12. The time complexity of Quick Sort in the best case scenario is:
– A) O(n log n)
– B) O(n)
– C) O(n^2)
– D) O(log n)
13. Which algorithm is suitable for finding the shortest path in an unweighted graph?
– A) Dijkstra’s Algorithm
– B) Bellman-Ford Algorithm
– C) Floyd-Warshall Algorithm
– D) Breadth-First Search (BFS)
14. Which sorting algorithm is known for its stability?
– A) Quick Sort
– B) Merge Sort
– C) Heap Sort
– D) Selection Sort
15. Which of the following is an example of a greedy algorithm?
– A) Dijkstra’s Algorithm
– B) Prim’s Algorithm
– C) Knapsack Problem
– D) Floyd-Warshall Algorithm
16. The algorithm used for finding the maximum flow in a flow network is:
– A) Kruskal’s Algorithm
– B) Bellman-Ford Algorithm
– C) Edmonds-Karp Algorithm
– D) Prim’s Algorithm
17. Which of the following is not a part of the Master Theorem for divide and conquer recurrences?
– A) Divide step
– B) Conquer step
– C) Combine step
– D) Analysis step
18. Which data structure is typically used for implementing graphs?
– A) Array
– B) Linked List
– C) Tree
– D) Matrix
19. Which of the following is not a type of graph?
– A) Directed Graph
– B) Bipartite Graph
– C) Complete Graph
– D) Sequential Graph
20. The worst-case time complexity of Bubble Sort is:
– A) O(n log n)
– B) O(n)
– C) O(n^2)
– D) O(log n)
21. Which algorithm is used for finding the shortest path in a graph with negative weights?
– A) Dijkstra’s Algorithm
– B) Bellman-Ford Algorithm
– C) Floyd-Warshall Algorithm
– D) Kruskal’s Algorithm
22. Which of the following is not a type of search algorithm?
– A) Linear Search
– B) Binary Search
– C) Depth-First Search (DFS)
– D) Breadth-First Search (BFS)
23. The concept of “Big-O” notation is used to describe the:
– A) Lower bound of an algorithm
– B) Upper bound of an algorithm
– C) Exact running time of an algorithm
– D) Average running time of an algorithm
24. Which of the following is a dynamic programming problem?
– A) Longest Common Subsequence
– B) Shortest Path in a Graph
– C) Minimum Spanning Tree
– D) Topological Sorting
25. Which of the following is an example of a backtracking algorithm?
– A) Breadth-First Search (BFS)
– B) Depth-First Search (DFS)
– C) Dijkstra’s Algorithm
– D) Prim’s Algorithm
26. The “Traveling Salesman Problem” is an example of a:
– A) Sorting problem
– B) Graph problem
– C) Dynamic Programming problem
– D) NP-Complete problem
27. Which sorting algorithm is not an in-place sorting algorithm?
– A) Quick Sort
– B) Merge Sort
– C) Bubble Sort
– D) Selection Sort
28. Which of the following is used to find the strongly connected components in a directed graph?
– A) Prim’s Algorithm
– B) Dijkstra’s Algorithm
– C) Kosaraju’s Algorithm
– D) Kruskal’s Algorithm
29. Which of the following algorithms is not a comparison-based sorting algorithm?
– A) Quick Sort
– B) Merge Sort
– C) Counting Sort
– D) Insertion Sort
30. Which of the following is not a fundamental operation in a priority queue?
– A) Insert
– B) Delete
– C) Update
– D) Search
31. Which of the following data structures is used for efficient union and find operations?
– A) Stack
– B) Queue
– C) Heap
– D) Disjoint Set
32. Which of the following is an example of a hash table collision resolution technique?
– A) Linear Probing
– B) Binary Search
– C) Merge Sort
– D) Breadth-First Search (BFS)
33. The Floyd-Warshall algorithm is used for:
– A) Finding the shortest path in a graph with negative weights
– B) Finding the shortest path in a weighted graph
– C) Finding the minimum spanning tree of a graph
– D) Finding the maximum flow in a flow network
34. The complexity of finding the maximum element in a max-heap is:
– A) O(log n)
– B) O(n)
– C) O(1)
– D) O(n log n)
35. Which of the following data structures is not linear?
– A) Array
– B) Linked List
– C) Stack
– D) Binary Tree
36. Which of the following algorithms is used to find the shortest path in a weighted graph with negative weights?
– A) Dijkstra’s Algorithm
– B) Bellman-Ford Algorithm
– C) Floyd-Warshall Algorithm
– D) Kruskal’s Algorithm
37. Which of the following is an example of a greedy algorithm?
– A) Dijkstra’s Algorithm
– B) Prim’s Algorithm
– C) Knapsack Problem
– D) Floyd-Warshall Algorithm
38. Which of the following is not a part of the Master Theorem for divide and conquer recurrences?
– A) Divide step
– B) Conquer step
– C) Combine step
– D) Analysis step
39. Which data structure is typically used for implementing graphs?
– A) Array
– B) Linked List
– C) Tree
– D) Matrix
40. Which of the following is not a type of graph?
– A) Directed Graph
– B) Bipartite Graph
– C) Complete Graph
– D) Sequential Graph
41. The worst-case time complexity of Bubble Sort is:
– A) O(n log n)
– B) O(n)
– C) O(n^2)
– D) O(log n)
42. Which algorithm is used for finding the shortest path in a graph with negative weights?
– A) Dijkstra’s Algorithm
– B) Bellman-Ford Algorithm
– C) Floyd-Warshall Algorithm
– D) Kruskal’s Algorithm
43. Which of the following is not a type of search algorithm?
– A) Linear Search
– B) Binary Search
– C) Depth-First Search (DFS)
– D) Breadth-First Search (BFS)
44. The concept of “Big-O” notation is used to describe the:
– A) Lower bound of an algorithm
– B) Upper bound of an algorithm
– C) Exact running time of an algorithm
– D) Average running time of an algorithm
45. Which of the following is a dynamic programming problem?
– A) Longest Common Subsequence
– B) Shortest Path in a Graph
– C) Minimum Spanning Tree
– D) Topological Sorting
46. Which of the following is an example of a backtracking algorithm?
– A) Breadth-First Search (BFS)
– B) Depth-First Search (DFS)
– C) Dijkstra’s Algorithm
– D) Prim’s Algorithm
47. The “Traveling Salesman Problem” is an example of a:
– A) Sorting problem
– B) Graph problem
– C) Dynamic Programming problem
– D) NP-Complete problem
48. Which sorting algorithm is not an in-place sorting algorithm?
– A) Quick Sort
– B) Merge Sort
– C) Bubble Sort
– D) Selection Sort
49. Which of the following is used to find the strongly connected components in a directed graph?
– A) Prim’s Algorithm
– B) Dijkstra’s Algorithm
– C) Kosaraju’s Algorithm
– D) Kruskal’s Algorithm
50. Which of the following algorithms is not a comparison-based sorting algorithm?
– A) Quick Sort
– B) Merge Sort
– C) Counting Sort
– D) Insertion Sort
True/False Questions:
51. Binary Search can only be applied to sorted arrays. (True/False)
52. Bubble Sort is always stable. (True/False)
53. Quickselect is an algorithm for finding the kth smallest element in an unsorted array. (True/False)
54. Dynamic Programming can only be applied to problems with optimal substructure and overlapping subproblems. (True/False)
55. Breadth-First Search (BFS) is suitable for finding the shortest path in a weighted graph. (True/False)
56. NP-Complete problems can be solved in polynomial time. (True/False)
57. The “Word Break” problem can be efficiently solved using dynamic programming. (True/False)
58. Kruskal’s Algorithm is used for finding the shortest path in a weighted graph. (True/False)
59. Merge Sort has a worst-case time complexity of O(n^2). (True/False)
60. The Bellman-Ford algorithm can handle graphs with negative-weight edges but not negative-weight cycles. (True/False)
61. Dijkstra’s Algorithm is an example of a greedy algorithm. (True/False)
62. The Floyd-Warshall algorithm computes shortest paths in a graph with negative weights. (True/False)
63. Binary Search has a time complexity of O(log n). (True/False)
64. Depth-First Search (DFS) can be used to detect cycles in a graph. (True/False)
65. Counting Sort is a stable sorting algorithm. (True/False)
66. The maximum number of edges in an undirected graph with n vertices is n(n-1)/2. (True/False)
67. Prim’s Algorithm finds the minimum spanning tree of a graph. (True/False)
68. Insertion Sort is typically more efficient than Quick Sort for large datasets. (True/False)
69. The Master Theorem is used to analyze the time complexity of divide and conquer algorithms. (True/False)
70. Breadth-First Search (BFS) explores nodes in a depthward motion. (True/False)
71-100. Write a complex algorithm from this class and explain it.
Order from us for quality, customized work in due time of your choice.