100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Algorithms and Data structures in Python

Rating
4.0
(2)
Sold
9
Pages
83
Uploaded on
16-10-2018
Written in
2018/2019

This summary contains all the information of the Lectures and the slides of the lectures the wednesday tutorials with examples of codes. This is a summary of the subject Algorithms and data structures in Python at The University of Amsterdam.

Show more Read less
Institution
Course











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
October 16, 2018
Number of pages
83
Written in
2018/2019
Type
Summary

Subjects

Content preview

Lecture 1:
You got 2 types of knowledge:

Declarative knowledge = statement of fact
Imparative knowledge = a recipe or “how to”
This is used by machines. “Machines are stupid”

Recipe -> 1. Sequence of simple steps.
2. Flow of control process that specifies when each step is executed.
3. A means of determining when …

Computers

You got two different kind of computers:

- Fixed program computer (calculator)
- Stored program computer (machine stores)
Basic machine architecture




Basic primitives

Tuning -> Compute anything using 6 primitives
- Right
- Left
- Read
- Wright
- Scan
- Do nothing

Nowadays, modern programming have more primitives. We can even use abstract methods to
create knew primitives.
! Anything that is computable in one programming language is computable in any other
programming language.




Pagina 1 van 83

,Creating recipes

- A programming language provides a set of primitive operations
- Expressions are complex but legal combinations of primitives in a programming language
- Expressions and computations have values and meanings in a programming language

Languages

You have different kind of languages. For instance english consists of words while programming
language consists of strings, floats, integers, booleans etc.

String = “Hello” -> words ()
Integer = 256 -> hele nummers ()
Float = 8.5 -> komma getallen ()
List = [1,2,3,4,] -> een lijst aan strings, integers, floats etc. [ ] (tuple is same but with ( ) )
Dictionary = { “a” = “apple”, “b” = “banana”} { }
Boolean = TRUE, FALSE

Om te zien wat voor type een bepaalde variable is: type(“Hello”) = <type ‘str’>




- Syntatic errors, are errors which are common and easily caught.
- Static semantic error = Some languages check for these before running the program
Can cause unpredictable behavior




Pagina 2 van 83

,Sometimes you don’t get any semantic errors but the programmer get different meaning then
intended.
- Program crashes
- Program runs forever
- Program gives answer but different then expected

Python programs

A program is sequence of definitions and commands.
- Definitions are evaluated
- Commands are executed by python interpreter by shell
Commands (statements) instruct interpreter to do something.
These can be typed directly in a shell or stored in a file that is read into the shell and
evaluated.

Objects

Programs manipulate data objects.

Object have a type that define things programs can do to them
◦ Ana is a human so she can walk, speak English, etc.
Objects can be scalar or non scalar

Scalar objects:

String = “Hello” -> words ()
Integer = 256 -> hele nummers ()
Float = 8.5 -> komma getallen ()
List = [1,2,3,4,] -> een lijst aan strings, integers, floats etc. [ ] (tuple is same but with ( ) )
Dictionary = { “a” = “apple”, “b” = “banana”} { }
Boolean = TRUE, FALSE
Non type = Special and has one value, None

Can convert object of one type to another
Float(3) converts integer 3 to float 3.0
Int(3.9) truncates float 3.9 to integer 3

Use print( ) to print something.

Expressions

- Combine objects and operators to form expressions.
- An expression has a value, which has a type.
- Simple expression: <object <operator> <object>




Pagina 3 van 83

, Simple operations

Radius = Radius + 1 == Radius +=1

On the left is the variable name, on the right are equivalent to a value.


Binding variables and values




Abstracting expressions

We give names to value of expression, this is so we can reuse the names instead of the values.
This makes it easier to change the codes in a later stadium in it will provide a clean code.




Pagina 4 van 83

Reviews from verified buyers

Showing all 2 reviews
3 year ago

6 year ago

4.0

2 reviews

5
1
4
0
3
1
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
joannavoortman Vrije Universiteit Amsterdam
Follow You need to be logged in order to follow users or courses
Sold
46
Member since
8 year
Number of followers
38
Documents
0
Last sold
8 months ago

3.4

7 reviews

5
3
4
1
3
1
2
0
1
2

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions