Decision Flashcards
(40 cards)
Algorithm
A finite sequence of step-by-step instructions carried out to solve a problem
Bubble Sort
Compare Adjacent items in the list:
· If in order, then leave them
· If out of order, then swap terms.
Compare all pairs in the list
Sort is complete when a full pass with no swaps is complete.
Quick Sort
Select midpoint as pivot, write all terms smaller than pivot on the left and all the terms bigger than the pivot on the right hand side.
Repeat this for the sublists produced.
Sort complete when all terms have been a pivot.
What are the 3 bin packing algorithms?
First-fit - considering items in the order they are given in.
First-Fit decreasing - order items in decreasing order and apply first fit algorithm.
Full-Bin - by inspection select items that will combine to fill bins, then apply first fit to remaining terms.
Order of an algorithm
A measure of the run time of the algorithm.
Increasing the size from m to n, increases the algorithm by a factor of f(m)/f(n)
Increasing the size of a problem by k
· An algorithm of linear order will take k times longer.
· An algorithm of quadratic order will take k² times longer.
· An algorithm of cubic order will take k³ times longer.
A graph
A graph consists of nodes which are connected by edges.
A Weighted Graph
Edges have a number associated with them, denoted there size.
A subgraph
A subgraph is a section of an original graph, showing only select nodes and edges.
Degree, Valency, or Order of a node
The number of edges going into a node.
Odd and Even Nodes
Denoted is the order of a node is odd or even.
Walk
Path
Trail
Cycle
A walk is a route through a graph from one node to the next.
A path is a walk in which no node is visited more than once.
A trail is a walk in which no edge is visited more than once.
A cycle is a walk where the start and end node are the same and no other node is visited more than once.
Hamiltonian Cycle
A cycle that includes every vertex.
Connected Graph
A graph where every vertex is connected. There is a path to any vertex from any vertex.
A Loop
An edge which starts and finished at the same vertex.
Simple graph
No Loops and there is a single edge from every vertex to every vertex.
Directed Graph
Edges have a direction and can only be commuted in that direction.
Euler’s Handshaking Lemma
In any undirected graph, the sum of the degrees of the vertices is equal to 2 x the number of edges. Number of odd nodes must be even.
A tree
A connected graph with no cycles
A Spanning Tree
A subgraph which includes all the vertices of the original graph and is also a tree.
A Complete Graph
A graph in which every vertex is directly connected by a single edge to each other vertex.
An Isomorphic Graph
Graphs which show the same information but may be drawn differently
Adjacency Matrix
A matrix describing the number of arcs joining the corresponding vertices.
Distance Matrix
A matrix describing the weight of arcs connecting vertices.