Presentation is loading. Please wait.

Presentation is loading. Please wait.

2014-T2 Lecture 21 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Lindsay Groves, Peter Andreae, John Lewis,

Similar presentations


Presentation on theme: "2014-T2 Lecture 21 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Lindsay Groves, Peter Andreae, John Lewis,"— Presentation transcript:

1 2014-T2 Lecture 21 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Lindsay Groves, Peter Andreae, John Lewis, and Thomas Kuehne, VUW COMP 103 Marcus Frean “Various topics”

2 2 RECAP  Linked lists  Trees TODAY  Don’t want to rush into trees Announcements  No lecture this Thursday

3 3  Generalised LinkedNode Representing trees in Java M Linked List Nodes FC

4 4  Generalised LinkedNode Representing trees in Java Binary Tree Nodes M FCTL

5 5  Generalised LinkedNode Representing trees in Java General Tree Nodes F … … … C … … … M … … … T … … … L … … … some collection type (ordered or unordered)

6 6 More Tree Examples  Other Taxonomies  e.g. game genres  Organisational Charts  CEO, managers, employees, slaves, …  Filing systems  e.g., the folder structure of your hard drive  Computer Graphics models   Octrees, for partitioning 3D space  Decision processes …… hierarchical structures naturally represented with trees (rather than using trees as an access technique) hierarchical structures naturally represented with trees (rather than using trees as an access technique)

7 7 Planning  Tic Tac Toe  search tree for moves XXX XXX … OXOXX O X O X O X O … often not represented explicitly; only implicitly “created” by recursion

8 8 More Tree Terminology  A tree is a collection of items in a strict hierarchical structure.  Each item is in a node of the tree.  The root is at the top.  The leaves are at the bottom.  Each node may have child nodes – except a leaf, which has none.  Each node has one parent - except the root, which has none.  An edge joins a node to its parent – may be labelled.  A subtree is a node plus all its descendents.  The depth of a node is its distance from the root.  The height or depth of a tree is the depth of the lowest leaf.  Level = set/list of nodes at the same depth.  Branch = sequence of nodes on a path from root to a leaf. Children may be ordered/unordered Tree may or may not store explicit parent references

9 9 Terminology visualised K K G G C C I I M M Q Q O O A A E E node, root, leaf, child, parent, edge, subtree, depth, height, level, branch, siblings, ancestors, descendants, cousins, …

10 10 remember that test? I see there are lots of scripts uncollected:  if you haven’t already, pick up your script from the office on the 3 rd floor  Check our addition...  Look at the solutions and make sure you understand everything  Our answer for Q3c was wrong – we’ll give everyone who sat the test those marks.

11 11 processing.org  “processing” is a programming environment that you might enjoy exploring...  write in java: processing takes care of most of the “icky stuff” (such as main...).  end result can be run in a web page

12 12 python  python is a programming language that you might enjoy exploring...  “scripting” language – interpreted, not compiled  not “strongly typed” (whereas Java is)  fast to write  avoid loops.... but numpy  graphics via pylab library  FightClub...


Download ppt "2014-T2 Lecture 21 School of Engineering and Computer Science, Victoria University of Wellington  Marcus Frean, Lindsay Groves, Peter Andreae, John Lewis,"

Similar presentations


Ads by Google