Trees Conceptual Review

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/32

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:40 AM on 1/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

33 Terms

1
New cards

What is a Tree?

A node-based data structure with nodes arranged in parent-child relationships.

2
New cards

How do trees usually grow?

Trees grow downwards, like a pyramid.

3
New cards

How many parents can a child node have?

Only one.

4
New cards

Can a parent node have multiple child nodes, or just one?

It can have multiple child nodes.

5
New cards

What is a binary tree?

A tree where each parent node can only have 2 child nodes at most.

6
New cards

What direction(s) do we move in a binary tree?

Left or Right.

7
New cards

What is the root?

The topmost node of a tree.

8
New cards

What’s a leaf node?

A node with no child nodes.

9
New cards

What is an edge?

A pointer that connects 2 nodes.

10
New cards

What is a branch?

Refers to the path we take to get from the root node to a specified node.

11
New cards

What are Siblings?

Child nodes that share the same parent.

12
New cards
  • What is a subtree?

  • What nodes can form subtrees?

  • A smaller tree within a larger tree.

  • Any parent-child node group can form a subtree.

13
New cards

What are the ‘ancestors’ of a node?

The nodes that come before a specified node on a branch.

14
New cards

What are the ‘descendants’ of a node?

All the nodes that branch out from the specified node.

15
New cards

What is an internal node?

Any node in a tree that has at least one child.

16
New cards

What is the degree of a node?

How many child nodes a node has.

17
New cards

What is height?

How far up a node is on a Tree.

18
New cards

What is Depth?

How far down a node is in a Tree.

19
New cards

What can we use to count the Height and/or Depth of a node?

Edges.

20
New cards

What is a Binary Search Tree? Think about a specific rule that separates a BST from a standard Binary Tree.

Its a type of Binary Tree where nodes to the left of the parent/root node are less than the parent/root node while nodes on the right are greater than the parent/root node.

21
New cards

What 2 rules should you follow in a BST when adding/finding nodes?

  • Move to the left of a BST if the node you’re looking for is less than the current parent node or root node.

  • Move to the right of a BST if the node you’re looking for is greater than the current parent node or root node.

22
New cards

How do you add a node to a BST? Describe the process with as much detail as possible.

  • Start from the root and follow the rules of traversal for adding/inserting nodes.

  • If the node you want to add is less than the current parent node, then add the node to the left of the parent node as a child node.

  • But, you should make sure that the node you’re adding is only added as a leaf node.

23
New cards

How do you remove a node to a BST? Describe the process with as much detail as possible (hint: there’s 3 scenarios to this!)

  • If you need to delete a leaf node:

    • Simply delete the edge connecting the leaf node with its parent node.

  • Delete a node with one child:

    • Connect the child node with the next predecessive parent node to “replace” the node you wish to delete with the child.

  • Delete a node with 2 children:

    • Look for a node with the next highest value from the node you wish to delete’s value.

    • Once you get that node, replace the node you wish to delete with that node.

    • If the node you’re using to replace has a child node, connect it with the predecessive parent node.

24
New cards

Does a Binary Search Tree allow for duplicates?

No, they do not.

25
New cards

What’s a Self-Balancing Binary Search Tree?

A special type of BST that has an algorithm where branches are automatically kept close to the same length.

26
New cards

Classify these Tree Types in the right order:

  • Binary Search Tree

  • Tree

  • Binary Tree

  • Self-Balancing Binary Search Tree

  • Node-based Data Structure

(it should go from broad to specific)

(most broad) Node-Based Data Structure → Tree → Binary Tree → Binary Search Tree → Self Balancing Binary Search Tree (most specific)

27
New cards

How do you print nodes in Pre-Order Traversal?

Start by printing the root node, then the left node, then the right node (root →  left → right).

28
New cards

How do you print nodes in In-Order Traversal?

Start by printing the left node, then the root node, and then finally the right node.

29
New cards

How do you print nodes in Post-Order Traversal?

Start by printing the left node, then the right node, and then finally the root node.

30
New cards

For what use-case would you use Pre-Order Traversal for?

If you want to make a duplicate of your tree.

31
New cards

For what use-case would you use In-Order Traversal for?

List the nodes of the tree in order.

32
New cards

For what use-case would you use Post-Order Traversal for?

When you want to delete leaf nodes from a tree.

33
New cards
  • What operations are Trees efficient at?

  • What operations are Trees slow at?

  • Ordered node search & retrieval.

  • Input and retrieval in general.