computer science formulaes

Embed Size (px)

Citation preview

  • 7/30/2019 computer science formulaes

    1/10

  • 7/30/2019 computer science formulaes

    2/10

  • 7/30/2019 computer science formulaes

    3/10

  • 7/30/2019 computer science formulaes

    4/10

  • 7/30/2019 computer science formulaes

    5/10

    Theoretical Computer Science Cheat Sheet

    Number Theory Graph Theory

    The Chinese remainder theorem: There ex-ists a number C such that:

    C r1 mod m1...

    ..

    .

    ..

    .C rn mod mn

    ifmi and mj are relatively prime for i = j.Eulers function: (x) is the number ofpositive integers less than x relativelyprime to x. If

    ni=1p

    eii is the prime fac-

    torization of x then

    (x) =n

    i=1

    pei1i (pi 1).

    Eulers theorem: If a and b are relativelyprime then

    1 a(b)

    mod b.Fermats theorem:

    1 ap1 mod p.The Euclidean algorithm: if a > b are in-tegers then

    gcd(a, b) = gcd(a mod b, b).

    Ifn

    i=1peii is the prime factorization of x

    then

    S(x) =d|x

    d =n

    i=1

    pei+1i 1pi 1 .

    Perfect Numbers: x is an even perfect num-ber iffx = 2n1(2n1) and 2n1 is prime.Wilsons theorem: n is a prime iff

    (n 1)! 1 mod n.Mobius inversion:

    (i) =

    1 if i = 1.0 if i is not square-free.(1)r if i is the product of

    r distinct primes.

    IfG(a) =

    d|a

    F(d),

    thenF(a) =

    d|a

    (d)Ga

    d

    .

    Prime numbers:

    pn = n ln n + n lnln n n + n lnln nln n

    + O

    n

    ln n

    ,

    (n) =n

    ln n+

    n

    (ln n)2+

    2!n

    (ln n)3

    + On

    (ln n)4.

    Definitions:

    Loop An edge connecting a ver-tex to itself.

    Directed Each edge has a direction.Simple Graph with no loops or

    multi-edges.Walk A sequence v0e1v1 . . . ev.Trail A walk with distinct edges.Path A trail with distinct

    vertices.

    Connected A graph where there existsa path between any twovertices.

    Component A maximal connectedsubgraph.

    Tree A connected acyclic graph.Free tree A tree with no root.

    DAG Directed acyclic graph.Eulerian Graph with a trail visiting

    each edge exactly once.

    Hamiltonian Graph with a cycle visitingeach vertex exactly once.

    Cut A set of edges whose re-moval increases the num-ber of components.

    Cut-set A minimal cut.Cut edge A size 1 cut.k-Connected A graph connected with

    the removal of any k 1vertices.

    k-Tough S V, S = we havek c(G S) |S|.

    k-Regular A graph where all verticeshave degree k.

    k-Factor A k-regular spanningsubgraph.

    Matching A set of edges, no two ofwhich are adjacent.

    Clique A set of vertices, all ofwhich are adjacent.

    Ind. set A set of vertices, none ofwhich are adjacent.

    Vertex cover A set of vertices whichcover all edges.

    Planar graph A graph which can be em-beded in the plane.

    Plane graph An embedding of a planargraph.

    vVdeg(v) = 2m.

    If G is planar then n m + f = 2, sof 2n 4, m 3n 6.

    Any planar graph has a vertex with de-

    gree 5.

    Notation:

    E(G) Edge setV(G) Vertex setc(G) Number of componentsG[S] Induced subgraph

    deg(v) Degree ofv(G) Maximum degree(G) Minimum degree(G) Chromatic numberE(G) Edge chromatic numberGc Complement graphKn Complete graphKn1,n2 Complete bipartite grapr(k, ) Ramsey number

    Geometry

    Projective coordinates: triple(x,y,z), not all x, y and z zero.

    (x,y,z) = (cx,cy,cz) c = 0.Cartesian Projective

    (x, y) (x,y, 1)y = mx + b (m,1, b)x = c (1, 0,c)Distance formula, Lp and Lmetric:

    (x1 x0)2 + (y1 y0)2,|x1 x0|p + |y1 y0|p1/p,lim

    p |x1 x0|p + |y1 y0|p

    1/p

    Area of triangle (x0, y0), (x1, y1and (x2, y2):

    12 abs

    x1 x0 y1 y0x2 x0 y2 y0 .

    Angle formed by three points:

    (0, 0) (x1, y1)

    (x2, y2)

    2

    1

    cos =(x1, y1) (x2, y2)

    12.

    Line through two points (x0, y0and (x1, y1):

    x y 1x0 y0 1x1 y1 1

    = 0.Area of circle, volume of sphere:

    A = r2, V = 43r3.

    If I have seen farther than othersit is because I have stood on theshoulders of giants.

    Issac Newton

    ..

    aph.pa l v s t ngl

    ctly once.o

    a cycle visictex exactlyl

    o e geso eoval ncreasova c

    ber of comc

    A minie s z

    nnectet

    - oug- o

    -

    deedegree

    atic numbge chromatic t

    omplemenCompletl

    1 2ompll

    (( , ) Ra

    .quare- ree.uae pro uct oe o

    inct primesc me

    =||

    a) =

    roo

  • 7/30/2019 computer science formulaes

    6/10

  • 7/30/2019 computer science formulaes

    7/10

  • 7/30/2019 computer science formulaes

    8/10

  • 7/30/2019 computer science formulaes

    9/10

  • 7/30/2019 computer science formulaes

    10/10