UNIT I 9 Algorithm Analysis Time Space Tradeoff Asymptotic Notations Conditional asymptotic notation Removing condition from the conditional asymptotic notation - Properties of big-Oh notation Recurrence euations Solving recurrence euations Analysis of linear search! UNIT II 9 "ivide and Conuer# $eneral %ethod &inary Search 'inding %a(imum and %inimum %erge Sort $reedy Algorithms# $eneral %ethod Container )oading *napsac+ Problem! UNIT III 9 "ynamic Programming# $eneral %ethod %ultistage $raphs All-Pair shortest paths Optimal binary search trees ,-. *napsac+ Travelling salesperson problem ! UNIT IV 9 &ac+trac+ing# $eneral %ethod / 0ueens problem sum of subsets graph coloring 1amiltonian problem +napsac+ problem!
UNIT V 9 $raph Traversals Connected Components Spanning Trees &iconnected components &ranch and &ound# $eneral %ethods 2'3'O 4 )C5 ,-. *napsac+ problem 3ntroduction to NP-1ard and NP-Completeness!
TUTORIAL = 15 Total = 60 TEXT BOOK: .! 6llis 1oro7it89 Sarta: Sahni and Sanguthevar Ra:ase+aran9 Computer Algorithms- C;;9 Second 6dition9 <niversities Press9 =,,>! 2'or <nits 33 to ?5 =! *!S! 6as7ara+umar9 Ob:ect Oriented "ata Structures using C;;9 ?i+as Publishing 1ouse pvt! )td!9 =,,, 2'or <nit 35 REFERENCES: .! T! 1! Cormen9 C! 6! )eiserson9 R!)!Rivest9 and C! Stein9 @3ntroduction to Algorithms@9 Second 6dition9 Prentice 1all of 3ndia Pvt! )td9 =,,A! =! Alfred ?! Aho9 Bohn 6! 1opcroft and Beffrey "! <llman9 @The "esign and Analysis of Computer Algorithms@9 Pearson 6ducation9 .CCC! Welcoe to !"""#$%&'$(o#co) '*e+,cat'o$ CS--51 *.ESI/N AN. ANAL0SIS OF AL/ORIT12S UNIT 3I 1# W4at '% a$ Al5o6't47 2a89:,$e -006; No<9.ec -00= An algorithm is a seuence of unambiguous instructions for solving a problem9 i!e!9 for obtaining a reuired output for any legitimate input in a finite amount of time -# State t4e E,cl'+>% al5o6't4 (o6 ('$+'$5 /C. o( t"o 5'<e$ $,?e6%! A)$OR3T1% Euclid 2m9 n5 -- Computes gcd2m9n5 by 6uclidDs algorithm --3nput # T7o nonnegative9 not-both-8ero integers m and n --Output# $reatest common divisor of m and n 7hile n , do r m mod n m n n r return m! @# W4at a6e SeA,e$t'al Al5o6't4%7 The central assumption of the RA% model is that instructions are e(ecuted one after another9 one operation at a time! Accordingly9 algorithms designed to be e(ecuted on such machines are called Seuential algorithms! B# W4at a6e Ca6allel Al5o6't4%7 The central assumption of the RA% model does not hold for some ne7er computers that can e(ecute operations concurrently9 i!e!9 in parallel algorithms that ta+e advantage of this capability are called Parallel algorithms! 5# W4at '% EDact a$+ AEE6oD'at'o$ al5o6't47 The principal decision to choose solving the problem e(actly is called e(act algorithm! The principal decision to choose solving the problem appro(imately is called Appro(imation algorithm! 6# W4at '% Al5o6't4 .e%'5$ Tec4$'A,e7 No<9.ec -005 An algorithm design techniue is a general approach to solving problems algorithmically that is applicable to a variety of problems from different areas of computing! F# .e('$e C%e,+o co+e# A Pseudo code is a mi(ture of a natural language and programming language li+e constructs! A pseudo code is usually more precise than a natural language9 and its usage often yields more succinct algorithm descriptions! = =# .e('$e Flo"c4a6t# A method of e(pressing an algorithm by a collection of connected geometric shapes containing descriptions of the algorithmDs steps! 9# EDEla'$ Al5o6't4>% Co66ect$e%% To prove that the algorithm yields a reuired result for every legitimate input in a finite amount of time! 6(ample# Correctness of 6uclidDs algorithm for computing the greatest common divisor stems from correctness of the euality gcd 2m9 n5 E gcd 2n9 m mod n5! 10# W4at '% E(('c'e$c8 o( al5o6't47 6fficiency of an algorithm can be precisely defined and investigated 7ith mathematical rigor! There are t7o +inds of algorithm efficiency .5 Time 6fficiency 3ndicates ho7 fast the algorithm runs =5 Space 6fficiency 3ndicates ho7 much e(tra memory the algorithm needs! 11# W4at '% 5e$e6al't8 o( a$ al5o6't47 3t is a desirable characteristic of an algorithm! $enerality of the problem the algorithm solves is sometimes easier to design an algorithm for a problem posed in more general terms! 1-# W4at '% al5o6't4>% OEt'al't87 Optimality is about the comple(ity of the problem that algorithm solves! Fhat is the minimum amount of effort any algorithm 7ill need to e(ert to solve the problem in uestion is called algorithmDs Optimality! 1@# W4at +o 8o, ea$ ?8 So6t'$5G E6o?le7 The sorting problem as+s us to rearrange the items of a given list in ascending order 2or descending order5 1B# W4at +o 8o, ea$ ?8 Sea6c4'$5G E6o?le7 The searching problem deals 7ith finding a given value9 called a search +ey9 in a given set! 15# W4at +o 8o, ea$ ?8 Wo6%t ca%e*E(('c'e$c8G o( a$ al5o6't47 The Forst case-6fficiencyG of an algorithm is its efficiency for the 7orst-case input of si8e n9 7hich is an input 2or inputs5 of si8e n for 7hich the algorithm runs the longest among all possible inputs of that si8e! 6(# if you 7ant to sort a list of numbers in ascending order 7hen the numbers are given in descending order! 3n this running time 7ill be the longest! 16# W4at +o 8o, ea$ ?8 Be%t ca%e*E(('c'e$c8G o( a$ al5o6't47 The &est case-6fficiencyG of an algorithm is its efficiency for the &est-case input of si8e n9 7hich is an input2or inputs5 of si8e n for 7hich the algorithm runs the fastest among all possible inputs of that si8e! 6(# if you 7ant to sort a list of numbers in ascending order 7hen the numbers are given in ascending order! 3n this running time 7ill be the smallest! A 1F# .e('$e t4e A<e6a5e*ca%e e(('c'e$c8G o( a$ al5o6't47 The Average-case efficiencyG of an algorithm is its efficiency for the input of si8e n9 for 7hich the algorithm runs bet7een the best case and the 7orst case among all possible inputs of that si8e! 1=# W4at +o 8o, ea$ ?8 HAo6t'Ie+ e(('c'e$c8G7 The HAmorti8ed efficiencyG applies not only a single run of an algorithm but rather to a seuence of operations performed on the same data structure! 3t turns out that in some situations a single operation can be e(pensive 9but the total time for an entire seuence of n such operations is al7ays significantly better than the 7orst case efficiency of that single operation multiplied by n! This is +no7n as HAmorti8ed efficiencyG! 19# 1o" to ea%,6e t4e al5o6't4>% e(('c'e$c87 3t is logical to investigate the algorithmDs efficiency as a function of some parameter n indicating the algorithmDs input si8e! 6(ample# 3t 7ill be the si8e of the list for problems of sorting9 searching9 finding the listDs smallest element9 and most other problems dealing 7ith lists! -0# W4at '% calle+ t4e ?a%'c oEe6at'o$ o( a$ al5o6't47 The most important operation of the algorithm is the operation contributing the most to the total running time is called basic operation of an algorithm! -1# 1o" to ea%,6e a$ al5o6't4>% 6,$$'$5 t'e7 )et Cop be the time of e(ecution of an algorithmDs basic iteration on a particular computer and let C 2n5 be the number of times this operation needs to be e(ecuted for this algorithm! Then 7e can estimate the running time T2n5 of a program implementing this algorithm on that computer by the formula T2n5 I Cop C2n5 --# .e('$e o6+e6 o( 56o"t4# The efficiency analysis frame7or+ concentrates on the order of gro7th of an algorithmDs basic operation count as the principal indicator of the algorithmDs efficiency! To compare and ran+ such orders of gro7th 7e use three notations .5 O 2&ig oh5 notation =5 J 2&ig Omega5 notation 4 A5 K 2&ig Theta5 notation -@# .e('$e B'5 o4 $otat'o$ 2a89:,$e -006; AE6'l92a8 -00= A function t2n5 is said to be in O2g2n55 denoted t2n5 L O 2g2n559 if t2n5 is bounded above by some constant multiple of g2n5 for all large n9 i!e!9 if there e(ist some positive constant c and some non negative integer n, such that T 2n5 M c g 2n5 for n N n, -B# C6o<e t4at 100$J5 O !$ - )7 Clearly .,,n;O .,,n;n 2for all n O5 E .,.n.,.n = &y choosing n,EO and cE.,. 7e find that .,,n;OO 2n = 5! P -5# .e('$e K $otat'o$ A function t2n5 is said to be in J 2g2n559 denoted t2n5 J 2g2n559 if t2n5 is bounded belo7 by some positive constant multiple of g2n5 for all large n9 i!e!9 if there e(ist some positive constant c and some non negative integer n, such that T 2n5 M c g 2n5 for n N n, -6# C6o<e t4at $ @ !$ - )7 Clearly n A n = for all n ,! i!e!9 7e can select cE. and n,E,! -F# .e('$e L * $otat'o$ A function t2n5 is said to be in K2g2n559 denoted t2n5 K 2g2n559 if t2n5 is bounded both above and belo7 by some positive constant multiples of g2n5 for all large n9 i!e!9 if there e(ist some positive constant c. and c= and some non negative integer n, such that c= g 2n5 M t 2n5 M c. g2n5 for n N n, -=# C6o<e t4at! M)$!$*1) !$ - ) .-=n2n-.5E2.-=5n = -.-=n .-= n = for all n,!27e have proved upper ineuality5 no7 .-=n2n-.5E2.-=5n = -.-=n2.-=5n = -.-=nQ.-=n2for all n=5E.-P n = hence 7e can select c=E.-P9c.E.-= and n,E=! -9# W4at '% t4e ,%e o( A%8Etot'c Notat'o$%7 The notations O9 and and are used to indicate and compare the asymptotic orders of gro7th of functions e(pressing algorithm efficiencies! UNIT II 1) EDEla'$ +'<'+e a$+ co$A,e6 al5o6't4% "ivide and conuer is probably the best +no7n general algorithm design techniue! 3t 7or+ according to the follo7ing general plan i5A problemRs instance is divided into several smaller instances of the same problem9 ideally of about the same si8e! ii5 The smaller instances are solved iii5 3f necessary9 the solutions obtained for the smaller instances are combined to get a solution to the original problem -) .e('$e 2e65e So6t %erge sort is a perfect e(ample of a successful application of the divide and conuer techniue! 3t sorts a given array AS,!!!n-lT by dividing it into t7o halves AS,!!!Sn-=T - .T and ASSn-=T!!!!n-lT9 sorting each of them recursively9 and then merging the t7o smaller sorted arrays into a single sorted one! @) .e('$e B'$a68 Sea6c4 &inary Search is remar+ably efficient algorithm for searching in a sorted array! 3t 7or+s by comparing a search +ey * 7ith the arrayRs middle element ASmT! 3f they match9 the algorithm O stopsU Other7ise9 the same operation is repeated recursively for the first half of the array if *M ASmT and for the second half if * N ASmT AS,T!!!!!!!!!!!!!ASm-lT ASmT ASm;lT!!!!!!!!!!!!! ASn-lT B) W4at ca$ "e %a8 a?o,t t4e a<e6a5e ca%e e(('c'e$c8 o( ?'$a68 %ea6c47 A sophisticated analysis sho7s that the average number of +ey comparisons made by binary search is only slightly smaller than that in the 7orst case Cavg2n5 log=n 5) .e('$e B'$a68 T6ee A binary tree T is defined as a finite set of nodes that is either empty or consists of s root and t7o dis:oint binary trees T)9 and TR called9 respectively the left and right subtree of the root! 6) 1o" +'<'+e a$+ co$A,e6 tec4$'A,e ca$ ?e aEEl'e+ to ?'$a68 t6ee%7 Since the binary tree definition itself divides a binary tree into t7o smaller structures of the same type9 the left subtree and the right subtree9 many problems about binary trees can be solved by applying the divide-conuer techniue! F) EDEla'$ I$te6$al a$+ EDte6$al No+e% To dra7 the treeRs e(tension by replacing the empty subtrees by special nodes!The e(tra nodes sho7n by little suares are called e(ternal! The original nodes sho7n by littile circles are called internal! =) .e('$e C6eo6+e6; '$o6+e6 a$+ Eo%to6+e6 T6a<e6%al PR6OR"6R -The root is visited before the left and right subtrees are visited 2in that order5 3NOR"6R -The root is visited after visiting its left subtree but before visiting the right Subtree POSTOR"6R - The root is visited after visiting the left and right subtrees2in that order5 9) .e('$e t4e I$te6$al Cat4 Le$5t4 The 3nternal Path )ength 3 of an e(tended binary tree is defined as the sum of the lengths of the paths - ta+en over all internal nodes- from the root to each internal node! 10) .e('$e t4e EDte6$al Cat4 Le$5t4 The 6(ternal Path )ength 6 of an e(tended binary tree is defined as the sum of the lengths of the paths - ta+en over all e(ternal nodes- from the root to each e(ternal node! 11) EDEla'$ a?o,t 56ee+8 tec4$'A,e The greedy techniue suggests constructing a solution to an optimi8ation problem through a seuence of steps9 each e(panding a partially constructed solution obtained so far9 until a complete solution to the problem is reached! On each step9 the choice made must be feasible, locally optimal and irrevocable. 1-) .e('$e SEa$$'$5 T6ee A Spanning Tree of a connected graph is its connected acyclic subgraph2i!e!9 a tree5 that contains all the vertices of the graph! 1@) .e('$e 2'$', SEa$$'$5 T6ee A minimum spanning tree of a 7eighted connected graph is its spanning tree of the smallest 7eight 97here the 7eight of a tree is defined as the sum of the 7eights on all its edges! V 1B) .e('$e '$*4eaE A min-heap is a complete binary tree in 7hich every element is less than or eual to its children! All the principal properties of heaps remain valid for min-heaps9 7ith some obvious modifications! 15) .e('$e K6,%&alN% Al5o6't4 *rus+alRs algorithm loo+s at a minimum spanning tree for a 7eighted connected graph $ E2?965 as an acyclic subgraph 7ith W ?W - . edges for 7hich the sum of the edge 7eights is the smallest! 16) .e('$e C6'N% Al5o6't4 PrimRs algorithm is a greedy algorithm for constructing a minimum spanning tree of a 7eighted connected graph!3t 7or+s by attaching to a previously constructed subtree a verte( to the vertices already in the tree! 1F) EDEla'$ .'O&%t6aN% Al5o6't4 "i:+straRs algorithm solves the single - source shortest - path problem of finding shortest paths from a given verte( 2the source5 to all the other vertices of a 7eighted graph or digraph! 3t 7or+s as primRs algorithm but compares path lengths rather than edge lengths! "i:+straRs algorithm al7ays yields a correct solution for a graph 7ith nonnegative 7eights! UNIT III 1).e('$e .8$a'c C6o56a'$5 "ynamic programming is a techniue for solving problems 7ith overlapping problems! Typically9 these subproblems arise from a recurrence relating a solution to a given problem 7ith solutions to its smaller subproblems of the same type! Rather than solving overlapping subproblems again and again9 dynamic programming suggests solving each of the smaller sub problems only once and recording the results in a table from 7hich 7e can then obtain a solution to the original problem! -) .e('$e B'$o'al Coe(('c'e$t n The &inomial Coefficient9 denoted C2n9+5 or + is the number of Combinations2subsets5 of + elements from an n-element set2,M+Mn5! The name @binomial coefficients@ comes from the participation of these numbers in the so called binomial formula 2a;b5 n E2n9,5a n ;!!!!!!!!!!;C2n9i5a n-i b i ;!!!!!!!;C2n9n5b n @) .e('$e T6a$%'t'<e clo%,6e The transitive closure of a directed graph 7ith n vertices can be defined as the n by n &oolean matri( T E Xti9Y9 in 7hich the element in the i th ro7 2.MiMn5 and the : th column 2lM:Mn5 is . if there e(ists a non trivial directed path from the i th verte( to : th verte( U other7ise 9 ti: is ,! B) EDEla'$ Wa6%4all% al5o6't4 FarshallRs algorithm constructs the transitive closure of a given digraph 7ith n vertices through a series of n by n &oolean matrices R 2,5 9 ZZZ9 R 2+-l5 R 2+5 9ZZ!!9 R 2n5 > 6ach of these matrices provides certain information about directed paths in the digraph! B) EDEla'$ All*Ea'6 %4o6te%t*Eat4% E6o?le $iven a 7eighted connected graph 2undirected or directed59 the all pairs shortest paths problem as+s to find the distances2the lengths of the shortest path5 from each verte( to all other vertices! 5) EDEla'$ Flo8+N% al5o6't4 3t is convenient to record the lengths of shortest paths in an n by n matri( " called the distance matri(# the element di: in the i th ro7 and the :th column of this matri( indicates the length of the shortest path from the i th verte( to the : th verte( ! Fe can generate the distance matri( 7ith an algorithm that is very similar to 7arshallRs algorithm! 3t is called 'loydRs algorithm! 6) W4at +oe% Flo8+>% al5o6't4 +o7 3t is used to find the distances 2the lengths of the shortest paths5 from each verte( to all other vertices of a 7eighted connected graph! F) EDEla'$ E6'$c'Ele o( OEt'al't8 3t says that an optimal solution to any instance of an optimi8ation problem is composed of optimal solutions to its subinstances! =) EDEla'$ OEt'al B'$a68 Sea6c4 T6ee% One of the principal application of &inary Search Tree is to implement the operation of searching! 3f probabilities of searching for elements of a set are +no7n9 it is natural to pose a uestion about an optimal binary search tree for 7hich the average number of comparisons in a search is the smallest possible! 9) EDEla'$ K$aE%ac& E6o?le $iven n items of +no7n 7eights 7.97=!!!!!!!!!!!7n and values v.9v=!!!!!!!!!!!!vn and a +napsac+ of capacity F9 find the most valuable subset of the items that fit into the +napsac+!2Assuming all the 7eights and the +napsac+Rs capacity are positive integers the item values do not have to be integers!5 10) EDEla'$ t4e 2eo68 F,$ct'o$ tec4$'A,e The %emory 'unction techniue see+s to combine strengths of the top do7n and bottom- up approaches to solving problems 7ith overlapping subproblems! 3t does this by solving9 in the top-do7n fashion but only once9 :ust necessary sub problems of a given problem and recording their solutions in a table! 11) EDEla'$ T6a<el'$5 %ale%a$ E6o?leG7 A salesman has to travel n cities starting from any one of the cities and visit the remaining cities e(actly once and come bac+ to the city 7here he started his :ourney in such a manner that either the distance is minimum or cost is minimum! This is +no7n as traveling salesman problem! UNIT IV l) EDEla'$ Bac&t6ac&'$5 / The principal idea is to construct solutions one component at a time and evaluate such partially constructed candidates as follo7s! N 3f a partially constructed solution can be developed further 7ithout violating the problemRs constraints9 it is done by ta+ing the first remaininig legitimate option for the ne(t component! N 3f there is no legitimate option for the ne(t component9 no alternatives for any remaining component need to be considered! 3n this case9 the algorithm bac+trac+s to replace the last component of the partially constructed solution 7ith its ne(t option
-) EDEla'$ State SEace T6ee 3f it is convenient to implement bac+trac+ing by constructing a tree of choices being made9 the tree is called a state space tree! 3ts root represents an initial state before the search for a solution begins! @) EDEla'$ E6o'%'$5 a$+ $o$E6o'%'$5 $o+e A node in a state space tree is said to be promising if it corresponds to a partially constructed solution that may still lead to a complete solutionUother7ise it is called nonpromising B) EDEla'$ $*P,ee$% E6o?le The problem is to place n ueens on an n by n chessboard so that no t7o ueens attac+ each other by being in the same ro7 or same column or on the same diagonal! 5) EDEla'$ S,?%et*S, C6o?le Fe consider the subset-sum problem# 'ind a subset of a given set SEXS.9S=9!!!!!!!!!!SnY of n positive integers 7hose sum is eual to a given positive integer d! 6) EDEla'$ B6a$c4 a$+ Bo,$+ Tec4$'A,e Compared to bac+trac+ing9 branch and bound reuires The idea to be strengthened further if 7e deal 7ith an optimi8ation problem9 one that see+s to minimi8e or ma(imi8e an ob:ective function9 usually sub:ect to some constraints! F) .e('$e Fea%'?le Sol,t'o$ A feasible solution is a point in the problemRs search space that satisfies all the problemRs constraints! 6(# A 1amiltonian Circuit in the traveling salesman problem! A subset of items 7hose total 7eight does not e(ceed the +napsac+Rs Capacity =) .e('$e OEt'al %ol,t'o$ 3s a feasible solution 7ith the best value of the ob:ective function 6g# The shortest 1amiltonian Circuit The most valuable subset of items that fit the +napsac+ 9)2e$t'o$ t"o 6ea%o$% to te6'$ate a %ea6c4 Eat4 at t4e c,66e$t $o+e '$ a %tate*%Eace t6ee o( a ?6a$c4 a$+ ?o,$+ al5o6't4# The value of the nodeRs bound is not better than the value of the best solution seen so far! The node represents no feasible solutions because the constraints of the problem are already violated! 10) EDEla'$ /6aE4 colo6'$5G E6o?le# C The graph coloring problem as+s us to assign the smallest number of colors to vertices of a graph so that no t7o ad:acent vertices are the same color! 11) EDEla'$ K$aE%ac& C6o?le 'ind the most valuable subset of n items of given positive integer 7eights and values that fit into a +napsac+ of a given positive integer capacity! UNIT V 1) .e('$e t6acta?le a$+ '$t6acta?le E6o?le% Problems that can be solved in polynomial time are called tractable problems9 problems that cannot be solved in polynomial time are called intractable problems! -) EDEla'$ t4e t4eo68 o( coE,tat'o$al coEleD't8 A problemRs intractability remains the same for all principal models of computations and all reasonable input encoding schemes for the problem under consideration @)EDEla'$ cla%% C E6o?le% Class P is a class of decision problems that can be solved in polynomial time by2deterministic5 algorithms! This class of problems is called polynomial! B)EDEla'$ ,$+ec'+a?le E6o?le% 3f the decision problem cannot be solved in polynomial time9 and if the decision problems cannot be solved at all by any algorithm! Such problems are called <ndecidable! 5) EDEla'$ t4e 4alt'$5 E6o?le $iven a computer program and an input to it9determine 7hether the program 7ill halt on that input or continue 7or+ing indefinitely on it! 6) EDEla'$ cla%% NC E6o?le% Class NP is the class of decision problems that can be solved by nondeterministic polynomial algorithms!%ost decision problems are in NP! 'irst of all9 this class includes all the problems in P! This class of problems is called Nondeterministic polynomial! F)EDEla'$ NC*coElete E6o?le% A decision problem d is said to be NP-complete if .5 it belongs to class NP =5 every problem in NP is polynomially reducible to "! =)W4e$ a +ec'%'o$ E6o?le '% %a'+ to ?e Eol8$o'all8 6e+,c'?le A decision problem "l is said to be polynomially reducible to a decision problem "= if there e(ists a function t that transforms instances of "l to instances of"= such that i5 t maps all yes instances of d. to yes instances odf d= and all no instances of dl to no instances ofd= ii5 t is computable by a polynomial time algorithm 9) .e('$e a 1e,6'%t'c ., A heuristic is a common-sense rule dra7n from e(perience rather than from a mathematically proved assertion! 6(# $oing to the nearest unvisited city in the traveling salesman problem is a good illustration for 1euristic 10) EDEla'$ NC*1a6+ E6o?le% The notion of an NP-hard problem can be defined more formally by e(tending the notion of polynomial reducability to problems that are not necessary in class NP including optimi8ation problems! 11).e('$e T6a<e6%al%# Fhen the search necessarilyinvolves the e(amination of every verte( in the ob:ect being searched it is called a traversal! 1-)L'%t o,t t4e tec4$'A,e% (o6 t6a<e6%al% '$ 56aE4# &readth first search "epth first search 1@)W4at '% a6t'c,lat'o$ Eo'$t# A verte( v in a connected graph $ is an articulation point if and only if the deletion of verte( v together 7ith all edged incident to v disconnects the graph in to t7o or more nonempty components! CART*B I*UNIT .! 2a5 "escribe the steps in analy8ing 4 coding an algorithm! 2.,5 2b5 6(plain some of the problem types used in the design of algorithm! 2V5 =!2a5 "iscuss the fundamentals of analysis frame7or+ ! 2.,5 2b5 6(plain the various asymptotic notations used in algorithm design! 2V5 A! 2a5 6(plain the general frame7or+ for analy8ing the efficiency of algorithm! 2/5 2b5 6(plain the various Asymptotic efficiencies of an algorithm! 2/5 P! 2a5 6(plain the basic efficiency classes! 2.,5 2b5 6(plain briefly the concept of algorithmic strategies! 2V5 O! "escribe briefly the notions of comple(ity of an algorithm! 2.V5 V! 2a5 Fhat is Pseudo-code[6(plain 7ith an e(ample! 2/5 2b5 'ind the comple(ity C2n5 of the algorithm for the 7orst case9best case and average case!26valuate average case comple(ity for nEA9Fhere n is the number of inputs5 2/5 >! Set up 4 solve a recurrence relation for the number of +ey comparisons made by above pseudo code! 2P5 II*UNIT .. .5 Frite a pseudo code for divide 4 conuer algorithm for merging t7o sorted arrays in to a single sorted one!6(plain 7ith e(ample! 2.=5 =5 Construct a minimum spanning tree using *rus+alDs algorithm 7ith your o7n e(ample! 2.,5 A5 6(plain about *napsac+ Problem 7ith e(ample P5 6(plain "i:i+stra algorithm 2/5 O5 "efine Spanning tree!"iscuss design steps in PrimDs algorithm to construct minimum spanning tree 7ith an e(ample! 2.V5 V56(plain *rus+alDs algorithm! 2/5 >5 6(plain about binary search 7ith e(ample! III*UNIT .5 Solve the all pair shortest path problem for the diagraph 7ith the 7eighted matri( given belo7#- a b c d a , \ A \ b = , \ \ c \ > , . d V \ \ ,2.V5 =5 6(plain FarshallDs 4 'loydDs Algorithm! 2.V5 A5 6(plain about %ultistage graphs 7ith e(ample! P5 "efine optimal binary search trees 7ith e(ample! O5 6(plain ,-. +napsac+ problem 7ith e(ample! V5 "iscuss the solution for Travelling salesman problem using branch 4 bound techniue! 2.V5 VI*UNIT .! 6(plain the /-0ueenDs problem 4 discuss the possible solutions! 2.V5 =! Solve the follo7ing instance of the +napsac+ problem by the branch 4 bound algorithm! 2.V5 A! Apply bac+trac+ing techniue to solve the follo7ing instance of subset sum problem # SEX.9A9P9OY and dE.. 2.V5 O! 6(plain subset sum problem 4 discuss the possible solution strategies using bac+trac+ing!2.V5 V! 6(plain $raph coloring 7ith e(ample! >! 6(plain about *napsac+ Problem using bac+ trac+ing 7ith e(ample! V*UNIT .! $ive a suitable e(ample 4 e(plain the &readth first search 4 "epth first search! 2.V5 =! 6(plain about biconnected components 7ith e(ample! A! &riefly e(plain NP-1ard and NP-Completeness 7ith e(amples! P! 6(plain about ,-. *napsac+ Problem using branch and bound 7ith e(ample! .=