A Generalized Set Theoretic Approach for Time and Space Complexity Analysis of Algorithms and Functions
|
|
- Deirdre Evans
- 5 years ago
- Views:
Transcription
1 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, A Geeralized Set Theoretic Approach for Time ad Space Complexity Aalysis of Algorithms ad Fuctios AHMED TAREK Easter Ketucky Uiversity Departmet of Computer Sciece 407, Wallace Buildig, 521 Lacaster Aveue, Richmod, Ketucky UNITED STATES OF AMERICA Abstract: There exists a variety of techiques for aalyzig the computatioal complexity of algorithms ad fuctios. This aalysis is critical i fidig out the upper ad the lower bouds o time ad space requiremets usig the big-oh ad the big-omega otatios. Besides these, there are other complexity criteria, such as, small omega ad small o complexities, which are also useful. Complexity aalysis is used i selectig a appropriate algorithm for solvig a give problem usig computer. Ufortuately, most of the existig techiques are complex, obsolete ad hard to use i practice. Besides, there is a tred to abuse otatioal complexities by cosiderig them as fuctios. However, otatioal complexities are sets of fuctios rather tha bare fuctios. I this paper, it has bee established that the otatioal complexities are sets of fuctios that iclude all algorithms ad fuctios o the give order satisfyig certai costraits. Moreover, startig from the scratch, we show how to determie the time ad space complexity fuctios for a give computatioal algorithm. We cosider applicatio of the proposed framework i determiig the otatioal complexities. The proposed framework may be exteded for fuctios ivolvig multiple variables. Also the space-time badwidth product has bee discussed i decidig the ecoomy of usig the computatioal algorithms. Key Words: Time complexity, Space complexity, Complexity fuctio, Complexity order, Asymptotic aalysis, Performace aalysis, Performace measuremet, Space-time badwidth product. 1 Itroductio Computatio time ad memory space requiremets are the major decidig factors i computerized implemetatio of computatioal algorithms. The performace of a algorithm or a fuctio depeds o iteral ad exteral factors. The iteral factors are related to the algorithm s efficiecy i terms of time ad memory space usage. There are a umber of exteral factors, which vary from platform to platform ad from software to software. Computatioal complexity of algorithms are depedet o iteral factors. We will cosider oly the time ad space complexity of algorithms ad fuctios. I geeral, time is more crucial tha space requiremet. We do ot determie the actual umber of CPU cycles or eve wat to cout every istructio executed i aalyzig algorithms. The big-o otatioal complexity is itroduced for this. Big-O complexity is idepedet of the hardware ad software used. Hece, it is also called the big-o estimate. It shows the growth of time ad space with the icreasig problem size without takig care of the costat coefficiets or smaller order terms. Sometimes, we ca prove that we caot compute somethig without a sufficiet amout of time or space. This does ot mea that we kow how to compute it i this lower boud. This provides us the Ω otatioal complexity. Similarly, ω ad small o complexities are used without tight lower ad upper bouds. To determie whether a fuctio lies at the set itersectio of big-o ad Ω complexities, the Θ otatioal complexity is used. All the otatioal complexities are idepedet of hardware ad software used for the implemetatio. For estimatig the space-time trade-off i implemetig a algorithm, we have itroduced the otio of cost fuctio, C(). The fuctio C() is sometimes called the space-time badwidth product, which is expressed as the product betwee g 1 () ad g 2 (), where the big-oh time complexity is O(g 1 ()) ad the space complexity is O(g 2 ()). Sectio 2 itroduces termiology ad otatio used throughout this paper. Sectio 3 explais the eed for asymptotic complexity i complexity aalysis. Differet otatioal complexities, their defiitios ad examples are also cosidered. The relatioship amog the otatioal complexities are discussed. Sec-
2 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, tio 4 treats the set theoretic properties related to complexity aalysis. Sectio 5 discusses complexity criteria, ad itroduces the complexity class hierarchy usig graphs ad charts. Sectio 6 elaborates o guidelies i determiig the complexity fuctios. Sectio 7 cosiders a geeral framework i estimatig the time ad space complexities. The framework is exteded for multi-variable fuctios ad fractioal expressios, which may also be applied to the additio, ad multiplicatio of fuctios. Sectio 8 cosiders performace aalysis i space complexity. We have also cosidered the space-time badwidth product with examples. Sectio 9 discusses performace measuremet i time complexity. Sectio 10 is applicatio of space ad time complexity i combiatorial explosio ad AI. 2 Termiology ad Notatio I this paper, followig otatios are used to discuss the proposed framework ad applicatios. : Iput size. g(): Highest ordered term i modified complexity fuctio. f(): Complexity fuctio for a problem of size. f( 1, 2,..., m ): Complexity fuctio ivolvig m differet variables. Here, m = 1, 2,.... f(): Modified complexity fuctio obtaied by elimiatig the costat coefficiets from the complexity fuctio f(). f( 1, 2,..., m ): The modified complexity fuctio obtaied by removig the costat coefficiets from the origial fuctio f( 1, 2,..., m ). g( 1, 2,..., m ): The highest order term i the expressio for f( 1, 2,..., m ). O(g()): Big-oh complexity for a algorithm or a fuctio with a problem of size. O(g( 1, 2,..., m )): Big-oh complexity for a algorithm or a fuctio ivolvig m differet parameters. Here, m = 1, 2,.... Ω(g()): Big-omega complexity for a algorithm or a fuctio with a problem of size. Θ(g()): Cap-theta complexity for a algorithm or a fuctio with iput size. o(g()): Small o complexity for a algorithm or a fuctio with a problem of size. ω(g()): Small omega complexity for a algorithm or a fuctio with a problem of size. C(): Space-time badwidth product ivolvig the highest order terms i the time ad space complexity fuctios without coefficiets for a iput of size. 3 Asymptotic Complexity The eed for asymptotic complexity may best be explaied usig a example. Cosider the complexity fuctio, f()= The costat coefficiets i this fuctio may reflect implemetatio details. The lower order terms become isigificat with icreasig iput size as show i Table 1. Table 1: Effect of the highest order term with icreasig problem size ,000 1, ,000,000 14, ,000, ,017 As the iput size grows bigger ad bigger, the algorithmic performace coverges to the highest order term. Followig table verifies this fact. Table 2: As the iput size becomes larger ad larger, the umerator coverges to the highest order term, which is same as the deomiator, ad the ratio coverges to 1 asymptotically , , ,000 50,000,000 50,025, Hece, the complexity fuctio asymptotically approaches the highest order term as the problem size grows. Followig are the asymptotic defiitios of O ad Ω otatioal complexities. A complexity fuctio f() is O(g()) if there exist positive costats c ad 0 such that f() c g() for all 0. O(g()) is a set of fuctios, which ca be formally represeted as follows: O(g()) = {f() positive costats c ad 0 such that f() c g() 0.} (1)
3 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, A more precise ad exact defiitio of the O- otatioal complexity follows [3]: Defiitio 1 If f ad g are fuctios o the size of a give problem, or the set of parameters 1, 2,..., m, m = 1, 2,... ivolved, the f() is O(g()), or f( 1, 2,..., m ) is O(g( 1, 2,..., m )) provided there exists costats c, ad 0 such that: f() c g(), wheever 0 or f( 1, 2,..., m ) c g( 1, 2,..., m ), wheever each of 1, 2,..., m 0. Here, 0 represets the threshold value for the big-oh otatioal aalysis to hold true. Similarly, Ω otatio is used to defie the asymptotic lower boud. A complexity fuctio f() is Ω (g()) if there exists positive costats c ad 0 such that 0 c g() f() for all 0. Ω (g()) is also a set of fuctios, for which, formal represetatio follows: Ω(g()) = {f() positive costats c ad 0 such that f() c g() 0.} (2) The Θ otatioal complexity represets a set of fuctios that lies at the itersectio of O(g()) ad Ω(g()). A complexity fuctio f() Θ(g()) provided that f() O(g()) ad also, f() Ω(g()). Formally, the Θ otatioal complexity may be defied as follows: Θ(g()) = {f() positive costats c 1, c 2, 0 such that c 1 g() f() c 2 g() 0.} (3) Usig set theoretic otatio: Θ(g()) = O(g()) Ω(g()). Example: Cosider the followig set of fuctios, which are o the order of O( 2 ). O( 2 ) = { 4lg() + 5, 5 + 7, 3lg() + 4, 8 2, , } Next cosider the followig set of fuctios, for which, Ω ( 2 ) defies the lower boud. Ω( 2 ) = { 8 2, , , , } Now Θ( 2 ) defies the set of fuctios that lies at the itersectio of O( 2 ) ad Ω( 2 ). Therefore, Θ( 2 ) = O( 2 ) Ω( 2 ) = {8 2, , }. We may defie o ad ω asymptotic complexities for those fuctios for which the upper ad lower bouds are ot tight. A fuctio f() is said to be o(g()), provided there exists positive costats c ad 0 such that for ay positive costat c ad for all iput sizes 0, the f() < c g() relatioship holds. Followig defies the set o(g()) formally usig the set theoretic otatios. o(g()) = {f() positive costats c ad 0 such that f() < c g(), 0 ad c.} (4) Sice the fuctio f() strictly satisfies f() < c g(), with the icreasig iput size, g() grows bigger ad bigger compared to f(), ad evetually, for large iput values, the asymptotic limit of the ratio betwee f() ad g() approaches 0. Stated mathematically, Lim ( )( f() g() ) = 0 (5) A fuctio f() is ω(g()), if there exists positive costats c ad 0 such that for positive costat c ad for all iput sizes 0, the relatioship f() > c g() holds true. Followig provides the formal defiitio of ω(g()). ω(g()) = {f() positive costats c ad 0 such that f() > c g(), 0 ad c.} (6) To be a member of the set ω(g(), f() has to be strictly greater tha the product c g(). Therefore, with icreasig values of, f() grows much bigger compared to the fuctio g(). Evetually, for very large values of, the ratio g() f() becomes egligible for the asymptotic case. Followig coditio holds true. Lim ( )( g() f() ) = 0 (7) Examples: The fuctio f() = 2 is O( 3 ), sice , ad the highest order fuctio becomes g() = 3. But there is o positive real costat c such that: 2 c 3. Therefore, 2 Ω( 3 ). Hece, 2 (O( 3 ) Ω( 3 )). Cosider aother fuctio f() = Sice, <= 7, hece for all 1, f() O(). Agai, f() = , for all 1. Hece, f() Ω(). Usig the defiitio of Θ(), f() Θ(). Now, for all 1. Therefore, f() O( 2 ). Similarly, f() O( 3 ), f() O( 4 ), ad so. Therefore, O( 2 ), O( 3 ),... may always weake the asymptotic upper boud. Similarly, log() for all 1, ad f() Ω(log()). Also, or for all 1, ad f() Ω(1). Therefore, Ω(log()), Ω(1) may always weake the asymptotic lower boud. Give a positive costat c, 3 c for all but small itegers. Therefore, 3 Ω(). But it is impossible to fid a positive costat c such that for higher values of, 3 c. Hece, 3 O(). Give a positive c, log() c 7 for sufficietly
4 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, large values of. Therefore, log() Ω( 7 ). However, log() O( 7 ). Therefore, log() (Ω( 7 ) O( 7 )). Next cosider f() = 3+16 for o() ad ω(). Now, o(), ad also ω(). For to be o(), the relatioship < c must hold for all positive costats c ad ay iput size 0. However, < c fails for may positive costats c. Therefore, 3+16 o(). Similarly, > c fails for may positive costats c. Hece, ω(). However, < c log() is always true beyod the cutoff iput size 0, ad for all real positive costats c. Therefore, f() = o(log()). Similarly, 3+16 o( 2 ), ad so. Agai, 3+16 > c log() for all real positive costats c beyod a certai iput size 0. Hece, ω(log()). Similarly, ω(1). If we are posed with the problem of verifyig whether 1 log o(1), we may solve it usig the limitig approach. I this case, f() = 1 log, ad g() = 1. Thus, f() g() = 1 1 log = 1 log ad 1 log. As, log 0. By defiitio, (Lim )( f() g() ) eeds to be 0 for f() o(g()). Hece, 1 log o(1). 4 Set Theory i Complexity Aalysis Lemma 2 If positive costats c ad 0, such that 0, the a set of fuctios {f()} maps o to a set S(g()) of fuctios g() usig the set membership, where S {O, Ω, o, ω, Θ}, ad S deotes a otatioal complexity the otatio of which depeds o the relatio R i f() R c g(). Here, R is a relatio from the set {f()} to the set {c g()}, where R {, >,, <, =}, ad is a subset of the cartesia product betwee the sets {f()} ad {c g()}. Proof: We prove this lemma usig proof by cases. R is : f() c g(), ad f() Ω(g()). R is : Here, f() c g(), ad f() O(g()). R is >: I this case f() > c g(), ad f() ω(g()). R is <: I this case f() < c g(), ad f() o(g()). R is =: I this case f() = c g(), ad f() Θ(g()). I all five of the cases, f() S(g()), where the exact otio of S will deped o the relatio R betwee {f()} ad {c g()}. We already kow that O, Ω, o, ω ad Θ otatioal complexities are sets rather tha fuctios. However, it is a commo practice to abuse complexity otatios, such as writig f() = O(g()) istead of f() O(g()). Also, the expressios such as f() = h() + O(g()) are quite commo. But a fuctio caot be added to a set like this, ad i o way a fuctio could be equal to a set. Therefore, it is more appropriate to write: f() O(h() + g()). fuc() g() f() h() Figure 1: Notatioal complexities bear complimetary characteristics. From Figure 1, fuctio g() defies the upper boud for f() wheever 0. Therefore, f() O(g()). Stated i aother way, the fuctio f() defies the lower boud for the fuctio g(). Hece, g() Ω(f()). The figure also shows that the fuctio h() defies the lower boud of f(), ad f() Ω(h()). Therefore, the fuctio f() must defie the upper boud to the fuctio h() ad h() O(f()). Therefore, the otatioal complexity relatioship betwee a give fuctio ad its boudig fuctio is complimetary ad preserves reciprocity. Followig result is true. Theorem 3 If for a give fuctio f(), if f() O(g()), the g() Ω(f()), ad vice-versa. Proof: Sice f() O(g()), therefore, there exists positive costats c ad 0 such that for all 0, f() c g(). This meas, 1 c f() g(). 1 Deote the positive costat c by c 1. Therefore, g() c 1 f(). Hece, g() Ω(f()). 5 Complexity Criteria Followig hierarchical relatioship forms a basis for determiig the otatioal complexity order for fuctios ad expressios [3]. 1 < log b < < log b < 2 < 3 <... < k < 2 < c <!
5 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, Here, k ad c are positive costats, ad b is a positive iteger defiig the base of the logarithmic fuctios. This hierarchical relatioship is kow as the complexity class. I terms of set theory: O(1) O(log b ) O() O(log b ) O( 2 ) O( 3 )... O( k ) O(2 ) O(c ) O(!) (8) The above equatio (8) holds true also for the o otatioal complexity class hierarchy. Similarly, the complexity class hierarchy for the Ω otatioal complexity becomes: Ω(1) Ω(log b ) Ω() Ω(log b ) Ω( 2 ) Ω( 3 )... Ω( k ) Ω(2 ) Ω(c ) Ω(!) (9) Equatio (9) is also applicable for the ω otatioal complexity class hierarchy. From these hierarchical relatioships, followig result follows. Θ(log b ) Θ() Θ(log b ) Θ( 2 ) Θ( 3 )... Θ( k ) Θ(2 ) Θ(c ) Θ(!) = {} Proceedig this way, it is possible to show that: Θ(c ) Θ(!) = {}, where { } deotes the empty set. Figure 2 illustrates complexity class hierarchy. Before 0, the hierarchy does ot hold. We discard iput values smaller tha 0. Beyod the iput size 0, the fuctios preserve the complexity class hierarchy. f() f() = 3 f() = 3 f() = 2 f() = log() Lemma 4 For Θ otatioal complexity, followig results hold true. Cosider iputs here f() = f() = log () Θ(1) Θ(log b ) Θ() Θ(log b ) Θ( 2 ) Θ( 3 )... Θ( k ) Θ(2 ) discard iputs here = 0 (cut-off iput size) Θ(c ) Θ(!) = {} Θ(log b ) Θ() Θ(log b ) Θ( 2 ) Θ( 3 )... Θ( k ) Θ(2 ) Here, { } deotes a empty set. Θ(c ) Θ(!) = {}. Θ(c ) Θ(!) = {} (10) Proof: Cosider a fuctio f 1 () with iput size. Suppose that f() Θ(1). I this case, f 1 () O(1) ad also, f 1 () Ω(1). Usig the defiitio of O-complexity, f 1 () O(log b ), f 1 () O(), ad so o. However, f 1 () Ω(1) ad f 1 () Ω(log b ), f 1 () Ω(), ad so o. These two relatioships hold true for ay such fuctio f(). Therefore, Θ(1) Θ(log b ) Θ() Θ(log b ) Θ( 2 ) Θ( 3 )... Θ( k ) Θ(2 ) Θ(c ) Θ(!) = {}. Next cosider aother fuctio f 2 () such that: f 2 () Θ(log b ). Therefore, f 2 () O(), f 2 () O(log b ), ad so o. But f 2 () Ω(), f 2 () Ω(log b ), ad so o. These two relatioships hold true for ay such fuctio f(). Hece, Figure 2: Graphical represetatio of fuctios i complexity class hierarchy. I literature, we fid three types of complexities. These are best case, worst case, ad average case complexities. Big-oh complexity defies a algorithm s upper-boud i computatio time ad memory space requiremets. The algorithm cosumes time or space i the order of big-oh i the worst possible case. Ω-otatioal complexity defies the order of the miimum time ad space required to execute the algorithm. This is possible i the best case. The average case complexity cosiders the effects of all possible cases icludig the best ad the worst cases as well. 6 Guidelies for Fuctios There are five commo guidelies i fidig out the complexity fuctio correspodig to a algorithm. We discuss each oe of them i sequece. 1. Loops: Loops play a major role i most codig structure. The maximum ruig time of a loop is the sigle ruig time of the statemets withi the loop icludig loop tests multiplied by the total umber of loop iteratios. For
6 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, example, cosider the followig loop: for i = 1 to i step 1 do m = m + 2 Each executio of the loop takes a costat c amout of time. The loop executes for differet times. Therefore, the time complexity fuctio, f() = c. We eed oe memory uit for storig i, oe for ad oe for m. Therefore, altogether, we eed 3 memory uits or 6 bytes (fixed), ad f s () = Nested Loops: Loops withi the loop cotrol structure is quite commo i practice. For ested loops, we start at the iermost loop ad the aalyze iside out. Total ruig time is the product of the sizes of all the loops. As a example, cosider the followig: for i = 1 to i step 1 do for j = 1 to i step 1 do k = k + 1 There is a ier for loop ested withi the outer for loop. For each executio of the outer loop, the ier loop executes times. The outer loop executes times. Suppose that the assigmet statemet k = k + 1 takes a costat time c for its executio. Therefore, the time complexity fuctio f() = c = c 2. We eed 1 memory uit for i, oe for j, oe for, ad oe for k. Altogether we eed 4 memory uits or 8 bytes, ad f s () = Cosecutive Statemets: For cosecutive statemets, we fid out expressio for the total time i terms of the iput parameters for executig each idividual statemet, each loop ad each ested loop costructs. This gives us the time complexity fuctio. For example, cosider the followig statemets. p = p + 1; for i = 1 to i step 1 do m = m + 2 for i = 1 to i step 1 do for j = 1 to i step 1 do k = k + 1 I this example, the complexity fuctio f() = c 0 + c 1 + c 2 = c 0 + c 1 + c 2 2. Here, c 0 is the time required by the assigmet statemet: p = p + 1, c 1 is the time required by the statemet: m = m + 2, ad c 2 is the time cosumed by the statemet: k = k+1. However, we eed oly 1 memory uit for storig p, 1 for i, 1 for, 1 for m, 1 for j ad fially, 1 for storig k. Therefore, altogether we eed 6 iteger memory uits or 12 bytes. Here, f s () = If-the-else statemets: With If-the-else statemets, we are iterested i the worst-case time complexity fuctio. The worst-case total time is the time required by the test, plus either the the part or the else part time (whichever is the larger). As a example, cosider the followig code: if (x is equal to y) the retur false else { for (m = 0 to m < i step 1) do if (m is equal to y) the retur false ed if } ed if I this example, i the worst-case, both the if ad the else parts i the outer if-else structure will be executed. Let the time for the if test is c 0. Withi the else structure, the for loop will be executed differet times. If each test coditio of the for loop takes c 1 ad the if coditio check takes c 2 times, the the time complexity fuctio f() = c 0 + (c 1 +c 2 ). Here, we eed 2 memory uits or 4 bytes for storig x ad y, 2 bytes for keepig the retur address from the first if, 2 bytes for storig, 2 bytes for m, ad fially, 2 bytes for the retur address from the secod if statemet. Altogether, we eed ( ) = 12 bytes of memory for storig this code segmet. I this case, f s () = Logarithmic complexity: A algorithm is of logarithmic complexity if it takes a costat time to cut dow the curret problem size by a costat fractio (usually by 1 2 ). A example is the biary search algorithm. Quite ofte we use the biary search for fidig a word iside a dictioary of pages. 7 A Framework for Aalysis Oce we have determied the time or the space complexity fuctio usig the guidelies described previ-
7 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, ously, we may use the followig steps i determiig the big-oh otatioal complexity. Step 1: Expad the complexity fuctio f() completely for a iput of size. Step 2: Remove all costat coefficiets from the terms withi f(), ad obtai the modified complexity fuctio f(). If ecessary, expad ay ested fuctio withi the expressio for f(). Step 3: Fid out the highest ordered term i the expressio for f() ad express it as g(). If there are ested fuctios withi f(), the fial expressio for g() is obtaied by elimiatig the costat coefficiets ad after refiemet of the iitial expressio for g(). Step 4: The big-oh otatioal complexity is O(g()). Example: We apply the above steps to f() = a k k + a k 1 (k 1) a 1 + a 0, here a k 0, k = 0, 1, 2,... ad a k, a k 1,..., a 0 are costat coefficiets. Applyig the secod procedural step ad removig all costat coefficiets from f(), the modified complexity fuctio, f() = k + (k 1) , where k is a oegative iteger, ad k = 0, 1, 2,.... Usig step 3, g() = k, k = 0, 1, 2,.... Therefore, f() is O( k ). The proposed framework is geeral, ad may be applied to complexity fuctios ivolvig multiple variables. A applicatio of this i AI has bee cosidered i sectio 11. Quite ofte, complexity fuctios for algorithms are expressed as fractios. For fractioal expressios, the four steps described earlier eeds to be applied both to the umerator ad to the deomiator. Usig the procedural steps, we fid out the highest order term i the umerator as g 1 (), ad that i the deomiator as g 2 (). Fially, we calculate the ratio g 1() g 2 (), ad deote it by g(). The big-oh complexity for the fractioal expressio is O(g()). A applicatio of this appears at sectio 11. The steps may be applied i determiig the bigoh complexity for fuctios ivolvig fractioal expressios with multiple variables. 7.1 Additio ad Multiplicatio of fuctios Here, we exted our proposed framework i fidig out the big-oh complexity for the additio ad multiplicatio of fuctios. Suppose that f 1 () is O(g 1 ()) ad f 2 () is O(g 2 ()). It is ecessary to fid out the big-oh complexity for (f 1 + f 2 )() ad (f 1 f 2 )(). Now, f 1 () is O(g 1 ()). Therefore, f 1 () = K 1 g 1 () + Lower Order Terms. Similarly, f 2 () = K 2 g 2 () + Lower Order Terms. Therefore, (f 1 + f 2 )() = f 1 () + f 2 () = (K 1 g 1 () + K 2 g 2 () + Other Lower Ordered Terms from f 1 () ad f 2 (). Three cases are possible: (1) g 1 () > g 2 (): (f 1 + f 2 )() O(g 1 ()); (2) g 1 () < g 2 (): (f 1 + f 2 )() O(g 2 ()); (3) g 1 () = g 2 () = g(): (f 1 + f 2 )() = f 1 () + f 2 () = (K 1 + K 2 )(g()) + Other Lower Ordered Terms, ad (f 1 + f 2 )() is O(g()). Next cosider multiplicatio of fuctios. Now, (f 1 f 2 )() = f 1 ()f 2 () = (K 1 g 1 () + Lower Order Terms) (K 2 g 2 () + Lower Order Terms) = K 1 K 2 g 1 ()g 2 () + Other Lower Order Terms i the product. The modified complexity fuctio is obtaied by elimiatig the costat coefficiets from (f 1 f 2 )(). Sice, (f 1 f2 )() = g 1 ()g 2 () + remaiig lower order terms without coefficiets. Therefore, (f 1 f 2 )() is O(g 1 ()g 2 ()). This aalysis may be exteded to fuctios ivolvig multiple variables as well as to the multiplicatio of more tha two fuctios. 8 Space Complexity Aalysis The space complexity i implemetig a algorithm is the amout of memory that it eeds to ru the algorithm to completio. Complexity fuctio for the computatioal memory space requiremet is deoted by S(P ). Usig the set theory, S(P ) O(g()), where g() {1, log(),, 2, 3,..., 2,!}. Thus, g() is a member of the set cotaiig all possible complexity class fuctios. The memory space required to implemet a algorithm may be divided ito two parts. These are: 1. Fixed Space Requiremets, C: This computatioal memory requiremet is idepedet of the characteristics of iputs ad outputs. This space icludes istructio space, space for storig simple variables, fixed-size structured variable, costats, etc. This is also kow as the static storage requiremet. 2. Variable storage requiremet, S p (I): This memory space is required for the creatio of dyamic data etities. This requiremet depeds o the istace characteristic I. The umber, size, values of iputs, ad outputs associated with a particular istace, I, recursive stack space, space for storig the formal parameters, local variables, ad retur addresses. Therefore, the total computatioal memory space requiremet, S(P ) = C + S p (I). 8.1 Space Complexity of Algorithms We cosider two examples of determiig the space complexity fuctio i recursive ad iterative algorithms.
8 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, Example 1: At first, cosider the followig iterative algorithm. Fuctio Sum adds elemets iside a give list of umbers, a[0: 1]. template < class T > T Sum (T a[ ], it ) { T tsum = 0 ; for i = 0 to ( 1) i step 1 do tsum + = a[i] ; retur tsum; } The memory space required for storig the poiter to the array a[ ], iteger, idex i, ad the parameter tsum, each is 2 bytes or 1 iteger memory uit log. Therefore, C = 42 bytes = 8 bytes. Also, S p (I) = 0. Hece, S(P ) = C + S p (I) = 8, ad S(P ) O(1). Similarly, S(P ) Ω(1). Suppose that the iitial assigmet statemet takes c 1 time. The for loop executes differet times. If each executio of the iterative loop takes c 2 uits of time, the the time complexity fuctio is, f() = c 1 + c 2. Therefore, f() O(). The space-time badwidth product for the fuctio is, C() = 1 =. Therefore, C() O(). Example 2: Followig is a recursive versio of the algorithm i Example 1 to add elemets iside a give list of umbers, a[0: 1]. template < class T > T RSum (T a[ ], it ) { if ( > 0) the retur RSum(a, 1) + a[ 1]; ed if retur 0; } For the give recursive program, the recursive calls are geerated i the followig sequece: Rsum(a, ), Rsum(a, 1), Rsum(a, 2),...,Rsum(a, 1), Rsum(a, 0). Therefore, the depth of recursio is ( + 1). Each call to Rsum takes up spaces for a (2 bytes), (2 bytes) ad a Retur Address (2 bytes log). A sigle call to Rsum eeds 2 3 = 6 bytes. Hece, S p (I) = 6 ( +1), with I =, with represetig the istace characteristics, ad C = 0. Now S(P ) = C + S p (I) = 6(+1). Fially, S(P ) O(). Also S(P ) Ω(). For ay > 0, the fuctio RSum executes differet times. If each executio of the fuctio takes c uits of time, the the time complexity fuctio, f() = c. Hece, f() O(). Therefore, the space-time badwidth product for the fuctio is, C() = 2, ad C() O( 2 ). 9 Performace Measuremet Laboratory-based techiques play a key role i decidig the performace of algorithms. For example, from theoretical aalysis, we kow that the selectio sort algorithm is O( 2 ), ad merge sort algorithm is O(log()). But we are further iterested i learig the effect of this order differece o computerbased implemetatio of the sortig algorithms. For selectio sort, the highest order term g s () i the complexity expressio is 2, ad that i the merge sort is, g m () = log(). Now, the ratio betwee g m () ad g s () is, r = g m() g s () = log() = log() 2. As iput size grows to a very large value, this ratio approaches 0. This is evidet from the mathematical fact that: Lim ( log() ) = 0. We verify this with performace measuremet. The algorithms are implemeted usig Microsoft s Visual C++.NET compiler uder Visual Studio.NET IDE. A PC with a Itel Petium 4, 2.80 GHz CPU ad 512 MB of RAM space has bee used. The result is listed below. With a i- Table 3: Performace measuremet data to compare merge sort with selectio sort (all timig values are i secods) T selectio T merge T merge T selectio put size, = 10, the time cosumed by both the algorithm is egligible (0). As the problem size grows, selectio sort cosumes more ad more time compared to the merge sort. At = 10000, the selectio sort requires 52 secods, whereas the merge sort still requires egligible time (0 secod). Therefore, the ratio becomes 0. With icreasig problem sizes, this ratio becomes smaller ad smaller with the smallest ratio beig at = This meas that for this particular iput, the time required by the merge sort is oly % of the selectio sort. Hece, as Lim ( log() ) = 0 holds true.
9 Proceedigs of the 10th WSEAS Iteratioal Coferece o APPLIED MATHEMATICS, Dallas, Texas, USA, November 1-3, Applicatio I this sectio, we cosider a few well kow algorithms i Artificial Itelligece (AI). Example 1: AI Problems that cosume memory space i expoetial order are proe to combiatorial expositio. Techiques that rely o storig all possibilities i memory, or eve geeratig all possibilities, are out of the questio except for the smallest of these problems. As a example, followig table lists the total umber of visited odes by a set of AI Gamig Algorithms durig computatio, which are i the order of their computatioal memory requiremets. Algorithms listed above are all expoetial or Table 4: Memory space requiremets for some AI gamig algorithms.) Game Maxm. # of visited odes 8-Puzzle 9! 15-Puzzle 16! -city TSP! Checkers Chess factorial complexity i memory space requiremets. Example 2: Breadth-First-Search (BFS) is a frequetly used algorithm i AI. We aalyze the algorithm for time ad space complexity. Each ode usig BFS may be visited i a costat time. The time complexity fuctio f B is a fuctio of the brachig factor b, ad the solutio depth d (a multi-variable fuctio). I the the worst case, we will eed to geerate all the odes at level d. Now, f B (b, d) = 1 + b + b b d = (b(d+1) 1) (b 1). Next we apply our framework for the fractioal expressios. The highest order term i the umerator, g 1 (b, d) = b (d+1). Similarly, the highest order term i the deomiator, g 2 (b, d) = b. Hece, g(b, d) = b(d+1) b = b d ad f B (b, d) O(b d ). To geerate the solutio, we eed to store all of the visited odes. Hece, S B (b, d) = (b(d+1) 1) (b 1), ad S B (b, d) O(b d ). I the best possible case, we will fid the solutio at the first visited ode. Hece, f B (b, d) Ω(1), ad also, S B (b, d) Ω(1). The space-time badwidth product, C B (b, d) = (b d ) 2 = b ( 2d). Suppose that we wat to implemet the algorithm o a typical machie with a speed of 100 MHz. If it visits a ew state (ode) i every 100 istructios, ad if each istructio takes 1 machie cycle, the a total of = 10 6 odes will be visited i each secod. Suppose, each ode occupies 4 bytes of memory. With a RAM size of 1 GB =109 byte, it s ode keepig capacity is, = With a complex problem, oly after = 250 secods or 4 miutes ad 10 secods of visitig (geeratig) odes, all memory space will be exhausted! This pheomeo is statespace explosio i AI. 11 Coclusio Complexity aalysis is sigificat i justifyig whether the algorithm will take up prohibitive amout of computatio time or computatioal memory space with cosiderable iput size. This is particularly true with expoetial algorithms. I this paper, a geeralized framework for the time ad space complexity aalysis of algorithms ad fuctios has bee proposed ad it s applicatios are discussed. Also, the sigificace of asymptotic complexity is established. Set theoretic properties relatig to complexity are cosidered. It has bee established that the otatioal complexities are sets of fuctios. AI algorithms are proe to both time ad the space complexity aalysis. For these algorithms, it is importat to use the otatio called Space-Time Badwidth Product, C. Performace is ot everythig. There ca be a tradeoff betwee ease of uderstadig, writig ad debuggig a code correspodig to a algorithm with the efficiet use of time ad space. However, it is still useful i comparig the performace of differet algorithms, eve if the optimal algorithm may ot be adopted. A problem may have more tha oe solutio each oe of which ca be expressed as a differet algorithm. Therefore, we eed to compare amog the performace of algorithms. After comparig differet, possible algorithms for solvig a problem, the user may select the oe that best fits his computatioal eeds. I future, the relatioship betwee the time ad the space complexity order of algorithms ad fuctios will be ivestigated. Also the proposed framework will be applied to critical AI problems for performace evaluatio. Refereces: [1] Douglas B. West, Itroductio to Graph Theory, Secod Editio, Pretice Hall, New Jersey 2001 [2] Richard E. Neapolita ad Kumarss Naimipour, Foudatios of Algorithms Usig C++ Pseudocode, Third Editio, Joes ad Bartlett Publishers, Massachusetts 2004 [3] A. Tarek, O Time Complexity Aalysis of Algorithms, Proceedigs of the 9th World Multicoferece o Systemics, Cyberetics ad Iformatics (WMSCI 2005), Orlado, Florida, U.S.A, July 10 to 13, 2005
Analysis Metrics. Intro to Algorithm Analysis. Slides. 12. Alg Analysis. 12. Alg Analysis
Itro to Algorithm Aalysis Aalysis Metrics Slides. Table of Cotets. Aalysis Metrics 3. Exact Aalysis Rules 4. Simple Summatio 5. Summatio Formulas 6. Order of Magitude 7. Big-O otatio 8. Big-O Theorems
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationCIS 121 Data Structures and Algorithms with Java Fall Big-Oh Notation Tuesday, September 5 (Make-up Friday, September 8)
CIS 11 Data Structures ad Algorithms with Java Fall 017 Big-Oh Notatio Tuesday, September 5 (Make-up Friday, September 8) Learig Goals Review Big-Oh ad lear big/small omega/theta otatios Practice solvig
More informationLecture Notes 6 Introduction to algorithm analysis CSS 501 Data Structures and Object-Oriented Programming
Lecture Notes 6 Itroductio to algorithm aalysis CSS 501 Data Structures ad Object-Orieted Programmig Readig for this lecture: Carrao, Chapter 10 To be covered i this lecture: Itroductio to algorithm aalysis
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationOutline and Reading. Analysis of Algorithms. Running Time. Experimental Studies. Limitations of Experiments. Theoretical Analysis
Outlie ad Readig Aalysis of Algorithms Iput Algorithm Output Ruig time ( 3.) Pseudo-code ( 3.2) Coutig primitive operatios ( 3.3-3.) Asymptotic otatio ( 3.6) Asymptotic aalysis ( 3.7) Case study Aalysis
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationBig-O Analysis. Asymptotics
Big-O Aalysis 1 Defiitio: Suppose that f() ad g() are oegative fuctios of. The we say that f() is O(g()) provided that there are costats C > 0 ad N > 0 such that for all > N, f() Cg(). Big-O expresses
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationWhat are we going to learn? CSC Data Structures Analysis of Algorithms. Overview. Algorithm, and Inputs
What are we goig to lear? CSC316-003 Data Structures Aalysis of Algorithms Computer Sciece North Carolia State Uiversity Need to say that some algorithms are better tha others Criteria for evaluatio Structure
More informationAlgorithm. Counting Sort Analysis of Algorithms
Algorithm Coutig Sort Aalysis of Algorithms Assumptios: records Coutig sort Each record cotais keys ad data All keys are i the rage of 1 to k Space The usorted list is stored i A, the sorted list will
More informationCSC165H1 Worksheet: Tutorial 8 Algorithm analysis (SOLUTIONS)
CSC165H1, Witer 018 Learig Objectives By the ed of this worksheet, you will: Aalyse the ruig time of fuctios cotaiig ested loops. 1. Nested loop variatios. Each of the followig fuctios takes as iput a
More informationLecture 1: Introduction and Strassen s Algorithm
5-750: Graduate Algorithms Jauary 7, 08 Lecture : Itroductio ad Strasse s Algorithm Lecturer: Gary Miller Scribe: Robert Parker Itroductio Machie models I this class, we will primarily use the Radom Access
More informationA graphical view of big-o notation. c*g(n) f(n) f(n) = O(g(n))
ca see that time required to search/sort grows with size of We How do space/time eeds of program grow with iput size? iput. time: cout umber of operatios as fuctio of iput Executio size operatio Assigmet:
More information1.2 Binomial Coefficients and Subsets
1.2. BINOMIAL COEFFICIENTS AND SUBSETS 13 1.2 Biomial Coefficiets ad Subsets 1.2-1 The loop below is part of a program to determie the umber of triagles formed by poits i the plae. for i =1 to for j =
More informationOctahedral Graph Scaling
Octahedral Graph Scalig Peter Russell Jauary 1, 2015 Abstract There is presetly o strog iterpretatio for the otio of -vertex graph scalig. This paper presets a ew defiitio for the term i the cotext of
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationLecture 5. Counting Sort / Radix Sort
Lecture 5. Coutig Sort / Radix Sort T. H. Corme, C. E. Leiserso ad R. L. Rivest Itroductio to Algorithms, 3rd Editio, MIT Press, 2009 Sugkyukwa Uiversity Hyuseug Choo choo@skku.edu Copyright 2000-2018
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
More informationUniversity of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures
Uiversity of Waterloo Departmet of Electrical ad Computer Egieerig ECE 250 Algorithms ad Data Structures Midterm Examiatio ( pages) Istructor: Douglas Harder February 7, 2004 7:30-9:00 Name (last, first)
More informationAlgorithms Chapter 3 Growth of Functions
Algorithms Chapter 3 Growth of Fuctios Istructor: Chig Chi Li 林清池助理教授 chigchi.li@gmail.com Departmet of Computer Sciece ad Egieerig Natioal Taiwa Ocea Uiversity Outlie Asymptotic otatio Stadard otatios
More informationExact Minimum Lower Bound Algorithm for Traveling Salesman Problem
Exact Miimum Lower Boud Algorithm for Travelig Salesma Problem Mohamed Eleiche GeoTiba Systems mohamed.eleiche@gmail.com Abstract The miimum-travel-cost algorithm is a dyamic programmig algorithm to compute
More informationcondition w i B i S maximum u i
ecture 10 Dyamic Programmig 10.1 Kapsack Problem November 1, 2004 ecturer: Kamal Jai Notes: Tobias Holgers We are give a set of items U = {a 1, a 2,..., a }. Each item has a weight w i Z + ad a utility
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationAnalysis of Algorithms
Presetatio for use with the textbook, Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Aalysis of Algorithms Iput 2015 Goodrich ad Tamassia Algorithm Aalysis of Algorithms
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 19 Query Optimizatio Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Query optimizatio Coducted by a query optimizer i a DBMS Goal:
More informationCounting the Number of Minimum Roman Dominating Functions of a Graph
Coutig the Number of Miimum Roma Domiatig Fuctios of a Graph SHI ZHENG ad KOH KHEE MENG, Natioal Uiversity of Sigapore We provide two algorithms coutig the umber of miimum Roma domiatig fuctios of a graph
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks and Queues Monday, February 12 / Tuesday, February 13
CIS Data Structures ad Algorithms with Java Sprig 08 Stacks ad Queues Moday, February / Tuesday, February Learig Goals Durig this lab, you will: Review stacks ad queues. Lear amortized ruig time aalysis
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 18 Strategies for Query Processig Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio DBMS techiques to process a query Scaer idetifies
More informationA New Morphological 3D Shape Decomposition: Grayscale Interframe Interpolation Method
A ew Morphological 3D Shape Decompositio: Grayscale Iterframe Iterpolatio Method D.. Vizireau Politehica Uiversity Bucharest, Romaia ae@comm.pub.ro R. M. Udrea Politehica Uiversity Bucharest, Romaia mihea@comm.pub.ro
More information1 Graph Sparsfication
CME 305: Discrete Mathematics ad Algorithms 1 Graph Sparsficatio I this sectio we discuss the approximatio of a graph G(V, E) by a sparse graph H(V, F ) o the same vertex set. I particular, we cosider
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More informationarxiv: v2 [cs.ds] 24 Mar 2018
Similar Elemets ad Metric Labelig o Complete Graphs arxiv:1803.08037v [cs.ds] 4 Mar 018 Pedro F. Felzeszwalb Brow Uiversity Providece, RI, USA pff@brow.edu March 8, 018 We cosider a problem that ivolves
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationExamples and Applications of Binary Search
Toy Gog ITEE Uiersity of Queeslad I the secod lecture last week we studied the biary search algorithm that soles the problem of determiig if a particular alue appears i a sorted list of iteger or ot. We
More informationData Structures Week #9. Sorting
Data Structures Week #9 Sortig Outlie Motivatio Types of Sortig Elemetary (O( 2 )) Sortig Techiques Other (O(*log())) Sortig Techiques 21.Aralık.2010 Boraha Tümer, Ph.D. 2 Sortig 21.Aralık.2010 Boraha
More informationCMPT 125 Assignment 2 Solutions
CMPT 25 Assigmet 2 Solutios Questio (20 marks total) a) Let s cosider a iteger array of size 0. (0 marks, each part is 2 marks) it a[0]; I. How would you assig a poiter, called pa, to store the address
More informationSolution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring, Instructions:
CS 604 Data Structures Midterm Sprig, 00 VIRG INIA POLYTECHNIC INSTITUTE AND STATE U T PROSI M UNI VERSI TY Istructios: Prit your ame i the space provided below. This examiatio is closed book ad closed
More informationAn Efficient Algorithm for Graph Bisection of Triangularizations
A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045 Oe Brookigs Drive St. Louis, Missouri 63130-4899, USA jaegerg@cse.wustl.edu
More information2. ALGORITHM ANALYSIS
2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationThe isoperimetric problem on the hypercube
The isoperimetric problem o the hypercube Prepared by: Steve Butler November 2, 2005 1 The isoperimetric problem We will cosider the -dimesioal hypercube Q Recall that the hypercube Q is a graph whose
More informationSorting in Linear Time. Data Structures and Algorithms Andrei Bulatov
Sortig i Liear Time Data Structures ad Algorithms Adrei Bulatov Algorithms Sortig i Liear Time 7-2 Compariso Sorts The oly test that all the algorithms we have cosidered so far is compariso The oly iformatio
More informationCSE 417: Algorithms and Computational Complexity
Time CSE 47: Algorithms ad Computatioal Readig assigmet Read Chapter of The ALGORITHM Desig Maual Aalysis & Sortig Autum 00 Paul Beame aalysis Problem size Worst-case complexity: max # steps algorithm
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationAn Efficient Algorithm for Graph Bisection of Triangularizations
Applied Mathematical Scieces, Vol. 1, 2007, o. 25, 1203-1215 A Efficiet Algorithm for Graph Bisectio of Triagularizatios Gerold Jäger Departmet of Computer Sciece Washigto Uiversity Campus Box 1045, Oe
More informationCOSC 1P03. Ch 7 Recursion. Introduction to Data Structures 8.1
COSC 1P03 Ch 7 Recursio Itroductio to Data Structures 8.1 COSC 1P03 Recursio Recursio I Mathematics factorial Fiboacci umbers defie ifiite set with fiite defiitio I Computer Sciece sytax rules fiite defiitio,
More informationHeaps. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 201 Heaps 201 Goodrich ad Tamassia xkcd. http://xkcd.com/83/. Tree. Used with permissio uder
More informationAlgorithms for Disk Covering Problems with the Most Points
Algorithms for Disk Coverig Problems with the Most Poits Bi Xiao Departmet of Computig Hog Kog Polytechic Uiversity Hug Hom, Kowloo, Hog Kog csbxiao@comp.polyu.edu.hk Qigfeg Zhuge, Yi He, Zili Shao, Edwi
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationComputer Science Foundation Exam. August 12, Computer Science. Section 1A. No Calculators! KEY. Solutions and Grading Criteria.
Computer Sciece Foudatio Exam August, 005 Computer Sciece Sectio A No Calculators! Name: SSN: KEY Solutios ad Gradig Criteria Score: 50 I this sectio of the exam, there are four (4) problems. You must
More informationwhy study sorting? Sorting is a classic subject in computer science. There are three reasons for studying sorting algorithms.
Chapter 5 Sortig IST311 - CIS65/506 Clevelad State Uiversity Prof. Victor Matos Adapted from: Itroductio to Java Programmig: Comprehesive Versio, Eighth Editio by Y. Daiel Liag why study sortig? Sortig
More informationChapter 24. Sorting. Objectives. 1. To study and analyze time efficiency of various sorting algorithms
Chapter 4 Sortig 1 Objectives 1. o study ad aalyze time efficiecy of various sortig algorithms 4. 4.7.. o desig, implemet, ad aalyze bubble sort 4.. 3. o desig, implemet, ad aalyze merge sort 4.3. 4. o
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationLecturers: Sanjam Garg and Prasad Raghavendra Feb 21, Midterm 1 Solutions
U.C. Berkeley CS170 : Algorithms Midterm 1 Solutios Lecturers: Sajam Garg ad Prasad Raghavedra Feb 1, 017 Midterm 1 Solutios 1. (4 poits) For the directed graph below, fid all the strogly coected compoets
More informationCOMP Parallel Computing. PRAM (1): The PRAM model and complexity measures
COMP 633 - Parallel Computig Lecture 2 August 24, 2017 : The PRAM model ad complexity measures 1 First class summary This course is about parallel computig to achieve high-er performace o idividual problems
More informationImproved Random Graph Isomorphism
Improved Radom Graph Isomorphism Tomek Czajka Gopal Paduraga Abstract Caoical labelig of a graph cosists of assigig a uique label to each vertex such that the labels are ivariat uder isomorphism. Such
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationProtected points in ordered trees
Applied Mathematics Letters 008 56 50 www.elsevier.com/locate/aml Protected poits i ordered trees Gi-Sag Cheo a, Louis W. Shapiro b, a Departmet of Mathematics, Sugkyukwa Uiversity, Suwo 440-746, Republic
More informationComputational Geometry
Computatioal Geometry Chapter 4 Liear programmig Duality Smallest eclosig disk O the Ageda Liear Programmig Slides courtesy of Craig Gotsma 4. 4. Liear Programmig - Example Defie: (amout amout cosumed
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationRecursion. Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Review: Method Frames
Uit 4, Part 3 Recursio Computer Sciece S-111 Harvard Uiversity David G. Sulliva, Ph.D. Review: Method Frames Whe you make a method call, the Java rutime sets aside a block of memory kow as the frame of
More informationAlgorithm Efficiency
Algorithm Effiiey Exeutig ime Compariso of algorithms to determie whih oe is better approah implemet algorithms & reord exeutio time Problems with this approah there are may tasks ruig ourretly o a omputer
More informationHash Tables. Presentation for use with the textbook Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015.
Presetatio for use with the textbook Algorithm Desig ad Applicatios, by M. T. Goodrich ad R. Tamassia, Wiley, 2015 Hash Tables xkcd. http://xkcd.com/221/. Radom Number. Used with permissio uder Creative
More informationMath 10C Long Range Plans
Math 10C Log Rage Plas Uits: Evaluatio: Homework, projects ad assigmets 10% Uit Tests. 70% Fial Examiatio.. 20% Ay Uit Test may be rewritte for a higher mark. If the retest mark is higher, that mark will
More informationImproving Information Retrieval System Security via an Optimal Maximal Coding Scheme
Improvig Iformatio Retrieval System Security via a Optimal Maximal Codig Scheme Dogyag Log Departmet of Computer Sciece, City Uiversity of Hog Kog, 8 Tat Chee Aveue Kowloo, Hog Kog SAR, PRC dylog@cs.cityu.edu.hk
More informationAppendix D. Controller Implementation
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);
More informationLoad balanced Parallel Prime Number Generator with Sieve of Eratosthenes on Cluster Computers *
Load balaced Parallel Prime umber Geerator with Sieve of Eratosthees o luster omputers * Soowook Hwag*, Kyusik hug**, ad Dogseug Kim* *Departmet of Electrical Egieerig Korea Uiversity Seoul, -, Rep. of
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationPractical Session 2 Constants Don t Matter!!!
Practical Sessio 2 Costats Do t Matter!!! Algorithm Aalysis f() = O(g()) Big O f() = Ω(g()) Big Omega There exist c > 0 ad 0 > 0 such that: 0 f() cg() for each 0 There exist c > 0 ad 0 > 0 such that: 0
More informationRecursive Procedures. How can you model the relationship between consecutive terms of a sequence?
6. Recursive Procedures I Sectio 6.1, you used fuctio otatio to write a explicit formula to determie the value of ay term i a Sometimes it is easier to calculate oe term i a sequece usig the previous terms.
More informationOn Infinite Groups that are Isomorphic to its Proper Infinite Subgroup. Jaymar Talledo Balihon. Abstract
O Ifiite Groups that are Isomorphic to its Proper Ifiite Subgroup Jaymar Talledo Baliho Abstract Two groups are isomorphic if there exists a isomorphism betwee them Lagrage Theorem states that the order
More informationCSE 2320 Notes 8: Sorting. (Last updated 10/3/18 7:16 PM) Idea: Take an unsorted (sub)array and partition into two subarrays such that.
CSE Notes 8: Sortig (Last updated //8 7:6 PM) CLRS 7.-7., 9., 8.-8. 8.A. QUICKSORT Cocepts Idea: Take a usorted (sub)array ad partitio ito two subarrays such that p q r x y z x y y z Pivot Customarily,
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More informationCombination Labelings Of Graphs
Applied Mathematics E-Notes, (0), - c ISSN 0-0 Available free at mirror sites of http://wwwmaththuedutw/ame/ Combiatio Labeligs Of Graphs Pak Chig Li y Received February 0 Abstract Suppose G = (V; E) is
More informationAPPLICATION NOTE PACE1750AE BUILT-IN FUNCTIONS
APPLICATION NOTE PACE175AE BUILT-IN UNCTIONS About This Note This applicatio brief is iteded to explai ad demostrate the use of the special fuctios that are built ito the PACE175AE processor. These powerful
More informationAccuracy Improvement in Camera Calibration
Accuracy Improvemet i Camera Calibratio FaJie L Qi Zag ad Reihard Klette CITR, Computer Sciece Departmet The Uiversity of Aucklad Tamaki Campus, Aucklad, New Zealad fli006, qza001@ec.aucklad.ac.z r.klette@aucklad.ac.z
More informationEE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 13 Control and Sequencing: Hardwired and Microprogrammed Control
EE 459/500 HDL Based Digital Desig with Programmable Logic Lecture 13 Cotrol ad Sequecig: Hardwired ad Microprogrammed Cotrol Refereces: Chapter s 4,5 from textbook Chapter 7 of M.M. Mao ad C.R. Kime,
More informationChapter 3 Classification of FFT Processor Algorithms
Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As
More informationLecture 18. Optimization in n dimensions
Lecture 8 Optimizatio i dimesios Itroductio We ow cosider the problem of miimizig a sigle scalar fuctio of variables, f x, where x=[ x, x,, x ]T. The D case ca be visualized as fidig the lowest poit of
More informationCS473-Algorithms I. Lecture 2. Asymptotic Notation. CS 473 Lecture 2 1
CS473-Algorithms I Lecture Asymptotic Notatio CS 473 Lecture 1 O-otatio (upper bouds) f() = O(g()) if positive costats c, 0 such that e.g., = O( 3 ) 0 f() cg(), 0 c 3 c c = 1 & 0 = or c = & 0 = 1 Asymptotic
More informationEE University of Minnesota. Midterm Exam #1. Prof. Matthew O'Keefe TA: Eric Seppanen. Department of Electrical and Computer Engineering
EE 4363 1 Uiversity of Miesota Midterm Exam #1 Prof. Matthew O'Keefe TA: Eric Seppae Departmet of Electrical ad Computer Egieerig Uiversity of Miesota Twi Cities Campus EE 4363 Itroductio to Microprocessors
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationUNIT 1 RECURRENCE RELATIONS
UNIT RECURRENCE RELATIONS Structure Page No.. Itroductio 7. Objectives 7. Three Recurret Problems 8.3 More Recurreces.4 Defiitios 4.5 Divide ad Coquer 7.6 Summary 9.7 Solutios/Aswers. INTRODUCTION I the
More informationImproving Template Based Spike Detection
Improvig Template Based Spike Detectio Kirk Smith, Member - IEEE Portlad State Uiversity petra@ee.pdx.edu Abstract Template matchig algorithms like SSE, Covolutio ad Maximum Likelihood are well kow for
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationConvergence results for conditional expectations
Beroulli 11(4), 2005, 737 745 Covergece results for coditioal expectatios IRENE CRIMALDI 1 ad LUCA PRATELLI 2 1 Departmet of Mathematics, Uiversity of Bologa, Piazza di Porta Sa Doato 5, 40126 Bologa,
More informationPattern Recognition Systems Lab 1 Least Mean Squares
Patter Recogitio Systems Lab 1 Least Mea Squares 1. Objectives This laboratory work itroduces the OpeCV-based framework used throughout the course. I this assigmet a lie is fitted to a set of poits usig
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationBezier curves. Figure 2 shows cubic Bezier curves for various control points. In a Bezier curve, only
Edited: Yeh-Liag Hsu (998--; recommeded: Yeh-Liag Hsu (--9; last updated: Yeh-Liag Hsu (9--7. Note: This is the course material for ME55 Geometric modelig ad computer graphics, Yua Ze Uiversity. art of
More informationCS 683: Advanced Design and Analysis of Algorithms
CS 683: Advaced Desig ad Aalysis of Algorithms Lecture 6, February 1, 2008 Lecturer: Joh Hopcroft Scribes: Shaomei Wu, Etha Feldma February 7, 2008 1 Threshold for k CNF Satisfiability I the previous lecture,
More informationTask scenarios Outline. Scenarios in Knowledge Extraction. Proposed Framework for Scenario to Design Diagram Transformation
6-0-0 Kowledge Trasformatio from Task Scearios to View-based Desig Diagrams Nima Dezhkam Kamra Sartipi {dezhka, sartipi}@mcmaster.ca Departmet of Computig ad Software McMaster Uiversity CANADA SEKE 08
More informationc-dominating Sets for Families of Graphs
c-domiatig Sets for Families of Graphs Kelsie Syder Mathematics Uiversity of Mary Washigto April 6, 011 1 Abstract The topic of domiatio i graphs has a rich history, begiig with chess ethusiasts i the
More informationLecture 6. Lecturer: Ronitt Rubinfeld Scribes: Chen Ziv, Eliav Buchnik, Ophir Arie, Jonathan Gradstein
068.670 Subliear Time Algorithms November, 0 Lecture 6 Lecturer: Roitt Rubifeld Scribes: Che Ziv, Eliav Buchik, Ophir Arie, Joatha Gradstei Lesso overview. Usig the oracle reductio framework for approximatig
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More information