1. A simple graph in which there is only one edge between a pair of vertices. A simple graph with n vertices has maximum of n (n-1)/2 edges. A simple graph-in which there exist at least two vertices with same degree. 2. A graph in which loops and parallel edges are allowed is pseudo graph. *3. The Handshaking Theorem: In undirected graph sum of degrees of all vertices is equal to twice the number of edges. 4. The number of vertices of odd degree in undirected graph is even. 5. In directed graph the sum of in-degree and out-degree is equal to twice the number of edges in graph G 6. The sum of in degree of vertices is equal to sum of odd degree of vertices is equal to the number of edges. 7. The sum of degrees of all vertices is equal to the number of vertices in graph G. 8. Regular graph if each vertex of G has degree k, then G is said to be a regular graph of degree k (k-regular).Every vertex of simple graph has same degree. 9. Multiple graph Multiple edges are allowed but no loop allowed. 10. Complete graph K n . A simple graph that contain exactly one edge between each pair of distinct vertices. A complete undirected graph have every pair of distinct vertices is connected by a unique edge. *11. A complete graph The number of edges in K n is n C 2 with n vertices has n (n-1)/2 edges. The ratio of the number of edges to that of vertices called beta index = n C 2 /n=(n-1)/2. 12. The degree of each of these n vertices is (n-1).If n is odd; degree of each of these n vertices is (n-1) that is even. If n is even, degree of each of these n vertices is (n-1) that is odd. 13. Cycle C n,n>=3, consists of n vertices 1,2,3,,n and edges {1,2},{2,3}{n- 1,n} and {n,1}. 14. Wheel W n add an additional vertex to the cycle C n n>=3, and connect this new vertex to each of the n vertices in C n by new edges. 15. The n Cube denoted by Q n , is the graph that has vertices representing the 2 n bit string
16. Bipartite Graph-If vertex set V of a simple graph G=(V,E) can be partitioned into two subsets V1 and V2 such that every edge of G connects a vertex in V1 and a vertex in V2(so that no edge in G connects either two vertices in V1 or two vertices in V2 then G is called Bipartite graph. The number of edges in a bipartite graph with n vertices is at most (n 2 /2).If G is a bipartite simple graph with v vertices and e edges, then e<=v 2 /4 17. Whether a graph is bipartite is based on the fact that a graph is bipartite if and only if it is possible to color its vertices two diferent colors so that no two vertices of the same color are adjacent. 18. Complete Bipartite Graph-If each vertex of V1 is connected with every vertex of V2 by an edge, then G is called a completely bipartite graph. If V1 contains m vertices and V2 contains n vertices, then completely bipartite graph is denoted by K m,n. 19. The degree sequence of a graph is sequence of the degree of the Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 2 vertices of graph in non decreasing order. 20. If the degree sequence of the simple graph G is d1,d2,d3,..,dn, then degree sequence of G is n-1-dn,n-1-dn-1,..,n-1-d2,n-1-d1 21. If G is a simple graph with n vertices, then the union of G and G is K n . 22. Isomorphic Graphs- Two graphs G1 and G2 are said to be isomorphic to each other, if there exists a one to one correspondence between the vertexes set which preserves adjacency of the vertices. A simple graph G is called self-complementary if G and G is isomorphic. The complementary graph G of a simple graph has the same vertices as G. Two vertices are adjacent in G if and only if they are not adjacent in G. *23. If the simple graph G has v vertices and e edges, how many edges does G have? v(v-1)/2 e. 24. Connected An undirected graph is said to be connected if there is a path between every pair of distinct vertices of graph. A disconnected graph is union of two or more connected sub graphs. These disjoint connected sub graphs are called connected components of the graph. *25. The maximum number of edges in a simple disconnected graph G with n vertices and k components is (n-k)(n-k+1)/2. 26. Path A simple path in which edges are distinct. The number of path between two vertices in a graph can be determined using its adjacency matrix. 27. Circuit- A simple circuit is one that contains the same edge more than once. A circuit in a graph is called cycle in a graph. 28. A multi graph is traversable if it has a Euler path. There is exactly two vertices whose in-degree not equal to out-degree. 29. Euler Circuit- A circuit of graph G is called Eulerian circuit if it includes each edge of G exactly once. 30. Euler Path- A path of graph G is called Eulerian path if it includes each edge of G exactly once. *31. The necessary and sufcient condition for existence of Euler circuit and Euler path are (i) A connected graph contains a Euler circuit, if and only if each of its vertices is of even degree.(ii) A connected graph contains a Euler path, if and only if it has exactly two vertices of odd degree. 32. Hamiltonian Path A path of a graph G is called Hamiltonian path, if it includes each vertex of G exactly once. 33. Hamiltonian Circuit A circuit of a graph G is called a Hamiltonian circuit if it includes each of vertex G exactly once, except the starting and end vertices which appears twice. 35. A graph containing a Hamiltonian circuit is called a Hamiltonian path. 36. The path obtained by deleting any one edge from a Hamiltonian circuit is a Hamiltonian path. 37. Hamiltonian circuit contains a Hamiltonian path, but a graph containing a Hamiltonian path need not have a Hamiltonian circuit. 38. A complete graph K n , will always have a Hamiltonian circuit, when n>=3, 39. A graph may contain more than one Hamiltonian circuit. 40. Let G be a connected planar simple graph with e edges and vertices. Let r be the number of regions in a planar representation of G. Then r = e- v+2. 41. Let G be a connected planar simple graph with e edges and vertices. Let Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 3 r be the number of regions in a planar representation with connected components(k) then the number of regions r = e-v+(k+1) 42. Prove that G is bipartite G contains no odd cycles. 43. Prove that number of (v i ,v j ) paths of length k in G is the (i,j) th entry of A k , where A is adjacency matrix of G. 44. An undirected graph is connected if every pair of vertices is connected by a path in a graph is a contiguous sequence of its vertices. 45. In any graph G, a path forms a cycle if its starting vertex and end vertex are same. 46. A connected acyclic, undirected graph is tree. Any two vertices in G are connected by a unique simple path. G is connected, acyclic and |E|=|V|-1.G is acyclic, but if any edge is added to E, the resulting graph contains a cycle. DISCRETE MATHEMATICS SETS AND RELATIONS 1. Let A be a set with n distinct elements. The number of diferent binary relation on set A: a. There are refexive relations. b. There are symmetric relations. c. There are refexive and symmetric relations. d. There are total ordering relations. 6. n(ABC) = n(A) + n(B) + n(C) n(AB) n(BC) n(AC) + n(ABC) 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 4 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. DISCRETEMATHEMATICS LOGIC 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 5 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. THEORY OF COMPUTATION [LANGUAGES, GRAMMAR, FSM, TM, UNDECIDABILITY] 1. The set of all strings over an alphabet is denoted by * which includes the empty string .
a. * is count ably infnite set. n denotes set of all strings over whose length is n. Subsets of * are called languages. b. L 1 = {,a, b} L 2 ={ab, aabb, aaabbb,} L 3 = { w * |number of a s and number of b s in w are equal}.L 1 is fnite, L 2 and L 3 are infnite languages. denotes empty language. 2. It is un decidable to determine whether a given CFG is ambiguous. 3. It is un decidable in general to determine whether a CFL L is inherently ambiguous or not. But for a particular subclass it is decidable. 4. A CFL L is bounded if there exists string w 1 , w 2 , w 3 , w k such that L w 1 * ,w 2 * ,w k * There exists an algorithm to fnd out whether a given bounded CFL is inherently ambiguous or not. 5. Let G be CFG then the degree of ambiguity of G is the maximum number of derivation trees a string wL(G).In S i up to strings of length i, the Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 6 coefcient of the string will give the number of diferent derivation trees it can have in G. S i =S i-1 S i-1 +a. 6. In general for a language over = {0, 1}, if n th element from the end is fxed, we can have a NFSA with (n+1) states, but DFSA requires 2 n states. 7. Recursive Language The set of strings which is accepted by a TM which halts on all inputs is called a recursive sets. Language generated by the recursive set is recursive language. 8. Recursively Enumerable Language The language accepted by TM is Type-0 language (Phrase structured Language) also called recursively enumerable (RE) set. A TM accepts a string by going to a fnal state and halting. It can reject a string by halting in a non-fnal state or getting into a loop. A TM when started on an input may get into a loop and never halt. 9. The complement of recursive set is recursive. 10. The union of two recursive sets is recursive. 11. If L 1 and L 2 are recursively enumerable sets then L 1 L 2 is recursively enumerable. 12. If L and L are both recursively enumerable, then L is recursive. 13. Diagonalisation language L d is not recursively enumerable. L d is recursively enumerable but not recursive. 14. L u is recursively enumerable but not recursive. L u is not recursively enumerable. 15. The halting problem for Turing machine is recursively undecidable. 16. Every non trivial property of recursively enumerable language is undecidable. 17. The property of RE set whether L is empty is undecidable. 18. The property of RE set whether L is fnite is undecidable. 19. The property of RE set whether L is regular is undecidable. 20. The property of RE set whether L is context-free is undecidable. 21. The property of RE set whether L is non-empty is undecidable. 22. The property of RE set whether L is recursive is undecidable. 23. The property of RE set whether L is non-recursive is undecidable. 24. The property of RE set whether L is empty is undecidable. 25. The properties of recursively enumerable languages are not recursively enumerable. i) L= ii) L=* iii) L is recursive. iv) L is non recursive. v) L has only one string. vi) L is a regular set. 26. The properties of recursively enumerable languages are recursively enumerable. i) L ii) L contain at least eight members. iii) w is in L for some fxed w(membership problem). UNDECIDABILITY 27. If single NP-complete problem can be solved in polynomial time, then every NP-Complete problem has a polynomial time algorithm. Sorting, Graph searching or network fow are NP-Complete. 28. A decision problem is in P, class of polynomial time problem if it can be solved by a deterministic Turing machine in polynomial time in terms of size of its input. 29. A decision problem is in P if there is a deterministic Turing machine T that solves the decision problem and a polynomial p(n) such that for all integers n, T halts in a fnal state after no more than p(n) transitions, Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 7 whenever the input to T is a string of length n. 30. A decision problem is in NP, the class of non - deterministic polynomial -time problems, if it can be solved by a NDTM in polynomial time in terms of size of its input. A decision problem is in NP if there is a NDTM T that solved the problem and a polynomial p(n) such that for all integers n; T halts for every choice of transitions after no more than p(n) transitions whenever the input T is a string of length n. 31. Problem in P are called tractable, whereas problem not in P are called intractable. For a problem to be in P, a DTM must exist that can decide in polynomial time, whether a particular statement of the class addresses by decision problem is true. 32. Determining whether an item is in a list of n elements is tractable problem. 36. The problem of determining whether a positive integer n is prime is also tractable. 37. For a problem to be in NP, it is necessary only that there be a NDTM that, when given a true statement from a set of statements addressed by the problem, can verify its truth in polynomial time. 38. The problem of determining whether a given graph has a Hamilton circuit is an NP problem, because NDTM can easily verify that a simple circuit in a graph passes through each vertex exactly once. It can do this by making a series of correct guesses corresponding to successively adding edges to form the circuit. 39. Every DTM can also be considered to be NDTM where each (state, tape symbol) pair occurs in exactly one transitions rule defning the machine, every problem in P is also in NP. Hence P NP. 40. Whether every problem in NP is also in P, that is P = NP? Is undecidable. 41. There is a class of problem, class NP-Complete problem such that a problem is in this class if it is in the class NP and if it can be shown that if it is also in class P, then every problem in class NP must also be in class P. This is NP-Complete, if existence of a polynomial time algorithm for solving it implies the existence of a polynomial time algorithm for every problem in NP. 42. Determining whether a simple graph has a Hamiltonian circuit and determining whether a proposition in n-variables is a tautology are NP- Complete problem. 43. If a problem is NP-Complete, it is in NP. A problem in NP is polynomial time transformable to it. 44. Language L is polynomial time reducible to L if there is deterministic polynomial time reducible to L if there is a deterministic polynomial time bounded TM that for each input x produces an output y that is in L if and only if x is in L. 45. A Boolean expression is m variable, does there exist an assignment for Boolean variable, which makes the expression evaluates to 1? This is called Boolean satisfability problem. DATA STRUCTURES AND ALGORITHMS [ALGORITHM COMPLEXITY] Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 8 1. Mathematical Foundations: Monotonicity Monotonically increasing, if m<=n implies f(m) <=f(n). Similarly it is monotonically decreasing if m<=n implies f(m)>=f(n). a. If function f(n) is strictly decreasing if m<=n implies f(m) < f(n) and if f(m) is strictly decreasing if m<n implies f(m) > f(n). b. Floor and Ceil- For any real number x we denote the greatest integer less than or equal to x by x (read a foor of x) and least integer greater than or equal to x by x (read as ceil of x). For all real x, x- 1< x <=x<= x <x+1. For any integer n, 2 / n + 2 / n =n. 2. For any integer n and integer a0 and b0, The foor and ceil functions are monotonically increasing. 3. 1<logn<log 2 n<n<nlogn<n 2 <n3<2 n <n! 4. 1<logn<n (1/3) <n (7/4) <n<nlogn<(1.0000001) n <2 n <e n <n! 5. The running time of heapify on a node of height h is O(h). The worst case running time of heapify on a heap of size n is (log n). 6. Heap sort algorithm takes O(n log n) since call to build heap takes O(n) and each of n-1 calls to heapify takes time O(log n). 7. Tower of Hanoi Problem : M(n) = 2M(n-1) + 1, for n>1. M(n) = 2 n -1 = O(2 n ) 8. Fibonacci Series: F(n) = F(n-1) + F(n-2). F(1)=0,F(1)=.F(n) = O(2 n ) 9. Factorial: F(n) = n* F(n-1),n>0,F(0)=1.O(n) 10. Binary Search: T(n) = T(n/2) + 1.T(n) = O(log n) 11. Running time of tree traversal = O(n). n is no. of nodes in a tree. 12. Running time of linked list, stack, queue traversal and reversal is O(n) 13. Masters Theorem : Let T(n) be a monotonically increasing function that satisfes T(n) = a T(n/b) + f(n) T(1) = c. where a <= 1, b>= 2, c>0. If f(n) is (n d ) where d>=0 then 14. A tree with n node has exactly n-1 edges. 15. The maximum number of nodes on level I of a binary tree is 2 i , i<=0. 16. The maximum number of nodes in a binary tree of height h is 2 (h+1) -1. h>=1. 17. Relationship between number of leaf nodes and degree 2 node. For a non empty binary tree, if n 0 represent the number of leaf node and n 2 the number of nodes of degree 2, then n 0 =n 2 +1 18. Let T be binary tree with i levels .Then number of leaves is at most 2 (i-1) . 19. Let T be a binary tree. For every k>=0, there are no more then 2 k nodes in level k 20. Let T be a binary tree with i levels. Then T has no more than 2 i -1 nodes. 21. Let T be binary tree with N nodes. Then the no. of levels is at least ) 1 log( + N 22. Let T be binary tree with L leaves. Then the no. of levels is at least 1 ) log( + L 23. The number of nodes in a full binary tree of height h is 2 h+1 1 24. If n is the number of nodes in a complete binary tree (CBT) of height h, then 2 h <= n < 2 h+1 25. If a binary tree (BT) of height h has t leaves, then h >= lg t 26. The number of diferent trees with n nodes is 2 n n. 27. B-Tree: A node is full if it contain exactly (n-1) keys. A B-Tree of order m is a balanced search tree in which each non root node contains at least (m-1)/2 keys. 28. Each node of a B-Tree of order m contains a maximum of m-1 keys and m number of children. A B- Tree of order m is also called m (m-1) tree. 29. The degree say m of a B-Tree indicates that it has the minimum number of keys in a non-root (n-1)/2 and maximum number of children (n). 30. The minimum number of nodes keys at level 0,1,2,upto h of a B-Tree of order m. Assuming each node contain at least p number of keys p = (m-1)/2. The number of nodes 2(p+1) h-1 and the number of Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 9 keys 2p(p+1) h-1 The number of nodes and keys of a B-Tree of order m : Maximum no. of nodes is : Minimum no. of nodes is : Maximum no. of keys is : Minimum no. of keys is : SORTING SL.NO Algorithm Comparisons Best case Complexity Average case and Worst Case Characteristics 1. Bubble Sort T(n)=(n-1)+(n-2)+ . +1 = n(n-1)/2 O(n) O(n2) It is comparison based sorting. It is in place sorting method. It is stable sorting method 2. Insertion Sort n(n-1)/2 O(n) O(n2) 3. Selection Sort n(n-1)/2 O(n) O(n2) Performs O(n) swaps always (n- 1) no. of swaps . 4. Merge Sort List divided by 2 and compared O(n log n) O(n log n) Divide and Conquer sorting algorithm. Not in place sorting algorithm. T(n) = 2T(n/2) + cn 5. Heap Sort Build Heap, Perculate down/up to delete and again heapify O(n log n) O(n log n) It is in place sorting and it is stable algorithm. Using fnding next largest element takes O(Log n) time instead of O(n) in linear scan 6. Quick sort Choose pivot element and position it such that all elements in frst part is less than pivot and all elements in second part are greater than pivot. O(n log n) O(n log n) & O(n2). Best case: T(n) = 2T(n/2)+c n, n>1 Worst case: T(n)=T(n-1)+c n, n>1 Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 10 Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG 11 Mrs. G. Jayanthi., B. E (CSE)., M. Tech(Remote Sensing)., Asst. Professor/CSE C!"!# E$GG