Log in from a computer to take this course

You'll need to log in from a computer to start Introduction to Non-linear Data Structures in Swift. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

Trees are useful for modeling data that has a hierarchical relationship which moves in the direction from parent to child. No child node will have more than one parent.

To recap some terms:

  • root: A node which has no parent. One per tree.
  • parent: A node which references other nodes.
  • child: Nodes referenced by other nodes.
  • sibling: Nodes which have the same parent.
  • leaf: Nodes which have no children.
  • level: The height or depth of the tree. Root nodes are at level 1, their children are at level 2, and so on.

Instructions

That was a lot of theory! Trees are beneficial and you’ll find they come up all the time as a useful way of modeling hierarchical data.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?