Trees_Part_2 - Position ADT The Position ADT models the...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Updated: 12-01-24 11:27 AM CSE 2011 Prof. J. Elder - 9 - Position ADT Ø The Position ADT models the notion of place within a data structure where a single object is stored Ø It gives a unified view of diverse ways of storing data, such as q a cell of an array q a node of a linked list q a node of a tree Ø Just one method: q object p.element() : returns the element stored at the position p
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Last Updated: 12-01-24 11:27 AM CSE 2011 Prof. J. Elder - 10 - Tree ADT Ø We use positions to abstract the nodes of a tree. Ø Generic methods: q integer size () q boolean isEmpty () q Iterator iterator () q Iterable positions () Ø Accessor methods: q Position root () q Position parent (p) q Iterable children (p) Ø Query methods: q boolean isInternal (p) q boolean isExternal (p) q boolean isRoot (p) Ø Update method: q object replace (p, o) q Additional update methods may be defined by data structures implementing the Tree ADT
Background image of page 2
Last Updated: 12-01-24 11:27 AM CSE 2011 Prof. J. Elder - 11 -
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Trees_Part_2 - Position ADT The Position ADT models the...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online