Which algorithm, Prim's or Kruskal's, typically performs better on dense graphs?
- Both perform equally
- Depends on graph characteristics
- Kruskal's
- Prim's
Kruskal's algorithm typically performs better on dense graphs. This is because Kruskal's algorithm uses a sorting-based approach to select edges, making it more efficient when there are a large number of edges in the graph. Prim's algorithm, on the other hand, involves repeated key updates in dense graphs, leading to a higher time complexity.
The time complexity of BFS is _______ when implemented using an adjacency list representation.
- O(E log V), where E is the number of edges and V is the number of vertices
- O(V + E), where V is the number of vertices and E is the number of edges
- O(V^2), where V is the number of vertices
- O(log E), where E is the number of edges
The time complexity of BFS when implemented using an adjacency list representation is O(V + E), where V is the number of vertices and E is the number of edges. This is because each vertex and each edge is processed once during the traversal.
What is the name of the pattern matching algorithm that compares each character of the pattern with each character of the text sequentially?
- Boyer-Moore Algorithm
- Brute Force Algorithm
- Knuth-Morris-Pratt Algorithm
- Rabin-Karp Algorithm
The Brute Force algorithm is a simple pattern matching technique that sequentially compares each character of the pattern with each character of the text. It is straightforward but may be inefficient for large datasets.
Array manipulation involves operations such as _______ and _______ to modify array elements.
- Concatenation, rotation
- Insertion, deletion
- Sorting, searching
- Traversal, deletion
Array manipulation involves operations such as insertion and deletion to modify array elements. Insertion adds elements at a specific position, and deletion removes elements from a given position, helping to manage the array's content dynamically.
Topological sorting is often used in _______ resolution, particularly in systems involving tasks with dependencies.
- Conflict
- Dependency
- Priority
- Scheduling
Topological sorting is often used in Scheduling resolution, particularly in systems involving tasks with dependencies. It helps in determining the order of execution for tasks based on their dependencies, ensuring a systematic and correct execution flow.
An array is a _______ structure that stores a collection of _______ elements.
- Linear, Heterogeneous
- Linear, Homogeneous
- Non-linear, Heterogeneous
- Non-linear, Homogeneous
An array is a linear structure that stores a collection of homogeneous elements. It means that all elements in the array are of the same data type.
Linear search is _______ efficient for searching large datasets.
- Extremely
- Highly
- Moderately
- Not very
Linear search is not very efficient for searching large datasets. Since it checks each element sequentially, it may take a long time to find the desired element in a large dataset, making it less suitable for scenarios where efficiency is crucial.
Proper memory management in arrays involves _______ memory when it is no longer needed.
- Automatically releasing
- Explicitly allocating
- Restricting access to
- Storing in a separate cache
Proper memory management in arrays involves automatically releasing memory when it is no longer needed. This process, known as deallocation or freeing memory, prevents memory leaks and ensures efficient memory usage.
What is the objective of finding the longest common subsequence?
- To find the maximum length subarray that is common to two sequences.
- To find the maximum length subsequence that is common to two or more sequences.
- To identify the shortest common sequence between two sequences.
- To minimize the length of the common subsequence.
The objective of finding the longest common subsequence is to determine the maximum length subsequence that is common to two or more sequences. It is often used in applications like DNA sequence comparison and version control systems.
Rabin-Karp algorithm is particularly useful when _______.
- Dealing with sorted arrays.
- Pattern matching involves numeric data.
- Searching for a single pattern in multiple texts.
- There are multiple occurrences of the pattern in the text.
The Rabin-Karp algorithm is particularly useful when searching for a single pattern in multiple texts. It employs hashing to efficiently search for a pattern in a text, making it advantageous in scenarios where the same pattern needs to be matched across different texts.