Graphs
&
Recursion

What is a graph?

  • Abstract data type
  • Nodes and vertexes
  • Types
  • Examples

What is a tree?

  • Special type of a graph
  • Acyclic connected graph
  • Root and leaves
  • Examples

Common algorithms

  • Breadth-first Search
    • Queue
  • Depth-first Search
    • Stack
  • What else do you know?

Recursion

"To understand recursion you need to first understand recursion"

Recursive

Iterative

# Tail recursion

Tree recursion

Split the problem into smaller problems

fibonacci(n) = fibonacci(n - 1) + fibonacci(n - 2)

Higher-order functions

Functions that accept another functions as an argument

Graphs and Recursion

By Hack Bulgaria

Graphs and Recursion

Programming 101 with Python / week 8 / 17.04.2019

  • 1,098