Você está na página 1de 31

T o

H ow
ACSL
Contest #4
Contest 4 Topics
Intermediate:
Graph Theory no powers greater than two - 2
Digital Electronics up to three variables - 2
Assembly Language no loops - 1

Senior:
Graph Theory - 2
Digital Electronics - 2
Assembly Language with loops - 1
Graph Theory
Graph Theory
Graph - A collection of vertices and edges
Edge - A connection between two vertices
Vertices are also known as nodes
Can be represented in many ways, one of which is as a set of
edges and vertices:
Vertices {A, B, C, D, E, F, G, H, I, J, K, L, M}
Edges {AG, AB, AC, LM, JM, JL, JK, ED, FD, HI, FE, AF, GE}
Graph Theory
Path - A list of vertices in which successive vertices are
connected by edges in the graph.
BAFEG is a path from B to G in the graph below
Order is important! Follow the order they are listed
Simple path - A path with no repeated vertex
BAFEGAC is not a simple path
Graph Theory
A graph is connected if there is a path from every vertex to
every other vertex in the graph. In other words, I could travel
from any node to any other node by following some path.
A graph that is not connected is made up of smaller
connected components.
A cycle is a path where the first and last vertex are the same
(NO REPEAT NODES IN THE PATH)
A graph with no cycles is called a tree
Since there is only one path between all nodes, a tree on N vertices
contains N-1 edges
Spanning trees are graphs or subgraphs that contain all the
vertices in a graph
Graph Theory
A group of disconnected trees is called a forest
Directed graphs are graphs which have directions
associated with each edge, so they can only be traversed
one way
Graph Theory
A dag is a directed acyclic graph, or a directed graph with
no cycles
Denoting V as the number of vertices and E as number of
edges:
E can range from V to V2 or (V) (V-1) in undirected graphs
Graphs with all possible edges between nodes are
complete, those with relatively few edges are sparse, and
those with most edges are dense
Graph Theory
Adjacency matrices are sometimes used to represent
connections between nodes in a graph.
The nodes are placed on two axes, and then numbers are
used to represent if there exists an edge between two nodes
0 is no edge, 1 means there is an edge
Other numbers can be weighted edges

src: http://www.stoimen.com/blog/wp-content/uploads/2012/08/5.-Undirected-Graph-Adjacency-Matrix.png
Graph Theory
Graph Theory
Graph Theory

The cycles can then be


counted: AB is a cycle,
BCD, and CD, so there are
3 cycles.
Graph Theory
Graph Theory
You could count the paths by hand, coming up with 1 path of length
2 and 3 paths of length 4. Or could could build an adjacency matrix
and use power rules to find the connections of length 2 and 4:
Digital Electronics
Know the schematic symbols
You really only need to memorize NOT, AND, and OR
BUFFER doesnt really mean anything
The little circle to the right of a symbol always means NOT
The difference between OR and XOR (and NOR and XNOR) is the
extra line on the left of the XOR symbol
Translate schematic into a Boolean equation
Go from right to left and use parentheses
When the line diverges that means the same quantity is used for
multiple separate operations
After that, its more or less the same as Boolean Algebra
Refer to last months presentation to review properties and laws
Digital Electronics
Digital Electronics
Digital Electronics
Sample Problem 1
Digital Electronics
Sample Problem 1: Solution
Digital Electronics
Sample Problem 2
Digital Electronics
Sample Problem 2: Solution
Assembly
Extremely low-level programming language, with very little
abstraction
Translated to machine code (1s and 0s) by an assembler
ACSL has created their own variant of assembly, which
they call ACSL Assembly Language, or AAL
Rules of AAL:
Numbers are cut off, not rounded (e.g. 14 / 5 = 2)
Numbers can range from -999,999 to 999,999
All operations are performed modulo 1,000,000 (e.g. 999,998 plus 7
equals 5)
Programs are executed sequentially unless branches are specified
Assembly
There is an invisible variable called an accumulator (ACC)
that stores the results of each operation
All assembly lines take the following format:

label OPCODE LOC comments

The italicized parts are optional


OPCODEs are abbreviations for actions, like MULT, ADD,
etc.
labels are used to denote locations
LOCs are either references to labels, or immediate data
used by the OPCODE
Assembly
List of OPCODEs:
Assembly
List of OPCODEs:
Assembly
Sample Problem:
Assembly
Sample Problem:
Assembly
Sample Problem:
Assembly
Sample Problem:
Assembly
Sample Problem:
Assembly
Sample Problem: