Skip to content

Latest commit

 

History

History
43 lines (36 loc) · 2.88 KB

File metadata and controls

43 lines (36 loc) · 2.88 KB

Advanced Trees, including Geometric

Traversals

Rooted Trees

  • Tree iteration = tree traversal
  • Unlike lists, many natural orderings

Tree Traversal

Range Finding

  • Instead of traversing entire tree, only want to look at items in certain range

Pruning & findInRange Runtime

  • Pruning: Restrict search to only nodes containing path(s) to answer(s)
  • Runtime

Spatial Trees

  • Generalization of BST
  • Think of items as oriented in particular 2D direction (e.g NW/NE/SW/SE instead of binary </>)
  • Can have mutliple different quadtrees for same set of data
    • Just like BST, insertion order determines topology of QuadTree
  • If on boundary line, usually assume = → >
  • Pruning
    • Analogous to binary search on BST (eliminate unnecessary search spaces)
    • Ignore branches if no possible way branch could contain wanted item

Tree Iterators (Extra)

  • Use Stack based DFS traversal