Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Teaching Data Structures with Python


Published on

Data Structures is traditionally a “bogeyman” discipline in Computer Science courses and has a high degree of failure. In FATEC São José dos Campos we are adopting a hybrid approach, with C and Python languages. The failure rate decreased from 85% (2008) to 10% (2015). The talk will be extensively illustrated with code in C and Python, addressing the various concepts taught in this course.
Presented at PyConUS 2016 (Education Summit), PyCon Japan 2015 and EuroPython 2015 (Video:

Published in: Education
  • Parabéns, ótima abordagem pensando no aprendizado dos alunos. Sou coordenador de curso de CS aqui no Maranhão e vamos começar a adotar essa pratica. Valeu
    Are you sure you want to  Yes  No
    Your message goes here

Teaching Data Structures with Python

  1. 1. Data Structures Discipline with Python @fmasanori
  2. 2. I love teaching CS Professor at FATEC
  3. 3. 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.
  4. 4. But I love Data Structures
  5. 5. Data Structures are cool
  6. 6. Data Structures with Python at FATEC
  7. 7. Retention 2008 85% retained 15% approved Data Structures with C (2008)
  8. 8. Retention 2015 10% retained 90%approved Data Structures with Python (2015)
  9. 9. 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
  10. 10. • Lab Only – 4 classes/week • 4 Lab Projects (Python) • Big Brother (some of the best students could help the other students as coaches) • Algorithms in Python + C (side by side) Details
  11. 11. Why Python? introductory-teaching-language-at-top-us-universities/fulltext
  12. 12. Usability is a problem for DS also... "Results show that many aspects of traditional C- style syntax, while it has influenced a generation of programmers, exhibits problems in terms of usability for novices". "Perl and Java did not accuracy rates significantly higher than a language with randomly generated keywords" Andreas Stefik and Susanna Siebert: "An Empirical Investigation into Programming Language Syntax." ACM Transactions on Computing Education, 13(4), Nov. 2013.
  13. 13. The most common fault in computer classes is to emphasize the rules of specific programming languages, instead of to emphasize the algorithms that are being expressed in those languages. D. Knuth interview at People of ACM, June, 2014.
  14. 14. Talk is cheap. Show me the code. Linus Torvalds
  15. 15. • C is good for optimization (details, low level) • Python is good to show the essence of the algorithms (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
  16. 16. Variables are just names (references)
  17. 17. References == “pointers”
  18. 18. Big integers
  19. 19. Natural integer division
  20. 20. Multiple assignment
  21. 21. "The programming activity should be viewed as a process of creating works of literature, written to be read. “ --D.E. Knuth Identation
  22. 22. Identation in C
  23. 23. Identation in C
  24. 24. 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.
  25. 25. Recursion
  26. 26. Recursion
  27. 27. Recursion
  28. 28. Recursion (student solution for dec2bin problem)
  29. 29. Linked Lists
  30. 30. Linked Lists
  31. 31. Linked Lists
  32. 32. FIFOs: Distance in Networks
  33. 33. FIFOs: Distance in Networks
  34. 34. FIFOs: Distance in Networks
  35. 35. Stacks: well-formed expression
  36. 36. Stacks: well-formed expression
  37. 37. Selection Sort
  38. 38. Selection Sort
  39. 39. Quicksort
  40. 40. Quicksort
  41. 41. Word Count Word Count, please download
  42. 42. Projects: Sorting Algorithm comparison
  43. 43. Projects: Arthur Merlin Games simplification Jessica Pâmela Leandro Fernanda Renata WalberGabrielDiogo EclisBrunoAdriano Leandro Walber Gabriel Diogo Eclis Bruno Adriano
  44. 44. Projects: Binaries regions
  45. 45. Projects: Minimum Degree Greedy Heuristic for MIS
  46. 46. • C is good for optimization (details, low level) • Python is good to show the essence of the algorithms (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
  47. 47. Questions? Slides: