Common operations

Tree data structures can consistent of 1...n nodes., which means that even a single node without a parent or any children is still considered a tree. Therefore, many of the common operations associated with trees can be defined in terms of a single node, or from the perspective of the same. Here is a list of the most common operations associated with trees

  • Data: The data operation is associated with a single node, and returns the object or value contained in that node.
  • Children: The children operation returns the collection of siblings associated with this parent node.
  • Parent: Some tree structures provide a mechanism to "climb" the tree, or traverse the structure from any particular node back toward the root.
  • Enumerate: An enumeration ...

Get Everyday Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.