KEMBAR78
Data Structure by Mahad | PDF | Time Complexity | Queue (Abstract Data Type)
0% found this document useful (0 votes)
18 views22 pages

Data Structure by Mahad

Data Structures by mahad

Uploaded by

mahadakram967
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views22 pages

Data Structure by Mahad

Data Structures by mahad

Uploaded by

mahadakram967
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Sure, here's a basic outline of data structures:

I. Introduction to Data Structures


A. What are Data Structures?
B. Importance of Data Structures
C. Characteristics of Good Data Structures

II. Types of Data Structures


A. Linear Data Structures
1. Arrays
2. Linked Lists
3. Stacks
4. Queues

B. Non-linear Data Structures


1. Trees
a. Binary Trees
b. AVL Trees
c. B-trees
2. Graphs
a. Directed Graphs
b. Undirected Graphs

C. Hash-based Data Structures


1. Hash Tables
2. Hash Maps
3. Hash Sets

III. Operations and Algorithms


A. Traversal Algorithms
B. Searching Algorithms
C. Sorting Algorithms
D. Insertion, Deletion, and Update Operations

IV. Applications and Use Cases


A. Real-world Applications of Data Structures
B. Choosing the Right Data Structure for a Problem

V. Advanced Data Structures


A. Heaps
B. Tries
C. Segment Trees
D. Red-Black Trees
VI. Space and Time Complexity Analysis
A. Big O Notation
B. Analysis of Algorithms on Different Data Structures

VII. Conclusion

This outline covers a broad range of topics related to data structures, including their types,
operations, algorithms, applications, and complexity analysis.
Certainly! Here are 10 multiple-choice questions related to the "Introduction to Data Structures":

1. What are data structures?


a) Ways to store and organize data
b) Methods used to secure data
c) Techniques for encrypting data
d) Algorithms for processing data
**Answer: a) Ways to store and organize data**

2. Why are data structures important in computer science?


a) They ensure data encryption
b) They enable efficient data storage and retrieval
c) They primarily focus on data analysis
d) They only work for specific data types
**Answer: b) They enable efficient data storage and retrieval**

3. What is a characteristic of good data structures?


a) High complexity
b) Low memory usage
c) Slow retrieval time
d) Minimal scalability
**Answer: b) Low memory usage**

4. Which of the following is a linear data structure?


a) Trees
b) Graphs
c) Stacks
d) Hash Tables
**Answer: c) Stacks**

5. What type of data structure is best suited for implementing LIFO (Last In, First Out) behavior?
a) Queue
b) Linked List
c) Stack
d) Array
**Answer: c) Stack**
6. Among the listed data structures, which one uses pointers for connections between
elements?
a) Arrays
b) Stacks
c) Linked Lists
d) Hash Tables
**Answer: c) Linked Lists**

7. Which non-linear data structure is mainly used for representing hierarchical relationships?
a) Trees
b) Graphs
c) Stacks
d) Queues
**Answer: a) Trees**

8. What is the time complexity of searching in a balanced binary search tree (BST)?
a) O(1)
b) O(log n)
c) O(n)
d) O(n^2)
**Answer: b) O(log n)**

9. Hash-based data structures use which technique to achieve faster access to elements?
a) Indexing
b) Pointers
c) Sorting
d) Hashing
**Answer: d) Hashing**

10. Which section of the outline primarily deals with analyzing the efficiency of algorithms on
different data structures?
a) Types of Data Structures
b) Operations and Algorithms
c) Space and Time Complexity Analysis
d) Advanced Data Structures
**Answer: c) Space and Time Complexity Analysis**
Sure, here are multiple-choice questions related to "Types of Data Structures":

1. Which of the following is a linear data structure?


a) Trees
b) Graphs
c) Stacks
d) Hash Tables
**Answer: c) Stacks**

2. Which linear data structure allows access to elements based on their position and supports
random access?
a) Arrays
b) Linked Lists
c) Queues
d) Trees
**Answer: a) Arrays**

3. Which non-linear data structure is a collection of nodes where each node has a value and
references to its children nodes?
a) Stacks
b) Linked Lists
c) Trees
d) Hash Tables
**Answer: c) Trees**

4. Which linear data structure follows the FIFO (First In, First Out) principle?
a) Arrays
b) Linked Lists
c) Stacks
d) Queues
**Answer: d) Queues**

5. What type of data structure is characterized by nodes linked together in a sequence?


a) Arrays
b) Linked Lists
c) Stacks
d) Hash Tables
**Answer: b) Linked Lists**

6. Among the listed non-linear data structures, which one represents relationships between
entities?
a) Trees
b) Stacks
c) Queues
d) Arrays
**Answer: a) Trees**

7. Which data structure efficiently supports insertion and deletion operations at both ends?
a) Linked Lists
b) Queues
c) Arrays
d) Stacks
**Answer: a) Linked Lists**

8. Which non-linear data structure is a set of vertices connected by edges?


a) Stacks
b) Linked Lists
c) Trees
d) Graphs
**Answer: d) Graphs**

9. Which linear data structure can be easily implemented using arrays or linked structures?
a) Trees
b) Graphs
c) Stacks
d) Queues
**Answer: c) Stacks**

10. Which category of data structure is known for its fast retrieval using key-value pairs?
a) Trees
b) Graphs
c) Hash-based structures
d) Arrays
**Answer: c) Hash-based structures**
Absolutely! Here are additional multiple-choice questions related to "Types of Data Structures":

1. Which data structure represents a collection of elements where each element has a unique
address or index?
a) Trees
b) Arrays
c) Linked Lists
d) Stacks
**Answer: b) Arrays**

2. What is the main advantage of a linked list over an array?


a) Constant time access to elements
b) Efficient random access to elements
c) Dynamic size and ease of insertion/deletion at any position
d) Compact memory representation
**Answer: c) Dynamic size and ease of insertion/deletion at any position**

3. Which data structure is suitable for implementing a priority queue?


a) Arrays
b) Linked Lists
c) Stacks
d) Heaps
**Answer: d) Heaps**

4. Which among the following is NOT a tree traversal algorithm?


a) Breadth-First Search (BFS)
b) Depth-First Search (DFS)
c) Preorder traversal
d) Heapify
**Answer: d) Heapify**

5. Which data structure follows the LIFO principle?


a) Queue
b) Linked List
c) Stack
d) Graph
**Answer: c) Stack**

6. Which tree-based data structure guarantees a balance factor ensuring logarithmic time
complexity for insertion, deletion, and search operations?
a) AVL Trees
b) Binary Trees
c) Red-Black Trees
d) B-trees
**Answer: a) AVL Trees**

7. Which data structure is suitable for implementing undo functionalities in software


applications?
a) Queue
b) Linked List
c) Stack
d) Hash Table
**Answer: c) Stack**

8. What is the primary difference between a singly linked list and a doubly linked list?
a) Singly linked lists support bidirectional traversal
b) Doubly linked lists allow traversal in only one direction
c) Singly linked lists store elements in reverse order
d) Doubly linked lists have pointers to both the next and previous nodes
**Answer: d) Doubly linked lists have pointers to both the next and previous nodes**

9. Which non-linear data structure is used to represent hierarchical data with a top-down
recursive structure?
a) Graph
b) Queue
c) Tree
d) Array
**Answer: c) Tree**

10. In which data structure do elements have a relationship defined by an adjacency matrix or
adjacency list?
a) Trees
b) Graphs
c) Stacks
d) Queues
**Answer: b) Graphs**
Certainly! Here are some additional multiple-choice questions related to "Types of Data
Structures":

1. Which linear data structure allows elements to be added or removed from both ends?
a) Stack
b) Queue
c) Linked List
d) Array
**Answer: c) Linked List**

2. Which non-linear data structure is used for representing hierarchical structures with a single
root node?
a) Tree
b) Graph
c) Stack
d) Queue
**Answer: a) Tree**

3. What data structure is often used to implement breadth-first search (BFS) and depth-first
search (DFS) algorithms?
a) Queue
b) Stack
c) Tree
d) Linked List
**Answer: a) Queue**

4. Which linear data structure operates on the principle of "First In, First Out"?
a) Stack
b) Queue
c) Array
d) Linked List
**Answer: b) Queue**
5. Which non-linear data structure contains a set of nodes where each node points to its
children, forming a tree-like structure?
a) Stack
b) Graph
c) Array
d) Tree
**Answer: d) Tree**

6. Which data structure is used for implementing a call stack in programming languages?
a) Array
b) Linked List
c) Stack
d) Queue
**Answer: c) Stack**

7. What is the key characteristic of a hash-based data structure that enables fast data retrieval?
a) Pointers between elements
b) Use of indices
c) Hashing function
d) Sorting algorithm
**Answer: c) Hashing function**

8. Which non-linear data structure is best suited for representing real-world networks like social
networks or transportation systems?
a) Graph
b) Tree
c) Stack
d) Queue
**Answer: a) Graph**

9. Which linear data structure uses dynamic memory allocation to overcome the limitation of a
fixed-size structure like arrays?
a) Array
b) Stack
c) Linked List
d) Queue
**Answer: c) Linked List**

10. Which data structure uses a Last In, First Out (LIFO) mechanism for element insertion and
removal?
a) Queue
b) Linked List
c) Stack
d) Array
**Answer: c) Stack**
Absolutely! Here are additional multiple-choice questions related to "Types of Data Structures":

1. Which data structure allows elements to be accessed randomly with constant time
complexity?
a) Queue
b) Linked List
c) Stack
d) Array
**Answer: d) Array**

2. Which non-linear data structure represents relationships between entities having no inherent
hierarchical structure?
a) Tree
b) Graph
c) Stack
d) Queue
**Answer: b) Graph**

3. Which linear data structure exhibits a variable size and allocates memory as needed?
a) Array
b) Linked List
c) Queue
d) Stack
**Answer: b) Linked List**

4. In which data structure are elements logically connected in a linear sequence?


a) Stack
b) Queue
c) Linked List
d) Graph
**Answer: c) Linked List**

5. Which non-linear data structure is best suited for representing family trees or hierarchical
data?
a) Graph
b) Stack
c) Tree
d) Queue
**Answer: c) Tree**

6. What is the primary advantage of using a linked list over an array for insertion and deletion
operations?
a) Faster access time
b) Contiguous memory allocation
c) Constant time complexity for insertions
d) Dynamic size and easy insertion/deletion at any position
**Answer: d) Dynamic size and easy insertion/deletion at any position**

7. Among the following, which linear data structure allows elements to be added or removed
from only one end?
a) Queue
b) Linked List
c) Stack
d) Array
**Answer: c) Stack**

8. Which non-linear data structure allows multiple entry points and doesn't necessarily have a
root node?
a) Tree
b) Graph
c) Stack
d) Queue
**Answer: b) Graph**

9. In a queue, which operation adds an element to the rear end?


a) Pop
b) Enqueue
c) Push
d) Insert
**Answer: b) Enqueue**

10. Which linear data structure uses a "First In, Last Out" approach for element access?
a) Array
b) Linked List
c) Queue
d) Stack
**Answer: d) Stack**
Certainly! Here are multiple-choice questions related to "Operations and Algorithms" in data
structures:

1. Which algorithmic technique is used for visiting all the nodes in a tree or graph data
structure?
a) Traversal
b) Searching
c) Sorting
d) Insertion
**Answer: a) Traversal**
2. Which algorithm is used to arrange elements in a specific order based on a given key?
a) Search
b) Sort
c) Traverse
d) Insert
**Answer: b) Sort**

3. Which operation is commonly performed on data structures to find a particular element


efficiently?
a) Insertion
b) Deletion
c) Search
d) Traversal
**Answer: c) Search**

4. Which algorithmic technique is used to explore all possibilities to find the optimal solution?
a) Sorting
b) Greedy algorithms
c) Dynamic programming
d) Backtracking
**Answer: d) Backtracking**

5. Which operation in a stack data structure removes the top element?


a) Pop
b) Push
c) Peek
d) Enqueue
**Answer: a) Pop**

6. Which searching algorithm divides the input into smaller parts to locate a specific element
efficiently?
a) Binary Search
b) Linear Search
c) Depth-First Search (DFS)
d) Breadth-First Search (BFS)
**Answer: a) Binary Search**

7. Which operation is commonly associated with evaluating and processing elements


sequentially in a data structure?
a) Deletion
b) Insertion
c) Traversal
d) Sorting
**Answer: c) Traversal**

8. Which algorithmic technique aims to arrange elements in non-decreasing or non-increasing


order?
a) Search
b) Sort
c) Traverse
d) Insert
**Answer: b) Sort**

9. What operation in a queue data structure adds an element to the rear end?
a) Enqueue
b) Dequeue
c) Pop
d) Push
**Answer: a) Enqueue**

10. Which algorithmic technique involves finding the shortest path in a graph from a source
node to all other nodes?
a) Dijkstra's algorithm
b) Depth-First Search (DFS)
c) Breadth-First Search (BFS)
d) Bellman-Ford algorithm
**Answer: a) Dijkstra's algorithm**
Absolutely! Here are multiple-choice questions related to "Applications and Use Cases" of data
structures:

1. Which data structure is most suitable for implementing a browser history feature?
a) Linked List
b) Array
c) Queue
d) Stack
**Answer: a) Linked List**

2. Which data structure is commonly used for implementing a cache?


a) Linked List
b) Tree
c) Stack
d) Hash Map
**Answer: d) Hash Map**

3. Which data structure is often used for implementing the undo functionality in text editors?
a) Queue
b) Stack
c) Tree
d) Linked List
**Answer: b) Stack**

4. In a scenario where data needs to be processed in the order it was received, which data
structure is most suitable?
a) Stack
b) Queue
c) Linked List
d) Hash Table
**Answer: b) Queue**

5. Which data structure is commonly employed to represent the symbol table in compilers?
a) Array
b) Hash Map
c) Stack
d) Linked List
**Answer: b) Hash Map**

6. Which data structure is best suited for efficiently checking for the existence of a specific
element?
a) Queue
b) Tree
c) Hash Set
d) Linked List
**Answer: c) Hash Set**

7. Which data structure is utilized for efficiently managing the network of roads in a GPS
application?
a) Tree
b) Stack
c) Graph
d) Queue
**Answer: c) Graph**

8. In a scenario where the 'Last Recently Used' page needs to be replaced when the cache is
full, which data structure is suitable?
a) Queue
b) Stack
c) Linked List
d) Tree
**Answer: a) Queue**
9. Which data structure is typically used for implementing algorithms like Kruskal's or Prim's for
finding minimum spanning trees?
a) Queue
b) Linked List
c) Tree
d) Graph
**Answer: d) Graph**

10. In a scenario where elements need to be stored in a sorted order for easy retrieval, which
data structure is commonly used?
a) Stack
b) Hash Map
c) Binary Search Tree
d) Queue
**Answer: c) Binary Search Tree**
Certainly! Here are multiple-choice questions related to "Advanced Data Structures":

1. Which data structure is commonly used to efficiently implement priority queues?


a) Heap
b) AVL Tree
c) Red-Black Tree
d) Trie
**Answer: a) Heap**

2. Which advanced data structure is primarily used for efficient searching of strings and words?
a) AVL Tree
b) Trie
c) Segment Tree
d) B-tree
**Answer: b) Trie**

3. Which data structure is best suited for range query operations like finding the sum of
elements within a given range?
a) AVL Tree
b) Trie
c) Segment Tree
d) B-tree
**Answer: c) Segment Tree**

4. In which data structure are elements stored in a balanced binary search tree with a balance
factor to maintain logarithmic height?
a) AVL Tree
b) Trie
c) B-tree
d) Red-Black Tree
**Answer: a) AVL Tree**

5. Which data structure is commonly used in databases and file systems due to its balanced
structure and ability to handle large amounts of data?
a) Trie
b) Red-Black Tree
c) AVL Tree
d) B-tree
**Answer: d) B-tree**

6. Which advanced data structure is primarily used for efficient prefix matching and
autocomplete features?
a) Segment Tree
b) B-tree
c) Trie
d) AVL Tree
**Answer: c) Trie**

7. Which data structure guarantees logarithmic time complexity for insertion, deletion, and
search operations in a self-balancing manner?
a) Red-Black Tree
b) Segment Tree
c) AVL Tree
d) B-tree
**Answer: a) Red-Black Tree**

8. Which advanced data structure is suitable for handling intervals and overlapping ranges
efficiently?
a) Trie
b) B-tree
c) Segment Tree
d) AVL Tree
**Answer: c) Segment Tree**

9. In which data structure are elements stored in a way that ensures logarithmic time complexity
for operations like insertion and deletion, making it suitable for database indexing?
a) AVL Tree
b) Trie
c) B-tree
d) Red-Black Tree
**Answer: c) B-tree**
10. Which advanced data structure is commonly used in network routing tables and dictionary
implementations due to its fast search capabilities?
a) Trie
b) Red-Black Tree
c) AVL Tree
d) Segment Tree
**Answer: a) Trie**
Certainly! Here are multiple-choice questions related to "Space and Time Complexity Analysis":

1. Which notation is commonly used to describe the upper bound on the running time of an
algorithm?
a) Omega (Ω)
b) Big Theta (Θ)
c) Big O (O)
d) Little O (o)
**Answer: c) Big O (O)**

2. What does O(1) time complexity indicate in the context of algorithms?


a) Linear time
b) Constant time
c) Logarithmic time
d) Exponential time
**Answer: b) Constant time**

3. Which time complexity signifies an algorithm that doubles the time taken for each additional
input element?
a) O(n)
b) O(log n)
c) O(n^2)
d) O(2^n)
**Answer: d) O(2^n)**

4. What does O(n log n) time complexity imply in terms of algorithmic efficiency?
a) Quadratic time
b) Linear time
c) Log-linear time
d) Exponential time
**Answer: c) Log-linear time**

5. Which notation represents the best-case time complexity of an algorithm?


a) Big O (O)
b) Big Omega (Ω)
c) Big Theta (Θ)
d) Little O (o)
**Answer: b) Big Omega (Ω)**

6. In terms of space complexity, what does O(1) signify for an algorithm?


a) Linear space usage
b) Logarithmic space usage
c) Constant space usage
d) Exponential space usage
**Answer: c) Constant space usage**

7. Which space complexity denotes an algorithm that uses additional space proportional to the
input size?
a) O(1)
b) O(n)
c) O(log n)
d) O(n^2)
**Answer: b) O(n)**

8. In time complexity analysis, what does O(n^2) indicate?


a) Quadratic time
b) Logarithmic time
c) Linear time
d) Exponential time
**Answer: a) Quadratic time**

9. Which notation describes both the upper and lower bounds of an algorithm's time complexity?
a) Big O (O)
b) Big Omega (Ω)
c) Big Theta (Θ)
d) Little O (o)
**Answer: c) Big Theta (Θ)**

10. Which time complexity notation characterizes an algorithm whose performance deteriorates
exponentially with the input size?
a) O(1)
b) O(n)
c) O(log n)
d) O(2^n)
**Answer: d) O(2^n)**
Certainly! Here are multiple-choice questions related to "Conclusion" in the context of data
structures:

1. What does the term "space complexity" refer to in data structures and algorithms?
a) The time required to execute an algorithm
b) The amount of physical memory required by an algorithm
c) The efficiency of search operations in a data structure
d) The complexity of nested loops in an algorithm
**Answer: b) The amount of physical memory required by an algorithm**

2. Why is it essential to analyze the space and time complexity of algorithms and data
structures?
a) To determine the number of elements in a data structure
b) To estimate the physical size of the data structure
c) To assess how efficiently algorithms utilize resources as input sizes increase
d) To optimize data structure design for graphical representation
**Answer: c) To assess how efficiently algorithms utilize resources as input sizes increase**

3. What is the significance of Big O notation in analyzing algorithms?


a) It describes the best-case scenario of an algorithm's performance
b) It provides a precise measurement of an algorithm's execution time
c) It indicates the upper bound on the algorithm's growth rate in terms of time or space
d) It represents the worst-case scenario of an algorithm's performance
**Answer: c) It indicates the upper bound on the algorithm's growth rate in terms of time or
space**

4. What role does complexity analysis play in selecting the appropriate data structure for a
specific problem?
a) It defines the physical size of the data structure
b) It measures the speed at which data is stored in the structure
c) It helps in understanding how the data structure performs as the dataset grows
d) It focuses on the implementation details of the data structure
**Answer: c) It helps in understanding how the data structure performs as the dataset grows**

5. How does an understanding of space and time complexity aid in algorithm design?
a) By prioritizing aesthetics in code structure
b) By facilitating efficient code execution and resource utilization
c) By emphasizing the use of complex mathematical formulas
d) By minimizing the number of loops in an algorithm
**Answer: b) By facilitating efficient code execution and resource utilization**

6. What aspect of data structures and algorithms does space complexity primarily evaluate?
a) The accuracy of search operations
b) The amount of physical memory consumed
c) The speed of data retrieval
d) The complexity of conditional statements
**Answer: b) The amount of physical memory consumed**

7. In conclusion, what overarching benefit do data structures and algorithms offer in software
development?
a) Simplifying programming languages
b) Accelerating data transmission
c) Enhancing code readability
d) Improving computational efficiency and problem-solving capabilities
**Answer: d) Improving computational efficiency and problem-solving capabilities**
Absolutely! Here are some important multiple-choice questions covering various aspects of data
structures and algorithms:

1. Which data structure allows efficient insertion and deletion at both ends?
a) Queue
b) Stack
c) Linked List
d) Array
**Answer: c) Linked List**

2. Which algorithm is used to find the shortest path in a weighted graph?


a) Depth-First Search (DFS)
b) Breadth-First Search (BFS)
c) Dijkstra's algorithm
d) Prim's algorithm
**Answer: c) Dijkstra's algorithm**

3. Which sorting algorithm has an average time complexity of O(n log n) and sorts by dividing
the array into smaller segments?
a) Quick Sort
b) Bubble Sort
c) Insertion Sort
d) Merge Sort
**Answer: d) Merge Sort**

4. Which data structure uses Last In, First Out (LIFO) ordering?
a) Queue
b) Linked List
c) Stack
d) Tree
**Answer: c) Stack**

5. Which data structure is primarily designed for efficient searching, insertion, and deletion
operations in a collection of unique elements?
a) Stack
b) Queue
c) Heap
d) Hash Table
**Answer: d) Hash Table**
6. Which search algorithm works on a sorted array by repeatedly dividing the search interval in
half?
a) Binary Search
b) Linear Search
c) Depth-First Search (DFS)
d) Breadth-First Search (BFS)
**Answer: a) Binary Search**

7. Which data structure is suitable for implementing undo functionality in text editors?
a) Queue
b) Stack
c) Linked List
d) Hash Map
**Answer: b) Stack**

8. Which algorithm efficiently solves the 'Traveling Salesman Problem' by exploring all possible
permutations?
a) Kruskal's algorithm
b) Prim's algorithm
c) Dijkstra's algorithm
d) Brute Force algorithm
**Answer: d) Brute Force algorithm**

9. Which data structure ensures that the first element inserted is the first to be removed?
a) Stack
b) Queue
c) Linked List
d) Heap
**Answer: b) Queue**

10. Which algorithm is used to rearrange elements in an array by comparing adjacent elements
and swapping them if they are in the wrong order?
a) Bubble Sort
b) Quick Sort
c) Merge Sort
d) Insertion Sort
**Answer: a) Bubble Sort**
Certainly! Here are more multiple-choice questions covering various concepts related to data
structures and algorithms:

1. Which sorting algorithm has the best-case time complexity of O(n) and worst-case time
complexity of O(n^2)?
a) Quick Sort
b) Bubble Sort
c) Insertion Sort
d) Selection Sort
**Answer: c) Insertion Sort**

2. Which algorithm is used to traverse a binary tree in a sorted manner?


a) Breadth-First Search (BFS)
b) Depth-First Search (DFS)
c) Inorder traversal
d) Preorder traversal
**Answer: c) Inorder traversal**

3. Which data structure is used to efficiently implement a priority queue?


a) Stack
b) Queue
c) Heap
d) Linked List
**Answer: c) Heap**

4. Which algorithm is used to find the minimum spanning tree in a connected, undirected graph
with weighted edges?
a) Prim's algorithm
b) Dijkstra's algorithm
c) Kruskal's algorithm
d) Bellman-Ford algorithm
**Answer: a) Prim's algorithm**

5. Which data structure is suitable for evaluating arithmetic expressions by converting them from
infix to postfix notation?
a) Queue
b) Stack
c) Linked List
d) Heap
**Answer: b) Stack**

6. Which algorithm is used to find the longest common subsequence between two sequences?
a) Bellman-Ford algorithm
b) Floyd-Warshall algorithm
c) Longest Common Subsequence (LCS) algorithm
d) Kruskal's algorithm
**Answer: c) Longest Common Subsequence (LCS) algorithm**

7. Which data structure is employed in implementing a breadth-first search algorithm?


a) Stack
b) Queue
c) Linked List
d) Tree
**Answer: b) Queue**

8. Which algorithm is used to find the shortest path in a weighted graph with negative edge
weights?
a) Dijkstra's algorithm
b) Floyd-Warshall algorithm
c) Prim's algorithm
d) Kruskal's algorithm
**Answer: b) Floyd-Warshall algorithm**

9. Which data structure is commonly used to efficiently retrieve the maximum or minimum
element?
a) Heap
b) Linked List
c) Queue
d) Hash Table
**Answer: a) Heap**

10. Which algorithm uses dynamic programming to solve problems by breaking them down into
smaller overlapping subproblems?
a) Bellman-Ford algorithm
b) Dijkstra's algorithm
c) Floyd-Warshall algorithm
d) Knapsack algorithm
**Answer: d) Knapsack algorithm**

You might also like