• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 35 pages
Exam (elaborations)

Software Engineering Algorithms and Data Structures - SEADS-203

Document preview thumbnail
Preview 4 out of 35 pages

Software Engineering Algorithms and Data Structures - SEADS-203

Content preview

1. Which of the following is a stable sorting algorithm?

A. QuickSort

B. MergeSort

C. HeapSort

D. SelectionSort

Answer: b) MergeSort

Rationale: A stable sorting algorithm maintains the relative order of

records with equal keys (values). MergeSort is stable, while QuickSort,

HeapSort, and SelectionSort are not stable by default.



2. What is the time complexity of the binary search algorithm?

A. O(n)

B. O(log n)

C. O(n^2)

D. O(1)

,Answer: b) O(log n)

Rationale: Binary search works by dividing the search space in half at

each step, which results in a logarithmic time complexity, O(log n),

when the input is sorted.



3. Which of the following data structures can be used to implement a

breadth-first search (BFS)?

A. Stack

B. Queue

C. Array

D. Linked List

Answer: b) Queue

Rationale: BFS explores nodes level by level, which is naturally

implemented using a queue. Nodes are processed in the order they are

discovered, which is a FIFO (First In First Out) structure, like a queue.



4. What is the worst-case time complexity of QuickSort?

,A. O(n)

B. O(n log n)

C. O(n^2)

D. O(log n)

Answer: c) O(n^2)

Rationale: QuickSort's worst-case time complexity is O(n^2) when the

pivot chosen is the smallest or largest element in the array, leading to

unbalanced partitions. However, its average case is O(n log n).



5. What is the primary disadvantage of using a linked list over an

array?

A. Random access is not possible

B. Linked lists require less memory

C. Insertion and deletion are slower

D. Arrays are more flexible

Answer: a) Random access is not possible

, Rationale: In a linked list, accessing an element requires traversing the

list from the beginning, so random access (directly accessing an index)

is not possible like it is in arrays.



6. In which of the following cases would you use a hash table?

A. When you need fast access to elements by key

B. When you need to maintain elements in sorted order

C. When you need to perform frequent deletions and insertions

D. When you need to implement recursion

Answer: a) When you need fast access to elements by key

Rationale: Hash tables provide average constant time complexity (O(1))

for access, insertion, and deletion operations by using a key to directly

access an element, making it ideal for fast lookups.



7. Which of the following algorithms is used to find the shortest path in

a graph with non-negative weights?

A. Bellman-Ford

Document information

Uploaded on
March 13, 2025
Number of pages
35
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$10.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
douglasmugwe82
5.0
(1)
Sold
2
Followers
0
Items
4215
Last sold
1 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions