Week 10 - 11 Flashcards

1
Q

is composed of nodes with children nodes. The first/top node is called the root node.

A

A general tree data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

trees rules

A
  1. Node does not reference to there siblings.
  2. Child nodes pointed to parent.
  3. Two root nodes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The top node in a tree.

A

Root –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A node directly connected to another node when moving away from the root.

A

Child –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The converse notion of a child.

A

Parent –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A group of nodes with the same parent.

A

Siblings –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A node with no children

A

Leaf –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The connection between one node and another.

A

Edge –

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

is a hierarchical data structure in which each node has at most two children, referred to as the left child and the right child. This structure is widely used in computer science for various purposes, such as searching, sorting, and hierarchical data organization.

A

A Binary Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

always has a root node (the node at the top), which is initialized to null before any element is inserted.

A

A binary tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Binary Tree Rules

A

1.Maximum Number of Children.
Each node can have at most two children.
2.Hierarchy.
The tree starts from a root node.
Each child node can act as a root for its own subtree.
3.Levels.
The root is at level 0.
Its children are at level 1, their children are at level 2, and so on.
4.Height.
The height of a tree is the number of edges on the longest path from the root to a leaf.
5.Leaf Nodes.
Nodes with no children are called leaf nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Each node can have at most two children.

A

1.Maximum Number of Children.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The tree starts from a root node.

A

2.Hierarchy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The root is at level 0.
Its children are at level 1, their children are at level 2, and so on.

A

3.Levels.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The height of a tree is the number of edges on the longest path from the root to a leaf.

A

4.Height.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Nodes with no children are …

A

5.Leaf Nodes.

17
Q

Key Properties of a Binary Search Tree (BST)

A
  1. Left Subtree Values:
    All values in the left subtree of a node are less than the node’s value.
  2. Right Subtree Values:
    All values in the right subtree of a node are greater than the node’s value.
  3. Unique Values:
    Typically, BSTs do not allow duplicate values, although variations allow duplicates (either to the left or right).
  4. Root Node:
    The root node is the starting point for searching and inserting values.
  5. Efficient Search:
    The binary search property allows for efficient searching. The tree can be traversed from the root down to the correct leaf node by following the left or right child based on comparisons.
18
Q

Basic Operations in a Binary Search Tree

A

1 search
2. insertion
3. deletion