Unit 3 Flashcards

(15 cards)

1
Q

breath-first traversal

A

fastest path, uses queue, adjacent vertices on same level first
-not discovered
-visited
-fully discovered

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

depth-first

A

navigating a maze, uses stack, follows row until fully read, destacks and checks next option, critical path

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

dijstra’s algorithm

A

shortest/least expensive fight

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

tree traversal

A

pre-order and in-order and post-order

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

subroutine tree traversal

A

SUBROUTINE order (tree_node)
OUTPUT (tree_node.value) = pre-order
IF tree_node.left != NULL THEN
order (tree_node.left)
ENDIF
OUTPUT (tree_node.value) = in-order
IF tree_node.right!= NULL THEN
order (tree_node.right)
ENDIF
OUTPUT (tree_node.value) = post-order
END SUBROUTINE

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

binary tree search

A

-O(logn)
-to insert: go left if smaller, right if larger and insert appropriately
-to find: same procedure

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

reverse polish

A

suitable to use stack to evaluate, unambiguous and eliminates need of brackets, uses post fix notation

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

using tree to convert arithmetics

A

in order, in fix = normal
post order, post fix = reverse polish
pre-order, pre fix = polish

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

using stack with reverse polish

A

convert expression into RPN, push items onto stack
if item is an operator a. pop last two items off and apply operator b. push result onto stack
repeat til done

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

linear search

A

goes through every item in linear fashion
-stored as array

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

binary search

A

list has to be sorted, looks at middle item and then splits up list

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

binary and linear search speed comaprison

A

up to size of roughly 17, linear faster, after binary faster

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

bubble sort

A

very time INefficient sorting algorithm, time efficiency O(n2) time efficiency O(1), compares adjacent values and swaps around until sorted

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

merge sort

A

time complexity of O(nlogn) space complexity O(n), splits up list until pairs of two and then puts it back together

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

complexities

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