Trees and Graphs Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

trees

how does a tree organise its data

A

hierarchically

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

trees

what are the entities ina tree called

A

nodes

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

trees

nodes are connected by ….

A

edges

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

trees

each node contains a ……

A

value or data

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

trees

what are the 3 conditions a tree must be

A
  • connected
  • undirected
  • no cycles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

trees

describe what the following terms mean:
* root node
* parent node
* child node
* leaf node

A
  • root node - the topmost node where it all comes from
  • parent node - node that has an edge to a child node
  • child node - nodes below a parent node
  • leaf node - node with no children
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

trees

what is a binary tree

A

tree data structure where each node has at most two children

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

trees

what are the two nodes referred to as in a binary tree

A

left node, right node

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

trees

draw a binary tree for the following data:
Rose, Jasmine, George, Naomi, trever, Stanley

A

Rose
/ \
Jsmine Trevor
/ \ \Stanley
George Naomi

cant really do it

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

trees

what is a tree traversal

A

process that visits all the nodes in a tree

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

trees

give the 3 different types of traversal

A
  • preorder - parent first, then left and right
  • inorder - visit the left, then parent, then right
  • postorder - visit left, right, parent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

trees

whats the trick when performing a traversal

A

pre post

in

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

graphs

what is a labelled graph

A

graph with values on the edges

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

graphs

what is a labelled graph sometimes called

A

weighted graph

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

graphs

what is a directed graph

A

it is directed. the edges have arrows on them

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

graphs

explain how to create an adjacency matrix

A

if two vertices are connected, then a 1 is placed at the positions in the m,atrix. else its a 0

16
Q

graphs

explain how to create an adjacency list

A

specifiy the vertices that are adjcent to each vertex

17
Q

graphs

when is a list more suitable than an adjacency matrix

A

when the graph is sparse

18
Q
A