teaching data structures with python

50
Data Structures Discipline with Python @fmasanori

Upload: fernando-masanori

Post on 16-Jul-2015

788 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Teaching Data Structures with Python

Data Structures Discipline with Python@fmasanori

Page 2: Teaching Data Structures with Python

I love teachingCS Professor at FATEChttps://about.me/fmasanori

http://pycursos.com/python-para-zumbis/

Page 3: Teaching Data Structures with Python
Page 4: Teaching Data Structures with Python
Page 5: Teaching Data Structures with Python
Page 6: Teaching Data Structures with Python

Difficult with C language

"A C program is like a fast dance on a newly waxed dance floor by people carrying razors."Waldi Ravens. Programmer.

Page 7: Teaching Data Structures with Python

But I love Data Structures

Page 8: Teaching Data Structures with Python

Data Structures are cool

Page 9: Teaching Data Structures with Python

Data Structures with Python at FATEC

Page 10: Teaching Data Structures with Python

Retention 2008

85% retained

15% approved

Data Structures with C (2008)

Page 11: Teaching Data Structures with Python

Retention 2015

10% retained

90%approved

Data Structures with Python (2015)

Page 12: Teaching Data Structures with Python

C only:– 85% retained (2008)

Python + C:– 12% retained (2014)

– 10% retained (2015)

– ENADE grade 5/5 (max) (last grade)

– 1st Programming Contest InterFATECs(1st/62) (2014 and 2015)

– Final Brazilian ICPC Programming 2015

Summary

Page 13: Teaching Data Structures with Python

• Lab Only – 4 classes/week

• 4 Lab Projects (Python)

• Big Brother (some of the best students couldhelp the other students as coaches)

• Algorithms in Python + C (side by side)

Details

Page 14: Teaching Data Structures with Python

Why Python?

http://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-us-universities/fulltext

Page 15: Teaching Data Structures with Python

Usability is a problem for DS also...

"Results show that many aspects of traditional C-style syntax, while it has influenced a generation ofprogrammers, exhibits problems in terms ofusability for novices".

"Perl and Java did not accuracy rates significantlyhigher than a language with randomly generatedkeywords"

Andreas Stefik and Susanna Siebert: "An Empirical Investigation into Programming Language Syntax." ACM Transactions on Computing

Education, 13(4), Nov. 2013.

Page 16: Teaching Data Structures with Python

The most common fault in computer classes is toemphasize the rules of specific programminglanguages, instead of to emphasize the algorithmsthat are being expressed in those languages. D. Knuthinterview at People of ACM, June, 2014.

Page 17: Teaching Data Structures with Python

Talk is cheap. Show me the code.

Linus Torvalds

Page 18: Teaching Data Structures with Python

• C is good for optimization (details, low level)

• Python is good to show the essence of thealgorithms (readability, high level)

• If the algorithm is the same (complexity) “premature optimization is evil” also in teaching Data Structures

• We are using Python + C with success

TL DR

Page 19: Teaching Data Structures with Python

Variables are just names (references)

Page 20: Teaching Data Structures with Python

References == “pointers”

Page 21: Teaching Data Structures with Python

Big integers

Page 22: Teaching Data Structures with Python

Natural integer division

Page 23: Teaching Data Structures with Python

Multiple assignment

Page 24: Teaching Data Structures with Python

"The programming activity should be viewed

as a process of creating works of literature,

written to be read. “

--D.E. Knuth

Identation

Page 25: Teaching Data Structures with Python

Identation in C

Page 26: Teaching Data Structures with Python

Identation in C

Page 27: Teaching Data Structures with Python

Recursion

"To understand recursion, one must first understand recursion."

--folklore

"To solve the problem, I found barriers within barriers. So, I adopted a recursive solution. "

--a student

Ref.: Feofiloff, P., Algoritmos em C, Editora Campus, 2009.

Page 28: Teaching Data Structures with Python

Recursion

Page 29: Teaching Data Structures with Python

Recursion

Page 30: Teaching Data Structures with Python

Recursion

Page 31: Teaching Data Structures with Python

Recursion (student solution for dec2bin problem)

Page 32: Teaching Data Structures with Python

Linked Lists

Page 33: Teaching Data Structures with Python

Linked Lists

Page 34: Teaching Data Structures with Python

Linked Lists

Page 35: Teaching Data Structures with Python

FIFOs: Distance in Networks

Page 36: Teaching Data Structures with Python

FIFOs: Distance in Networks

Page 37: Teaching Data Structures with Python

FIFOs: Distance in Networks

Page 38: Teaching Data Structures with Python

Stacks: well-formed expression

Page 39: Teaching Data Structures with Python

Stacks: well-formed expression

Page 40: Teaching Data Structures with Python

Selection Sort

Page 41: Teaching Data Structures with Python

Selection Sort

Page 42: Teaching Data Structures with Python

Quicksort

Page 43: Teaching Data Structures with Python

Quicksort

Page 44: Teaching Data Structures with Python

Word Count

Word Count, please download http://www.gutenberg.org/cache/epub/11/pg11.txt

Page 45: Teaching Data Structures with Python

Projects: Sorting Algorithm comparison

Page 46: Teaching Data Structures with Python

Projects: Arthur Merlin Games simplification

Jessica Pâmela

Leandro

Fernanda Renata

WalberGabrielDiogo EclisBrunoAdriano

Leandro

Walber

Gabriel Diogo

Eclis

Bruno

Adriano

Page 47: Teaching Data Structures with Python

Projects: Binaries regions

Page 48: Teaching Data Structures with Python

Projects: Minimum Degree Greedy Heuristic for MIS

Page 49: Teaching Data Structures with Python

• C is good for optimization (details, low level)

• Python is good to show the essence of thealgorithms (readability, high level)

• If the algorithm is the same (complexity) “premature optimization is evil” also in teaching Data Structures.

• We are using Python + C with success

Conclusions

Page 50: Teaching Data Structures with Python

Questions?gist.github.com/fmasanori

http://about.me/fmasanori

[email protected]

Slides: bit.ly/python-DS