¡GoConqr estrena diseño! Cuéntanos qué te parece.

Fichas

Week 4: Sorting & Understanding Python

Melina Mackey Computer Science Inglés 10 fichas

Week 4: Sorting & Understanding Python

Fichas del conjunto (10)

  1. 1Sorting problemSorting problem
  2. 2Selection sortSelection sort
  3. 3Insertion sortInsertion sort
  4. 4Selection vs insertion sortSelection sort skips the last item, as it is already sorted
    Insertion sort skips the first item, as it is already sorted
  5. 5Python objects and variables- Objects have a type, identity and type-specific content
    - Variables are named references to objects
    - Assignment operation creates a variable if necessary (if the value exists, it points to it)
    - Objects disappear (are deleted) when no longer referenced
    - Variables exist until explicitly deleted or frame is discarded (when leaving function)
  6. 6Python functions- Are also objects with an identifier
    - References to functions can be passed to other variables
    - Function execution has own frame of local variables
    - Local variables for parameters are created on call
  7. 7Methods for swapping references1. Creating a temporary variable
    2. Using multiple assignment (tuples)
  8. 8List mutability and equality- Lists are objects containing a mutable sequence of references => list values change without being reassigned
    - Setting a variable equal to "[…]" expression creates a new list
    - However assignment (e.g. lst1 = lst2) assigns reference to existing object
    - Same objects are always equal, but equal objects don't always have the same identity
  9. 9Copying a list- Shallow copy (e.g. slicing the original list or using copy from the copy module) is
    not guaranteed to work => only copies references and not the object referenced
    - Deep copy recursively copies referenced objects, creating an independent copy of original object
  10. 10Augmented assignment with mutable objects

Información

Descripción
(FIT1045: Algorithms & Programming Fundamentals in Python) Computer Science Fichas sobre Week 4: Sorting & Understanding Python, creado por Melina Mackey el 02/09/2019.
Creado por
Melina Mackey
Visitas
0
Historial
  • Creado por Melina Mackey · 2 sep 2019
  • Copiado por Melina Mackey · 2 sep 2019
  • Copiado por Melina Mackey · 2 sep 2019
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?