C949 - Data Structure and Algorithms Practice Test

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which algorithm is used to find the maximum sum of a subarray in an array? a. Breadth-first search (BFS) b. Depth-first search (DFS) c. Dijkstra's algorithm d. Kadane's algorithm

Kadane's algorithm

Which data structure is suitable for implementing a stack? a. Array b. Linked List c. Hash Table d. Heap

Linked List

Which data structure is typically used to implement a queue? a. Array b. Linked list c. Stack d. Hash table

Linked list

Which algorithm is used to find the longest common subsequence between two sequences? a. Breadth-first search (BFS) b. Depth-first search (DFS) c. Dijkstra's algorithm d. Longest Common Subsequence (LCS) algorithm

Longest Common Subsequence (LCS) algorithm

What is the time complexity of a binary search algorithm? a. O(1) b. O(log n) c. O(n) d. O(n^2)

O(log n)

Which algorithm is used to find the shortest path between nodes in a graph? a. Breadth-First Search (BFS) b. Depth-First Search (DFS) c. Dijkstra's Algorithm d. Bellman-Ford Algorithm

Dijkstra's Algorithm

Which algorithm is used to find the shortest path between nodes in a weighted graph? a. Breadth-first search (BFS) b. Depth-first search (DFS) c. Dijkstra's algorithm d. Prim's algorithm

Dijkstra's algorithm

Which algorithmic paradigm divides a problem into smaller subproblems and solves them independently? a. Greedy algorithm b. Divide and conquer c. Dynamic programming d. Backtracking

Divide and conquer

Which technique involves reducing a problem to smaller subproblems and solving them recursively? a. Greedy technique b. Divide and conquer c. Backtracking d. Dynamic programming

Divide and conquer

Which data structure provides constant-time average-case insertion, deletion, and retrieval operations? a. Array b. Linked List c. Hash Table d. Stack

Hash Table

Which sorting algorithm has the best worst-case time complexity of O(n log n)? a. Bubble Sort b. Merge Sort c. Selection Sort d. Insertion Sort

Merge Sort

Which data structure allows efficient insertion, deletion, and retrieval operations with a time complexity of O(1)? a. Array b. Linked List c. Hash Table d. Stack

Hash Table

Which of the following is NOT a characteristic of an algorithm? a. Finiteness b. Determinism c. Adaptability d. Input and Output

Adaptability

Which data structure uses the "Last-In-First-Out" (LIFO) principle? a. Queue b. Heap c. Stack d. Hash Table

Stack

What is the worst-case time complexity of a linear search algorithm? a. O(1) b. O(log n) c. O(n) d. O(n^2)

O(n)

Which algorithm is used to traverse a binary tree in an in-order manner? a. Depth-First Search (DFS) b. Breadth-First Search (BFS) c. Preorder Traversal d. Inorder Traversal

Inorder Traversal

Which sorting algorithm has an average-case time complexity of O(n log n)? a. Bubble sort b. Selection sort c. Insertion sort d. Merge sort

Merge sort

Which data structure follows the "First-In-First-Out" (FIFO) principle? a. Stack b. Queue c. Linked List d. Tree

Queue

Which sorting algorithm has the best average-case time complexity? a. Bubble Sort b. Selection Sort c. Insertion Sort d. Quick Sort

Quick Sort

Which algorithm is used to traverse a binary tree in a post-order manner? a. Depth-First Search (DFS) b. Breadth-First Search (BFS) c. Preorder Traversal d. Postorder Traversal

Postorder Traversal

Which algorithm is used to find the minimum spanning tree in a weighted graph? a. Breadth-First Search (BFS) b. Depth-First Search (DFS) c. Dijkstra's Algorithm d. Prim's Algorithm

Prim's Algorithm

Which of the following is NOT a common algorithmic paradigm? a. Greedy algorithm b. Divide and conquer c. Backtracking d. Sequential search

Sequential search

What is the primary data structure used in a depth-first search (DFS) algorithm? a. Stack b. Queue c. Linked list d. Heap

Stack

What does the term "in-place" mean in the context of sorting algorithms? a. The algorithm sorts the elements in ascending order. b. The algorithm rearranges the elements without using additional memory. c. The algorithm modifies the input array directly. d. The algorithm guarantees the best-case time complexity.

The algorithm rearranges the elements without using additional memory.

Which algorithm is used to find the shortest path in an unweighted graph? a. Breadth-first search (BFS) b. Depth-first search (DFS) c. Dijkstra's algorithm d. Bellman-Ford algorithm

Breadth-first search (BFS)

Which sorting algorithm has a worst-case time complexity of O(n^2)? a. Bubble Sort b. Merge Sort c. Quick Sort d. Insertion Sort

Bubble Sort

Which sorting algorithm works by repeatedly finding the maximum element and moving it to the end? a. Bubble Sort b. Quick Sort c. Insertion Sort d. Merge Sort

Bubble Sort

Which data structure is used to implement a priority queue? a. Queue b. Stack c. Heap d. Linked List

Heap

In a binary search tree (BST), what is the property of the right child compared to the parent node? a. It is greater than the parent node. b. It is less than the parent node. c. It is equal to the parent node. d. There is no specific relationship.

It is greater than the parent node.

In a binary search tree (BST), what is the property of the left child compared to the parent node? a. It is greater than the parent node. b. It is less than the parent node. c. It is equal to the parent node. d. There is no specific relationship.

It is less than the parent node.

What is the purpose of analyzing the space complexity of an algorithm? a. To determine the best-case time complexity of the algorithm b. To estimate the actual runtime of the algorithm c. To analyze the memory usage of the algorithm d. To optimize the algorithm's execution speed

To analyze the memory usage of the algorithm

What is the purpose of Big O notation in algorithm analysis? a. To represent the best-case time complexity of an algorithm b. To compare the performance of different algorithms c. To estimate the actual runtime of an algorithm d. To count the number of operations in an algorithm

To compare the performance of different algorithms

What is the purpose of analyzing algorithms? a. To understand their implementation details b. To determine their runtime complexity c. To optimize their memory usage d. To improve their user interface

To determine their runtime complexity

What is the purpose of a sentinel node in a linked list? a. To mark the beginning of the linked list b. To indicate the end of the linked list c. To store a special value in the linked list d. There is no such thing as a sentinel node

To indicate the end of the linked list

What is the purpose of an algorithm's pseudocode? a. To serve as an executable program b. To provide a formal specification of the algorithm c. To generate random test cases for the algorithm d. To analyze the memory usage of the algorithm

To provide a formal specification of the algorithm

Which data structure is based on a hierarchical relationship between elements? a. Stack b. Queue c. Linked List d. Tree

Tree

Which data structure is used to represent a hierarchical relationship between elements with a single parent and multiple children? a. Stack b. Queue c. Linked List d. Tree

Tree


संबंधित स्टडी सेट्स

Biomolecules and Cell Physiology

View Set

Науки, які вивчає біологія

View Set

American History Finals Chapters 5-8

View Set

Lección 6 Estructura 6.3 Preterite tense of regular verbs (regular -ER/-IR verbs)

View Set

Chapter 14: Divorce and Relationship Dissolution

View Set