Binary Trees Flashcards

1
Q

What is a binary tree?

A
  • hierarchical with nodes branching in one direction with multiple pointers
  • trees expand in one direction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Parent and Children

A
  • trees made up of parents and children, every parent can be a child
  • every node can only have one parent, but can have many children
  • each Node can hv max of 2 children
  • children represented using
    . left and .right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Terminolgy

A

Root node: top node

Leaf node: any node w/o children

Branch: path btw root node and leaf node

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

binary search trees

A

node.cargo must be more than node.left.cargo and less than node.right.cargo

rule must be true fol entire tree

if root node is 3, everything to right must be greater than 3, to right must be less than 3

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

Truthy and Falsy Values

A

Truthy Values - by default an object is considered True

  • non-empty sequences of collections(lists, tuples, strings, dicts, sets)
  • numeric values that are not zero
  • True

Falsy Values - evaluate to False

  • empty sequences and collections
  • zero of any numeric type(int, float, complex)
  • Constants (None, False)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly