• ¿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 65 páginas
Examen

Data Structures and Algorithms I (C949): Comprehensive Study Notes

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

This document is a comprehensive set of study notes for a Data Structures and Algorithms I course (C949). It provides a structured overview of fundamental computer science concepts, starting with Python programming basics and progressing through key abstract data types and algorithms. The content covers topics such as Python syntax and style, data types, expressions, control flow, functions, classes, and then delves into core data structures like lists, stacks, queues, hash tables, trees, and heaps. It also includes detailed explanations and Python implementations of essential algorithms, including various sorting and searching methods (linear search, binary search, selection sort, insertion sort, shell sort, quicksort, merge sort), as well as algorithm analysis using Big-O, Omega, and Theta notations. The notes are formatted as a quick-reference guide, making them ideal for exam review and practical programming application.

Vista previa del contenido

Data Structures and Algorithms I – C949
1. Python Code Commenting Style Requirements
Comments
• In-line/Multiline comments: more in-depth explanations → section of lines all
beginning with #
o # This section of code
# Requires a longer comment
# So we can add as many lines as needed
• Multi-line comments.
"""
This is a multi-line comment
that continues on a second line.
And even uses a third line.
D

"""
O


Formatting style
• Classes: capitalized (Member instead of member) & "CamelCase"
N


• Functions: should be lowercase → separated by underscores (calculate_sqrt).
•
O

Objects: (parameters, instance/local variables) lowercase noun (grade)
• Constants: all capital letters and underscores (MAX_SIZE).
T
C


2. Introduction to Python 3
O


The Python interactive interpreter
PY


• Arrow key: Scrolls through lines previously executed with the interpreter.
• Code: The text that represents a computer program.
• Prompt (">>>"): Informs the programmer that the interpreter is ready to accept
commands → displayed by the Phyton interpreter

Programming in Python
• Statement: a program instruction
• Program: series of statements
• Expressions: code that return a value when evaluated
• Variables: named references to values stored by the interpreter.

Basic output
• Print an output → print('hello’+’world') = hello world
• Print and maintain same line → print('Hello', end=' ')
• Good practice
o single quotes for shorter strings
o double quotes for more complicated text or text that contains single quotes

,Basic input
• Reading input → statement: variable_name = input(‘text inside the Text box’)
• convert strings to integers
o my_string = '123'
o my_int = int('123')
• combine input and int → wage = int(input())

Errors
• SyntaxError: The program contains invalid code that can not be understood.
• IndentationError: The lines of the program are not properly indented.
• ValueError: An invalid value is used – can occur if giving letters to int().
• NameError: The program tries to use a variable that does not exist.
• TypeError: An operation uses incorrect types – can occur if adding an int to a string.
• Logic error/bug: the program is logically flawed.

Computer tour
• Operating system: Manages programs and interfaces with peripherals.
D


• Disk: Non-volatile storage with slower access.
O


• RAM: Volatile storage with faster access usually located off processor chip.
• Cache: Relatively small volatile storage with fastest access located on processor chip.
N


• Clock: Rate at which a processor executes instructions.
• Moore’s law: The doubling of IC capacity roughly every 18 months.
O
T


Language history
• Machine language: founded on a two-character alphabet → bit
C


• Machine Instruction: Particular sequence of 0s and 1s rep
•
O


Executable program: sequence of machine instructions together
• Assemblers: translate human readable instructions (assembly language) into an
PY


executable program
• High-level languages: support programming using formulas or algorithms
o FORTRAN (for "Formula Translator")
o ALGOL (for "Algorithmic Language")
• High level instruction: statement
• Compilers: to automatically translate high-level language, into assembly-language
• Scripting languages: to execute programs without the need for compilation
• Script: program whose instructions are executed by another program → an interpreter
→ slower but no need for compilation
• Python: scripting language
o Python 3.0 is not backwards compatible.
o Python 3.x versions are becoming more widely
o Open source

,3. ADTs and Algorithms
Introduction to algorithms
• Algorithm: sequence of steps to solve a problem or calculation
• Computational problem: input + question about the input + output.
• Common algorithm
o Longest common substring: between two inputs strings.
o Binary search: an efficient algorithm for searching a list.
o Dijkstra's shortest path: determines the shortest path from a start vertex to each
vertex in a graph.

Efficient algorithms and hard problems
• Algorithm efficiency: measured by the algorithm runtime
• Efficient algorithm: runtime increases no more than polynomially (nk)
• NP-complete problems: no known efficient algorithm exists

Data structures
D


• Data structure: a way of organizing, storing, and performing operations on data
O


• Selection of data structure: depends on
o type of data being stored
o operations the program may need to perform on that data
N


• the algorithms to implement operations are typically specific to each data structure
O


Basic data structures.
T


• Record: stores subitems, with a name associated to each
•
C


Array: stores an ordered list of items → each item is accessible by a positional index.
• Linked list: stores ordered list of items in nodes → each node stores data and has a
O


pointer to the next node.
•
PY


Binary tree: each node stores data and has up to two children → left and right child.
• Hash table: stores unordered items by mapping (or hashing) each item to a location in
an array.
• Heap:
o Max-heap: node's key is greater than or equal to the node's childrens' keys
o Min-heap: node's key is less than or equal to the node's childrens' keys.
• Graph: representing connections among items
o A vertex represents an item in a graph
o An edge represents a connection between two vertices in a graph.

Abstract data types
• Data type described by predefined user operations, such as "insert data at rear," without
indicating how each operation is implemented
• Programmer need not have knowledge of which data structure is used to use the list
ADT.
• Common ADTs.

, •
D

Common list ADT operations
O
N
O
T
C
O
PY



• Common operations for a queue ADT→ items are inserted at the end of the queue
and removed from the front of the queue.




Applications of ADTs
• ADTs support abstraction (hiding the underlying implementation details) → designers to
focus on higher-level operations → improves programmer efficiency
• Knowledge of an ADT's underlying implementation → to analyze runtime efficiency.
• ADTs in standard libraries

Información del documento

Subido en
10 de agosto de 2026
Número de páginas
65
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$28.49

¿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.
Highgradeshub
4.0
(2)
Vendido
21
Seguidores
0
Artículos
5998
Última venta
2 semanas 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