• ¿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 4 fuera de 107 páginas
Examen

Cs311 Midterm Data Structures & Algorithms | Comprehensive Exam Prep, Practice Questions And Correct Answers

Document preview thumbnail
Vista previa 4 fuera de 107 páginas

Prepare for the CS311 midterm with comprehensive practice questions and correct answers covering essential Data Structures and Algorithms concepts. Review topics such as arrays, linked lists, stacks, queues, trees, graphs, hashing, recursion, searching, sorting, algorithm analysis, time and space complexity, Big-O notation, and fundamental problem-solving techniques. This exam-focused resource provides targeted practice to reinforce programming and algorithmic concepts, strengthen problem-solving skills, identify areas requiring additional review, and build confidence for the CS311 midterm examination.

Vista previa del contenido

CS 311 MIDTERM
DATA STRUCTURES & ALGORITHMS
COMPREHENSIVE PREP


Exam-Style Practice Questions
Correct Answers · Rationales · Explanations


COMPLEXITY · ITERATORS · OPERATORS · OWNERSHIP

MASTER THEOREM · TRADE-OFFS · LOWER BOUNDS


Arrays · Lists · Sorting · Searching · C++ Essentials


QUICK · CLEAR · PROFESSIONAL

,CS 311 MIDTERM | DATA STRUCTURES & ALGORITHMS Comprehensive Prep



PRACTICE SET 1
1. Printing the last item in an array whose size is known is Θ of what?
A. Θ(n)
B. Θ(1)
C. Θ(log n)
D. Θ(n log n)
Correct Answer: B
Rationale:
Random-access: index n−1 in constant time.
Size known ⇒ no traversal needed.

2. Printing the last item in a singly linked list whose size is known is typically:
A. Θ(1) always with only a head pointer
B. Θ(n) if only a head pointer is available (must walk the list)
C. Θ(log n)
D. Θ(n²)
Correct Answer: B
Rationale:
Singly linked lists do not support random access.
Even knowing size, you still traverse from the head unless a tail pointer exists.

3. Finding an item with a given value in a sorted array (binary search) is:
A. Θ(n)
B. Θ(log n)
C. Θ(1)
D. Θ(n log n)
Correct Answer: B
Rationale:
Each step halves the search space.
Comparison model, sorted random-access array.

4. Sorting a linked list with a comparison-based method is generally:
A. Θ(1)
B. Θ(n log n) with a good algorithm (e.g., merge sort adapted to lists)
C. Θ(log n)
D. Impossible
Correct Answer: B
Rationale:
Merge sort works well on linked lists (no random access needed for merging).
Comparison lower bound Ω(n log n) still applies.




Page 2

,CS 311 MIDTERM | DATA STRUCTURES & ALGORITHMS Comprehensive Prep



PRACTICE SET 2
5. Sorting an array with Insertion Sort is:
A. Θ(1)
B. Θ(n²) in the worst and average cases
C. Θ(n log n) always
D. Θ(log n)
Correct Answer: B
Rationale:
Nested loops; ~n²/4 comparisons on average.
Best case Θ(n) when already sorted.

6. Θ notation describes:
A. Only upper bounds
B. Tight asymptotic bounds (both O and Ω)
C. Only lower bounds
D. Exact operation counts for all n
Correct Answer: B
Rationale:
f is Θ(g) if f is both O(g) and Ω(g).
Commonly used for “the” order of an algorithm.

7. Binary search requires which property of the input?
A. Unsorted linked list
B. Sorted random-access sequence
C. Only a hash table
D. Unsorted array with no order
Correct Answer: B
Rationale:
Halving depends on order and indexable midpoints.
Linked lists make mid-finding expensive.

8. The comparison-based sorting lower bound is:
A. Ω(n)
B. Ω(n log n)
C. Ω(log n)
D. Ω(n²)
Correct Answer: B
Rationale:
Decision-tree argument: n! leaves need height ≥ log■(n!).
Stirling ⇒ ~n log n.




Page 3

, CS 311 MIDTERM | DATA STRUCTURES & ALGORITHMS Comprehensive Prep



PRACTICE SET 3
9. Vector src = {0,10,20,30,40,50,60,70}. std::copy(begin(src)+2, begin(src)+5, begin(dest)) copies:
A. 0, 10, 20
B. 20, 30, 40
C. 30, 40, 50
D. 50, 60, 70
Correct Answer: B
Rationale:
Half-open range [first, last): indices 2,3,4.
Values 20, 30, 40.

10. C++ iterators to the end of a range are:
A. Inclusive of the last element in the half-open convention
B. One past the last element (half-open [begin, end))
C. Always null
D. Random only
Correct Answer: B
Rationale:
Standard library algorithms use half-open ranges.
end is not dereferenced.

11. Random-access iterators support:
A. Only ++ and *
B. +, -, indexing, and constant-time jumps
C. Only bidirectional movement
D. No comparison
Correct Answer: B
Rationale:
vector and deque iterators are random-access.
list iterators are only bidirectional.

12. std::copy requires the destination to have:
A. No capacity concerns ever
B. Sufficient space or use of inserters for growing containers
C. Only empty state
D. Reverse iterators always
Correct Answer: B
Rationale:
copy does not resize automatically.
back_inserter can grow a vector.




Page 4

Información del documento

Subido en
29 de septiembre de 2026
Número de páginas
107
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$15.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

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
DrExamVault
4.6
(14)
Vendido
73
Seguidores
1
Artículos
4161
Última venta
16 horas hace



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