• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 2 páginas
Examen

Algorithm Analysis and Big-O Notation – Data Structures and Algorithms: Exam-Ready Questions and Answers

Document preview thumbnail
Vista previa 1 fuera de 2 páginas

Algorithm Analysis and Big-O Notation – Data Structures and Algorithms: Exam-Ready Questions and Answers

Vista previa del contenido

Algorithm Analysis and Big-O Notation – Data
Structures and Algorithms: Exam-Ready
Questions and Answers
LATEST UPDATE 2026/2027 | PREMIUM ACADEMIC EDITION

Exam 07 of 40 | Unit code: DSA-07 | Questions: 6 | Total marks: 30 | Answer ALL questions


Question 1: [5 marks]
Define Big-O, Big-Omega and Big-Theta notation.

Answer:

• f(n) = O(g(n)) if there are constants c > 0 and n0 such that f(n) ≤ c·g(n) for all n ≥ n0 (an upper
bound).
• f(n) = Ω(g(n)) if f(n) ≥ c·g(n) for all n ≥ n0 (a lower bound).
• f(n) = Θ(g(n)) if f(n) is both O(g(n)) and Ω(g(n)) (a tight bound).


Question 2: [5 marks]
Determine the time complexity of: for i in 1..n: for j in 1..i: print(i, j)

Answer:

The inner loop runs i times for each i, so the total is 1 + 2 + … + n = n(n + 1)/2, which is O(n2).


Question 3: [4 marks]
2 n
Arrange in increasing order of growth: n!, n , log n, 2 , n log n, n, 1.

Answer:

1 < log n < n < n log n < n2 < 2n < n!


Question 4: [5 marks]
What is the complexity of: i = 1; while i < n: i = i * 2 ?

Answer:

The value of i doubles each time (1, 2, 4, 8, …), so the loop ends after about log2 n iterations.
Complexity: O(log n).


Question 5: [5 marks]
Using linear search as an example, explain best-case, worst-case and average-case analysis.

Answer:

• Best case: the target is the first element, 1 comparison, O(1).
• Worst case: the target is last or absent, n comparisons, O(n).
• Average case: if the target is equally likely at any position, about (n + 1)/2 comparisons, which
is O(n).




Page 1 Data Structures and Algorithms • Exam 07

Información del documento

Subido en
9 de noviembre de 2026
Número de páginas
2
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$13.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Vendido
0
Seguidores
0
Artículos
413
Última venta
-



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes