Bases
0x0F > 0000 1111
Convert by each byte for bitstrings.
1100 + 11 =
1100 + 0011
Pad from the left.
0x0F + 0x0A
15 + 10 = 25
REMEMBER TO CONVERT BASES BACK UNLESS STATED OTHERWISE |
Logic
p |
implies |
q |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
|
p |
or |
q |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
1 |
1 |
1 |
|
p |
and |
q |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
|
|
Sets
Sets have no duplicates, and are unordered.
set('john, stop')
= {'j', 'o', 'h', 'n', ',' '', 's', 't', 'o', 'p'}
commas and spaces count as characters
A = {j, o, h, n}, B = {s, t, o , p}
A ⋃ B = {j, o, h, n, s, t , o, p}
A ⋂ B = {o}
A - B = {j, h, n}
Symdiff = A ⋃ B - A ⋂ B =
{j, h, n, s, t, p}
= XOR |
Graphs
For (v, w) ∈ E => (w, v) ∈ E to be true...
It must be an undirected graph.
(v,w) is an edge in the set of all edges E
Trees are graphs but cannot have cycles.
Edge list: (NODE, COST, NODE) |
|
|
Big O
Most Efficient
O(1)
O(logn)
O(n)
O(nlogn)
O(n^2)
O(n!)
Least Efficient
logn is hopping halfway between |
Functions
Domain = Source/Left
Range = Result/Right
A relation can be thought of as a set that contains every pair which maps from
an element in the domain to an element in the range.
For a function, every element in the range is mapped to from a
unique element in the domain. This is to say, that an element on the left of this diagram can ONLY map to ONE
element on the right. |
|
|
Matrices
1 x 2 2 x 1
[5, 7] [3]
⠀⠀⠀[4]
If the two inside numbers are the same, dot product can be performed, the resulting matrix is the rows x column |
Relations
Domain/Range is the same
RELATIONS CAN MAP MULTIPLE DOMAIN ELEMENTS TO A RANGE ELEMENT
Transitive
Triangle line.
I'm taller than Pramod, who is taller than Alex, therefore, I'm taller than Alex.
x>y, y>z => x>z
Reflexive
Diagonal line
I know myself
x=x
Symmetric
Diagonal with identical results mirrored.
They're sitting across from me, therefore I'm sitting across from them.
x+y /2 = y => x=y |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets