100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary Algorithms and Data structures in Python $8.15   Add to cart

Summary

Summary Algorithms and Data structures in Python

2 reviews
 289 views  9 purchases
  • Course
  • Institution

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.

Preview 4 out of 83  pages

  • October 16, 2018
  • 83
  • 2018/2019
  • Summary

2  reviews

review-writer-avatar

By: arnoldmiklospap • 2 year ago

review-writer-avatar

By: davidnelck • 5 year ago

avatar-seller
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

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller joannavoortman. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $8.15. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

64438 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$8.15  9x  sold
  • (2)
  Add to cart