Fundamentals of algorithms Flashcards

1
Q

Breadth-first traversal

A

A method of traversing a graph by using a queue to visit all the neighbours of the current node before doing the same to each of the neighbours until the entire graph has been explored.

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

Depth-first traversal

A

A method of traversing a graph by using a stack to travel as far along one route as possible and then backtracking and doing the same for the remaining routes until the entire graph has been explored.

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

In-order traversal

A

A traversal in the order: traverse the left subtree, visit/pop the node then traverse the right subtree.

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

Post-order traversal

A

A traversal in the order: traverse the left subtree, traverse the right subtree, then visit/pop the node.

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

Pre-order traversal

A

A traversal in the order: visit/pop the node, traverse its left subtree then traverse its right subtree.

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

Infix notation

A

A mathematical notation where the operator is written between the operands.

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

Prefix notation

A

A mathematical notation where the operator is written before the operands.

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

Postfix/reverse Polish notation

A

A mathematical notation where the operator is written after the operands.

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

Linear search

A

An algorithm to search a list for a particular item by iterating through the list and checking each element until the required item is located, or the end of the list is reached.

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

Binary search

A

An algorithm to search a sorted list for a particular item by repeatedly halving the sublist which could contain the item.

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

Binary search tree

A

An algorithm to search a binary tree for a particular item by traversing the tree in the right direction until the item is found.

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

Bubble sort

A

A sorting algorithm that iterates through a list, comparing each element to its successor and swapping elements if the successor is greater than the current element. This is repeated until no more swaps can be made.

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

Merge sort

A

A divide-and-conquer sorting algorithm that recursively halves the list into sublists until all sublists are of length 1. The sublists are then merged back together in such a way that they are always sorted, until the full single list is obtained.

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

Dijkstra’s shortest path algorithm

A

An algorithm to find the shortest path between two nodes on a graph by using a priority queue to keep track of the shortest distance (cost) to each node from the starting node until the destination is found.

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