• ¿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 4 páginas
Resumen

Computer Science 144 4.1 summary

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

Detailed summary of Chapter 4.1 - performance in Python for CS144 at Stellenbosch University. All you need to study from Chapter 4.1 for the A1.

Vista previa del contenido

Chapter 4.1 PERFORMANCE:
Mantra for this chapter: Pay attention to the cost
We apply mathematical analysis to derive concise models of the cost - the experiments we
design must be reproducible and falsifiable
How are the experiments done? We can simply run a program on various inputs, measuring
the amount of time to process each input.
Observations:
1. is a problem size that characterizes the difficulty of the computational task.
Normally, the problem size is either the size of the input or the value of a command-
line argument. Intuitively, the running time should increase with the problem size –
interested in how much it increases by.
2. Running time is relatively insensitive to the input itself; it depends primarily on the
problem size
Proper analysis involves:
- Detailed understanding of the program
- Detailed understanding of the system and the computer
- Advanced tools of mathematical analysis
Doubling hypothesis -> What is the effect on the running time of doubling the size of the
input?
Mathematical analysis:
the total running time is determined by two primary factors:
- The cost of executing each statement (property of the system)
- The frequency of execution of each statement (property of the algorithm)
We write ~f(n) to represent any quantity that, when divided by f(n), approaches 1 as n
grows. We also write g(n) ~ f(n) to indicate that g(n)/f(n) approaches 1 as n grows.
We focus on the instructions that are executed most frequently = inner loop
For many programs: the running time satisfies the relationship T(n) ~ cf(n) where c is a
constant and f(n) is a function known as the order of growth of the running time = simple
but powerful model of running time. With these approximations, the particular machine
that you are using does not play a significant role in the models—the analysis separates the
algorithm from the system (algorithm determines the order of growth)

Libro relacionado
 image
Robert Sedgewick, Kevin Wayne, Robert Dondero Introduction to Programming in Python
Editorial: 2015 ISBN: 9780134076430 Edición: Desconocido

Información del documento

¿Un libro?
No
¿Qué capítulos están resumidos?
Chapter 4.1 - performance
Subido en
27 de septiembre de 2023
Número de páginas
4
Escrito en
2023/2024
Tipo
Resumen
$4.36

¿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
6
Seguidores
2
Artículos
14
Última venta
3 meses 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