DECISION Flashcards

1
Q

A list of n items needs to be sorted into descending order starting at the left-hand entry. Describe how to carry out the first pass of a bubble sort on the numbers in the list.

A

-In the first pass, we compare the first number with the second and swap them if the second is larger than the first
-We now compare the second number with the third and swap them if the third number is larger than the second number
-We continue this untill we reach the end of the list

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

What is the final step of a sort?

A

Writing “sort complete”

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

How do you approximate time of an algorithm?
And why is it an approximation

A

Time = t x f(n2)/f(n1)

The runtime is not exactly proportional to …

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

Graph

A

A set of vertices connected by edges

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

Degree of a vertex

A

Number of edges coming out of it

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

Isomorphic

A

Two graphs are isomorphic if there is a 1:1 correspondance between their vertices which preserve adjacency

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

Subgraph

A

A graph whose edges and vertices are contained within the original graph

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

Walk

A

A sequence of connecting edges

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

Trail

A

A walk in which no edge is listed more than once

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

Path

A

A walk in which no vertex is visited more than once

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

Cycle

A

A path that finishes where it started

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

Connected graph

A

A graph where there is a path between any pair of vertices

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

Simple graph

A

-no edge begins and ends at the same vertex (no loops)
-no two edges connect the same pair of vertives (no repeated edges)

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

Tree

A

A conected graph with no cycles

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

Spanning tree

A

A subgraph that includes all the vertices of the original graph, and is also a tree

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

Minimum spanning tree

A

A spanning tree with the smallest possible weight

17
Q

Complete graph

A

A simple, connected graph such that there is an edge between every pair of vertices. We use the standard notation Kn for the complete graph with n vertices
There are 0.5(n)(n-1) edges in the graph Kn

18
Q

Eularian graph

A

A connected graph with no odd vertices

19
Q

Eularian cycle

A

A cycle that contains every edge once

Every Eularian graph has an Eularian cycle

20
Q

Hamiltonian cycle

A

A cycle that passes through every vertex precisely once

21
Q

Hamiltonian graph

A

A graph that contains a Hamiltonian cyle

22
Q

For any graph…

A

-The sum of all the degrees is double the number of edges
-There is always an even number of odd vertices

23
Q

For any simple graph…

A

-The graph can have atmost 0.5n(n-1) edges
-The degree of each vertex is atmost n-1