UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. Balanced Searching: Tries, Treaps
|
|
- Alyson Grant
- 5 years ago
- Views:
Transcription
1 UNIVERSITY OF CALIFORNIA Deprtment of Electricl Engineering nd Computer Sciences Computer Science Division CS6B Fll 999 P. N. Hilfinger Blnced Serching: Tries, Treps Blnce We ve seen tht inry serch trees hve wekness: tendency to e ecome unlnced, so tht they re ineffective in dividing the set of dt they represent into two sustntilly smller prts. Let s consider wht we cn do out this. Of course, we could lwys relnce n unlnced tree y simply lying ll the keys out in order nd then re-inserting them in such wy s to keep the tree lnced. Tht opertion, however, requires time liner in the numer of keys in the tree, nd it is difficult to see how to void hving Θ(N ) fctor creep in to the time required to insert N keys. By contrst, only O(N lg N) time is required to mke N insertions if the dt hppen to e presented in n order tht keeps the tree ushy. So let s look t opertions to re-lnce tree without tking it prt nd reconstructing it. Wht we need is n opertion tht chnges the lnce of BST choosing new root tht moves keys from deep side to shllow side while preserving the inry serch tree property. The simplest such opertions re the rottions of tree. Figure shows two BSTs holding identicl sets of keys. Consider the rightrottion first (the left is mirror imge). First, the rottion preserves the inry serch tree property. In the unrotted tree, the nodes in A re the exctly the ones less thn B, s they re on the right; D is greter, s on the right; nd sutree C is greter, s on the right. You cn lso ssure yourself tht the nodes under D in the rotted tree er the proper reltion to it. Turning to height, let s use the nottion H A, H C, H E, H B, nd H D to denote the heights of sutrees A, C, nd E nd of the sutrees whose roots re nodes B nd D. Any of A, C, or E cn e empty; we ll tke their heights in tht cse to e. The height of the tree on the left is + mx(h E, + H A, + H C ). The height of the tree on the right is + mx(h A, + H C, + H E ). Therefore, s long s H A > mx(h C +, H E ) (s would hppen in left-lening tree, for exmple), the height of the right-hnd tree will e less thn tht of the left-hnd tree. One gets similr sitution in the other direction. In fct, it is possile to convert ny BST into ny other tht contins the sme keys y mens of rottions. This mounts to showing tht y rottion, we cn move ny node of Copyright c 99, 997, 998, 999 y Pul N. Hilfinger. All rights reserved. 67
2 68 P. N. Hilfinger D D.rotteRight() B B D E D.rotteLeft() A A C C E Figure : Rottions in inry serch tree. Tringles represent sutrees nd circles represent individul nodes. The inry serch tree reltion is mintined y oth opertions, ut the levels of vrious nodes re ffected. BST to the root of the tree while preserving the inry serch tree property [why is this sufficient?]. The rgument is n induction on the structure of trees. It is clerly possile for empty or one-element trees. Suppose we wnt to show it for lrger tree, ssuming (inductively) tht ll smller trees cn e rotted to ring ny of their nodes their root. We proceed s follows: If the node we wnt to mke the root is lredy there, we re done. If the node we wnt to mke the root is in the left child, rotte the left child to mke it the root of the left child (inductive hypothesis). The perform right rottion on the whole tree. Similrly if the node we wnt is in the right child. Of course, knowing tht it is possile to re-rrnge BST y mens of rottion doesn t tell us which rottions to perform. There re vrious schemes tht involve explicitly or implicitly keeping trck of the heights of sutrees nd performing rottions when they get too fr out of line: AVL trees, red-lck trees, - trees, B-trees re some trditionl exmples. They re ll it complicted, nd since they re lmost never ctully used (with the exception of B-trees, nd those only in lrge dtse systems), I thought we might perhps look s well look t something eqully unused ut perhps it more interesting: rndomized serch tree, one tht is lnced with high proility. One isn t certin of lnce, just pretty certin. Treps: Prolistic lncing One exmple of such structure is the trep, comintion (s the nme implies) of inry serch tree nd hep More specificlly, ech node of trep contins serch key nd See Rndomized serch trees, Cecili R. Argon nd Rimund G. Seidel, 0th Annul Symposium on Foundtions of Computer Science (FOCS), IEEE Computer Society Press, 989, pp The sme dt structure (with different use) ws clled Crtesin tree y Jen Vuillemin ( A unifying look t dt structures, CACM () (April, 980), pp. 9-9).
3 Blnced Serching 69 numer clled its priority. The dt structure is mintined in such wy tht it is lwys inry serch tree with respect to the keys, nd it is lwys inry hep with respect to the priorities. Serching in trep is identicl to serches in inry serch tree. The priorities re used to keep the tree lnced. Specificlly, every time we dd new node to the tree, we ssign it priority y pplying hshing function to its key, nd then re-rrnge the tree to keep it oth inry serch tree nd hep. (Now, of course, you see the rel reson to introduce this dt structure; it comines BSTs, heps, nd hshing ll into one dt structure.) Likewise, whenever we delete node from the tree, we re-hepify the tree, mintining its sttus s inry serch tree. The ide is tht with high proility, the resulting tree will e resonly lnced (its height will e within fixed constnt fctor of ln N), ecuse the priorities effectively choose t rndom etween the mny possile inry serch trees tht cn hold those keys. Let s now turn to effects of rottion on the hep structure of the tree. Consider first the left tree in Figure, nd ssume tht it stisfies the hep property, except tht node B contins priority tht is lrger thn tht of D. Then the result of the right rottion is esily seen to stisfy the hep property completely. Since C nd E were under D on the left, they must contin priorities smller thn tht of D, so it is vlid to put them s children. D is clerly vlid child of B, nd since A ws originlly under B, it remins vlid child of B. Furthermore, B is now higher thn it previously ws. Alterntively, suppose tht the left tree is hep except tht node D contins vlue less thn either of its children, nd tht B is the lrger child. Then it is vlid for ll the sutrees, A, C, nd E to e under B, nd the right tree is gin hep, except tht the priority of D my e smller thn those of its children, nd D now hs fewer descendents. Thus y continuing to rotte D down, we will eventully restore the hep property. The rottions re mirror imges of ech other. Thus, when we hve tree configured like the right tree in Figure, nd it is vlid hep except tht D s priority is lrger thn B s, left rottion fixes the prolem. These considertions indicte the necessry insertion nd deletion routines. Here is our dt structure in outline (s usul, using integers s lels): clss Trep privte int lel; protected Trep left, right; protected int priority; /** A singleton Trep. */ pulic Trep(int lel) this.lel = lel; priority = somehshfunction(l); pulic sttic finl Trep EMPTY = new EmptyTrep(); pulic oolen isempty() return flse; pulic Trep left() return this.left;
4 70 P. N. Hilfinger pulic Trep right() return this.right; pulic int lel() return this.lel; /* A node in this Trep with lel L, or null if none. */ pulic Trep find(int L) /* sme s for BST */ /* Tree rottions */ protected Trep rotteleft()... protected Trep rotteright()... pulic Trep insert(int L)... pulic Trep remove(int L)... Rottions re routine: /** The result of performing right rottion on the root of this * trep, returning the root of the result. Assumes my left child. * is not empty. */ protected Trep rotteright() Trep result = left; left = left.right; result.right = this; return result; /* rotteleft is the sme, swpping left for right. */ For insertion, we first insert the new lel in the pproprite child. We ssume recursively tht if the newly inserted node hs priority lrger thn tht of prent, it will rise to the root of the child, where single rottion will restore the hep property. /** Insert lel X into this trep. */ pulic Trep insert(int X) if (X < lel) left = left.insert(x); if (left.priority > this.priority) return rotteright(); else right = right.insert(x); if (right.priority > this.priority) return rotteleft(); return this;
5 Blnced Serching 7 As usul, removl is hrder. If one child is empty, we my simply replce the Trep with the other child (empty or not). Otherwise, the trick is to rotte the node to e removed down the tree, ech time mking it child of its child with the lrger root, until one of its children is empty. /** Remove n instnce of lel X from this Trep. */ Trep remove(int X) if (X < lel()) left = left.remove(x); else if (X > lel()) right = right.remove(x); // Removing lel from child never violtes the hep // property with respect to this node. else return removeme(); /** Remove this node from the Trep, returning the * result. */ protected Trep removeme() if (left.isempty()) return right; else if (right.isempty()) return left; else if (left.priority < right.priority) Trep result = rotteleft(); // My right child now root result.left = removeme(); return result; else Trep result = rotteright(); // My left child now root result.right = removeme(); return result; Figure illustrtes sequence of insertions of consecutive integers (which, s you my recll, cuses troule with n ordinry inry tree) strting from n empty trep. Figure shows sequence of deletions from trep. In Figure, it might pper t first tht we get the sme kind of Θ(N) ehvior tht cused prolems with ordinry inry serch trees, especilly when looking t the long chin tht strts with the left child of the root in the lst trep. However, notice tht y the time we get to tht configurtion, the priority of the root node (9) is quite high. If we continue
6 7 P. N. Hilfinger 5 (9) 5 (9) (5) (5) 7 (69) ( 7) 6 8 () Figure : Insertions into trep. The smll numers in prentheses re the rndomly-ssigned priorities (in the rnge 0 99). The numers 8 re dded in sequence to n initilly-empty trep: first nd (no rottions needed), then (one rottion), then nd 5 (three rottions), nd finlly 6 8 (one rottion). dding numers consecutively, the left child of the root is not likely to e expnded much more (little else is likely to rotte with the root). At the sme time, the right child of the root mintins resonle height. It cn e shown tht these trees tend to e lnced on verge. Intuitively, the ide is tht if the size of the priority is sttisticlly independent of the size of the key, then the node with lrgest priority (which will e the root of the tree) is unlikely to coincide with the lrgest or smllest few keys. Tht is, the size of the set keys left of it will tend to e within some constnt fctor of the size of the keys on the right, nd tht is enough to insure tht the mount of dt remining to e serched s find serches down the tree will diminish y some multiplictive fctor t ech step. In perfect inry serch tree, tht multiplictive fctor is /, ut ny constnt strictly less thn will do. Interestingly enough, the verge numer of rottions required for ech insertion is ounded y constnt (in fct, constnt less thn ), regrdless of the size of the tree. Intuitively, this is ecuse the proility of requiring r rottions is the proility tht the newlyinserted node is lrger thn its r most recent ncestors nd therefore, y the hep property, greter thn the priorities of ll the descendents of its gret r grndprent. This proility decreses exponentilly, nd the expected vlue of r is constnt. Of course, this is ll proilistic. For ny given hshing function, it is possile, s the complexity theorists like to sy, tht n dversry will hnd us string of keys tht cuse our trees to keep getting longer nd thinner. If you wnt to do this right, therefore, you choose somehshfunction t rndom. For integer keys, for exmple, we cn mke the hsh function something like this: somehshfunction(x) = c 5 x 5 + c x + c x + c x + c x + c 0 (computed modulo ) where the c i re chosen t rndom t the eginning of the progrm.
7 Blnced Serching 7 *5 (9) 7 (69) 7 (69) 7 (69) (5) 7 (69) *5 (9) 8 () (5) 8 () (5) 8 () 6 8 () (5) 6 *5 (9) 6 6 *7 (69) (5) (5) (5) 8 () *7 (69) 8 () 6 8 () 6 6 Figure : Deletions of 5 (top row) nd then 7 from the lst trep in Figure. The strred nodes indicte the ones doomed to e deleted y removeme. Tries Loosely speking, lnced (mximlly ushy) inry serch trees contining N keys require Θ(lg N) time to find key. This is not entirely ccurte, of course, ecuse it neglects the possiility tht the time required to compre ginst key depends on the key. For exmple, the time required to compre two strings depends on the length of the shorter string. Therefore, in ll the plces I ve sid Θ(lg N) efore, I relly ment Θ(L lg N) for L ound on the numer of ytes in the key. In most pplictions, this doesn t much mtter, since L tends to increse very slowly, if t ll, s N increses. Nevertheless, this leds to n interesting question: we evidently cn t get rid of the fctor of L too esily (fter ll, you hve to look t the key you re serching for), ut cn we get rid of the fctor of lg N?
8 7 P. N. Hilfinger. Tries: sic properties nd lgorithms It turns out tht we cn, using dt structure known s trie. A pure trie is kind of tree tht represents set of strings from some lphet of fixed size, sy A = 0,..., M. One of the chrcters is specil delimiter tht ppers only t the ends of words,. For exmple, A might e the set of printle ASCII chrcters, with represented y n unprintle chrcter, such s \000 (NUL). A trie, T, my e strctly defined y the following recursive definition : A trie, T, is either empty, or lef node contining string, or n internl node contining M children tht re lso tries. The edges leding to these children re leled y the chrcters of the lphet, i, like this: C 0, C,... C M. We cn think of trie s tree whose lef nodes re strings. We impose one other condition: If y strting t the root of trie nd following edges leled s 0, s,..., s h, we rech string, then tht string egins s 0 s s h. Therefore, you cn think of every internl node of trie s stnding for some prefix of ll the strings in the leves elow it: specificlly, n internl node t level k stnds for the first k chrcters of ech string elow it. A string S = s 0 s s m is in T if y strting t the root of T nd following 0 or more edges with leled s 0 s j, we rrive t the string S. We will pretend tht ll strings in T end in, which ppers only s the lst chrcter of string. Figure shows trie tht represents smll set of strings. To see if string is in the set, we strt t the root of the trie nd follow the edges (links to children) mrked with the successive chrcters in the string we re looking for (including the imginry t the end). If we succeed in finding string somewhere long this pth nd it equls the string we re serching for, then the string we re serching for is in the trie. If we don t, it is not in the trie. For ech word, we need internl nodes only s fr down s there re multiple words stored tht strt with the chrcters trversed to tht point. The convention of ending everything with specil chrcter llows us to distinguish etween sitution in which the trie contins two words, one of which is prefix of the other (like nd te ), from the sitution where the trie contins only one long word. How is it pronounced? I hve no ide. The word ws suggested y E. Fredkin in 960, who derived it from the word retrievl. Despite this etymology, I usully pronounce it like try to void verl confusion with tree. This version of the trie dt structure is descried in D. E. Knuth, The Art of Progrmming, vol., which is the stndrd reference on sorting nd serching. The originl dt structure, proposed in 959 y de l Brindis, ws slightly different.
9 Blnced Serching 75 f x f e x o f c s t s xe xolotl fric fcet e s h te se sh Figure : A trie contining the set of strings, se, sh, te, s, xolotl, xe, fric, fcet. The internl nodes re leled to show the string prefixes to which they correspond. f x t f e x o f c s t s xe xolotl fric fc e e s h te p fce t se sh fceplte fcet Figure 5: Result of inserting the strings t nd fceplte into the trie in Figure.
10 76 P. N. Hilfinger From trie user s point of view, it looks like kind of tree with String lels: pulic strct clss Trie /** The empty Trie. */ pulic sttic finl Trie EMPTY = new EmptyTrie(); /** The lel t this node. Defined only on leves. */ strct pulic String lel(); /** True is X is in this Trie. */ pulic oolen isin(string x)... /** The result of inserting X into this Trie, if it is not * lredy there, nd returning this. This trie is * unchnged if X is in it lredy. */ pulic Trie insert(string x)... /** The result of removing X from this Trie, if it is present. * The trie is unchnged if X is not present. */ pulic Trie remove(string x)... /** True if this Trie is lef (contining single String). */ strct pulic oolen islef(); /** True if this Trie is empty */ strct pulic oolen isempty(); /** The child numered with chrcter K. Requires tht this node * not e empty. Child 0 corresponds to. */ strct pulic Trie child(int k); /** Set the child numered with chrcter K to C. Requires tht * this node not e empty. (Intended only for internl use. */ strct protected void child(int k, Trie C);
11 Blnced Serching 77 The following lgorithm descries serch through trie. /** True is X is in this Trie. */ pulic oolen isin(string x)... Trie P = longestprefix(x, 0); return P.isLef() && x.equls(p.lel()); /** The node representing the longest prefix of X.sustring(K) tht * mtches String in this trie. */ privte Trie longestprefix(string x, int k) if (isempty() islef()) return this; int c = nth(x, k); if (child(c).isempty()) return this; else return child(c).longestprefix(x, k+); /** Chrcter K of X, or if K is off the end of X. */ sttic chr nth(string x, int k) if (k >= x.length()) return (chr) 0; else return x.chrat(k); I hve chosen (here nd in lter methods) to mke limited use of fncy oject-orienttion. For exmple, I hve ll those explicit tests like isempty() nd islef() rther thn hving different longestprefix method for ech different kind of trie node (empty, lef, internl). In this cse, I think it mkes things little clerer to hve the entire lgorithm in one plce. It should e cler from following this procedure tht the time required to find key is proportionl to the length of the key. In fct, the numer of levels of the trie tht need to e trversed cn e considerly less thn the length of the key, especilly when there re few keys stored. However, if string is in the trie, you will hve to look t ll its chrcters, so isin hs worst-cse time of Θ(x.length). To insert key X in trie, we gin find the longest prefix of X in the trie, which corresponds to some node P. Then, if P is lef node, we insert enough internl nodes to distinguish X from P.lel(). Otherwise, we cn insert lef for X in the pproprite child
12 78 P. N. Hilfinger of P. Figure 5 illustrtes the results of dding t nd fceplte to the trie in Figure. Adding t simply requires dding lef to n existing node. Adding fceplte requires inserting two new nodes first. The method insert elow performs the trie insertion. /** The result of inserting X into this Trie, if it is not * lredy there, nd returning this. This trie is * unchnged if X is in it lredy. */ pulic Trie insert(string X) return insert(x, 0); /** Assumes this is level L node in some Trie. Returns the */ * result of inserting X into this Trie. Hs no effect (returns * this) if X is lredy in this Trie. */ privte Trie insert(string X, int L) if (isempty()) return new LefTrie(X); int c = nth(x, L); if (islef()) if (X.equls(lel())) return this; else if (c == lel().chrat(l)) return new InnerTrie(c, insert(x, L+)); else Trie newnode = new InnerTrie(c, new LefTrie(X)); newnode.child(lel().chrat(l), this); return newnode; else child(c, child(c).insert(x, L+)); return this; Here, the constructor for InnerTrie(c, T ), descried lter, gives us Trie for which child(c) is T nd ll other children re empty. Deleting from trie just reverses this process. Whenever trie node is reduced to contining single lef, it my e replced y tht lef. The following progrm indictes the process.
13 Blnced Serching 79 pulic Trie remove(string x) return remove(x, 0); /** Remove x from this Trie, which is ssumed to e level L, nd * return the result. */ privte Trie remove(string x, int L) if (isempty()) return this; if (islef(t)) if (x.equls(lel())) return EMPTY; else return this; int c = nth(x, L); child(c, child(c).remove(x, L+)); int d = onlymemer(); if (d >= 0) return child(d); return this; /** If this Trie contins single string, which is in * child(k), return K. Otherwise returns -. privte int onlymemer() /* Left to the reder. */. Tries: Representtion We re left with the question of how to represent these tries. The min prolem of course is tht the nodes contin vrile numer of children. If the numer of children in ech node is smll, linked tree representtion like those descried in Lecture Notes #8 will work. However, for fst ccess, it is trditionl to use n rry to hold the children of node, indexed y the chrcters tht lel the edges. This leds to something like the following: clss EmptyTrie extends Trie pulic oolen isempty() return true; pulic oolen islef() return flse; pulic String lel() throw new Error(...); pulic Trie child(int c) throw new Error(...); protected void child(int c, Trie T) throw new Error(...);
14 80 P. N. Hilfinger clss LefTrie extends Trie privte String L; /** A Trie contining just the string S. */ LefTrie(String s) L = s; pulic oolen isempty() return flse; pulic oolen islef() return true; pulic String lel() return L; pulic Trie child(int c) return EMPTY; protected void child(int c, Trie T) throw new Error(...); clss InnerTrie extends Trie // ALPHABETSIZE hs to e defined somewhere */ privte Trie[] kids = new kids[alphabetsize]; /** A Trie with child(k) == T nd ll other children empty. */ InnerTrie(int k, Trie T) for (int i = 0; i < kids.length; i += ) kids[i] = EMPTY; child(k, T); pulic oolen isempty() return flse; pulic oolen islef() return flse; pulic String lel() throw new Error(...); pulic Trie child(int c) return kids[c]; protected void child(int c, Trie T) kids[c] = T;. Tle compression Actully, our lphet is likely to hve holes in it stretches of encodings tht don t correspond to ny chrcter tht will pper in the Strings we insert. We could cut down on the size of the inner nodes (the kids rrys) y performing preliminry mpping of chrs into compressed encoding. For exmple, if the only chrcters in our strings re the digits 0 9, then we could re-do InnerTrie s follows:
15 Blnced Serching 8 clss InnerTrie extends Trie privte sttic chr[] chrmp = new chr[ 9 +]; sttic chrmp[0] = 0; chrmp[ 0 ] = ; chrmp[ ] = ;... pulic Trie child(int c) return kids[chrmp[c]]; protected void child(int c, Trie T) kids[chrmp[c]] = T; This helps, ut even so, rrys tht my e indexed y ll chrcters vlid in key re likely to e reltively lrge (for tree node) sy on the order of M = 60 ytes even for nodes tht cn contin only digits (ssuming ytes per pointer, ytes overhed for every oject, ytes for length field in the rry). If there is totl of N chrcters in ll keys, then the spce needed is ounded y out NM/. The ound is reched only in highly pthologicl cse (where the trie contins only two very long strings tht re identicl except in their lst chrcters). Nevertheless, the rrys tht rise in tries cn e quite sprse. One pproch to solving this is to compress the tles. This is especilly pplicle when there re few insertions once some initil set of strings is ccommodted. By the wy, the techniques descried elow re generlly pplicle to ny such sprse rry, not just tries. The sic ide is tht sprse rrys (i.e., those tht mostly contin empty or null entries) cn e overlid on top of ech other y mking sure tht the non-null entries in one fll on top of null entries in the others. We llocte ll the rrys in single lrge one, nd store extr informtion with ech entry so tht we cn tell which of the overlid rrys tht entry elongs to. Here is n pproprite lterntive dt structure: strct clss Trie... sttic protected Trie[] llkids; sttic protected chr[] edgelels; sttic finl chr NOEDGE = /* Some chr tht isn t used. */ sttic llkids = new Trie[INITIAL_SPACE]; edgelels = new chr[initial_space]; for (int i = 0; i < INITIAL_SPACE; i += ) llkids[i] = EMPTY; edgelels[i] = NOEDGE;...
16 8 P. N. Hilfinger clss InnerTrie extends Trie /* Position of my child 0 in llkids. My kth child, if * non-empty, is t llkids[me + k]. If my kth child is * not empty, then edgelels[me+k] == k. edgelels[me] * is lwys 0 ( ). */ privte int me; /** A Trie with child(k) == T nd ll other children empty. */ InnerTrie(int k, Trie T) // Set me such tht edgelels[me + k].isempty(). */ child(0, EMPTY); child(k, T); pulic Trie child(int c) if (edgelels[me + c] == c) return llkids[me + c]; else return EMPTY; protected void child(int c, Trie T) if (edgelels[me + c]!= NOEDGE && edgelels[me + c]!= c) // Move my kids to new loction, nd point me t it. llkids[me + c] = T; edgelels[me + c] = c; The ide is tht when we store everyody s rry of kids in one plce, nd store n edge lel tht tells us wht chrcter is supposed to correspond to ech kid. Tht llows us to distinguish etween slot tht contins someody else s child (which mens tht I hve no child for tht chrcter), nd slot tht contins one of my children. We rrnge tht the me field for every node is unique y mking sure tht the 0th child (corresponding to is lwys full. As n exmple, Figure 6 shows the ten internl nodes of the trie in Figure 5 overlid on top of ech other. As the figure illustrtes, this representtion cn e very compct. The numer of extr empty entries tht re needed on the right (so tht SEL never indexes off the end of the rry) is limited to M, so tht it ecomes negligile when the rry is lrge enough. (Aside: When deling with set of rrys tht one wishes to compress in this wy, it is est to llocte the fullest (lest sprse) first.)
17 Blnced Serching 8 Such close pcking comes t price: insertions re expensive. When one dds new child to n existing node, the necessry slot my lredy e used y some other rry, mking it necessry to move the node to new loction y (in effect) first ersing its non-null entries from the pcked storge re, finding nother spot for it nd moving its entries there, nd finlly updting the pointer to the node eing moved in its prent. There re wys to mitigte this, ut we won t go into them here. root: e e f h e p o t s t x c... t sh fceplte fcet fric s xe se xolotl te Figure 6: A pcked version of the trie from Figure 5. Ech of the trie nodes from tht figure is represented s n rry of children indexed y chrcter, the chrcter tht is index of child is stored in the upper row (which corresponds to the rry edgelels). The pointer to the child itself is in the lower row (which corresponds to the llkids rry). Empty oxes on top indicte unused loctions (the NOEDGE vlue). To compress the digrm, I ve chnged the chrcter set encoding so tht is 0, is, is, etc. The crossed oxes in the lower row indicte empty nodes. There must lso e n dditionl empty entries on the right (not shown) to ccount for the c z entries of the rightmost trie node stored. The serch lgorithm uses edgelels to determine when n entry ctully elongs to the node it is currently exmining. For exmple, the root node is supposed to contin entries for,, nd f. And indeed, if you count,, nd 6 over from the root ox ove, you ll find entries whose edge lels re,, nd f. If, on the other hnd, you count over from the root ox, looking for the non-existent c edge, you find insted n edge lel of e, telling you tht the root node hs no c edge.
COMP 423 lecture 11 Jan. 28, 2008
COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring
More information2 Computing all Intersections of a Set of Segments Line Segment Intersection
15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design
More informationWhat are suffix trees?
Suffix Trees 1 Wht re suffix trees? Allow lgorithm designers to store very lrge mount of informtion out strings while still keeping within liner spce Allow users to serch for new strings in the originl
More informationTries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries
Tries Yufei To KAIST April 9, 2013 Y. To, April 9, 2013 Tries In this lecture, we will discuss the following exct mtching prolem on strings. Prolem Let S e set of strings, ech of which hs unique integer
More informationCS201 Discussion 10 DRAWTREE + TRIES
CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the
More informationCSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe
CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()
More informationIn the last lecture, we discussed how valid tokens may be specified by regular expressions.
LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.
More informationSuffix trees, suffix arrays, BWT
ALGORITHMES POUR LA BIO-INFORMATIQUE ET LA VISUALISATION COURS 3 Rluc Uricru Suffix trees, suffix rrys, BWT Bsed on: Suffix trees nd suffix rrys presenttion y Him Kpln Suffix trees course y Pco Gomez Liner-Time
More informationIf you are at the university, either physically or via the VPN, you can download the chapters of this book as PDFs.
Lecture 5 Wlks, Trils, Pths nd Connectedness Reding: Some of the mteril in this lecture comes from Section 1.2 of Dieter Jungnickel (2008), Grphs, Networks nd Algorithms, 3rd edition, which is ville online
More informationCS321 Languages and Compiler Design I. Winter 2012 Lecture 5
CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,
More information10.5 Graphing Quadratic Functions
0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions
More informationOutline. Introduction Suffix Trees (ST) Building STs in linear time: Ukkonen s algorithm Applications of ST
Suffi Trees Outline Introduction Suffi Trees (ST) Building STs in liner time: Ukkonen s lgorithm Applictions of ST 2 3 Introduction Sustrings String is ny sequence of chrcters. Sustring of string S is
More informationAlgorithm Design (5) Text Search
Algorithm Design (5) Text Serch Tkshi Chikym School of Engineering The University of Tokyo Text Serch Find sustring tht mtches the given key string in text dt of lrge mount Key string: chr x[m] Text Dt:
More informationInformation Retrieval and Organisation
Informtion Retrievl nd Orgnistion Suffix Trees dpted from http://www.mth.tu.c.il/~himk/seminr02/suffixtrees.ppt Dell Zhng Birkeck, University of London Trie A tree representing set of strings { } eef d
More informationLecture 10 Evolutionary Computation: Evolution strategies and genetic programming
Lecture 10 Evolutionry Computtion: Evolution strtegies nd genetic progrmming Evolution strtegies Genetic progrmming Summry Negnevitsky, Person Eduction, 2011 1 Evolution Strtegies Another pproch to simulting
More informationPosition Heaps: A Simple and Dynamic Text Indexing Data Structure
Position Heps: A Simple nd Dynmic Text Indexing Dt Structure Andrzej Ehrenfeucht, Ross M. McConnell, Niss Osheim, Sung-Whn Woo Dept. of Computer Science, 40 UCB, University of Colordo t Boulder, Boulder,
More informationIntermediate Information Structures
CPSC 335 Intermedite Informtion Structures LECTURE 13 Suffix Trees Jon Rokne Computer Science University of Clgry Cnd Modified from CMSC 423 - Todd Trengen UMD upd Preprocessing Strings We will look t
More information2-3 search trees red-black BSTs B-trees
2-3 serch trees red-lck BTs B-trees 3 2-3 tree llow 1 or 2 keys per node. 2-node: one key, two children. 3-node: two keys, three children. ymmetric order. Inorder trversl yields keys in scending order.
More informationSlides for Data Mining by I. H. Witten and E. Frank
Slides for Dt Mining y I. H. Witten nd E. Frnk Simplicity first Simple lgorithms often work very well! There re mny kinds of simple structure, eg: One ttriute does ll the work All ttriutes contriute eqully
More informationCOMBINATORIAL PATTERN MATCHING
COMBINATORIAL PATTERN MATCHING Genomic Repets Exmple of repets: ATGGTCTAGGTCCTAGTGGTC Motivtion to find them: Genomic rerrngements re often ssocited with repets Trce evolutionry secrets Mny tumors re chrcterized
More informationFig.25: the Role of LEX
The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing
More informationDefinition of Regular Expression
Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll
More informationDr. D.M. Akbar Hussain
Dr. D.M. Akr Hussin Lexicl Anlysis. Bsic Ide: Red the source code nd generte tokens, it is similr wht humns will do to red in; just tking on the input nd reking it down in pieces. Ech token is sequence
More informationbox Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example:
Boxes nd Arrows There re two kinds of vriles in Jv: those tht store primitive vlues nd those tht store references. Primitive vlues re vlues of type long, int, short, chr, yte, oolen, doule, nd flot. References
More informationCS143 Handout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexical Analysis
CS143 Hndout 07 Summer 2011 June 24 th, 2011 Written Set 1: Lexicl Anlysis In this first written ssignment, you'll get the chnce to ply round with the vrious constructions tht come up when doing lexicl
More informationASTs, Regex, Parsing, and Pretty Printing
ASTs, Regex, Prsing, nd Pretty Printing CS 2112 Fll 2016 1 Algeric Expressions To strt, consider integer rithmetic. Suppose we hve the following 1. The lphet we will use is the digits {0, 1, 2, 3, 4, 5,
More informationCSCI 3130: Formal Languages and Automata Theory Lecture 12 The Chinese University of Hong Kong, Fall 2011
CSCI 3130: Forml Lnguges nd utomt Theory Lecture 12 The Chinese University of Hong Kong, Fll 2011 ndrej Bogdnov In progrmming lnguges, uilding prse trees is significnt tsk ecuse prse trees tell us the
More informationCS481: Bioinformatics Algorithms
CS481: Bioinformtics Algorithms Cn Alkn EA509 clkn@cs.ilkent.edu.tr http://www.cs.ilkent.edu.tr/~clkn/teching/cs481/ EXACT STRING MATCHING Fingerprint ide Assume: We cn compute fingerprint f(p) of P in
More informationAgenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays
COMPSCI 5 SS Principles of Computer Science Arrys & Multidimensionl Arrys Agend & Reding Agend Arrys Creting & Using Primitive & Reference Types Assignments & Equlity Pss y Vlue & Pss y Reference Copying
More informationFrom Dependencies to Evaluation Strategies
From Dependencies to Evlution Strtegies Possile strtegies: 1 let the user define the evlution order 2 utomtic strtegy sed on the dependencies: use locl dependencies to determine which ttriutes to compute
More informationA Tautology Checker loosely related to Stålmarck s Algorithm by Martin Richards
A Tutology Checker loosely relted to Stålmrck s Algorithm y Mrtin Richrds mr@cl.cm.c.uk http://www.cl.cm.c.uk/users/mr/ University Computer Lortory New Museum Site Pemroke Street Cmridge, CB2 3QG Mrtin
More informationP(r)dr = probability of generating a random number in the interval dr near r. For this probability idea to make sense we must have
Rndom Numers nd Monte Crlo Methods Rndom Numer Methods The integrtion methods discussed so fr ll re sed upon mking polynomil pproximtions to the integrnd. Another clss of numericl methods relies upon using
More informationGraphs with at most two trees in a forest building process
Grphs with t most two trees in forest uilding process rxiv:802.0533v [mth.co] 4 Fe 208 Steve Butler Mis Hmnk Mrie Hrdt Astrct Given grph, we cn form spnning forest y first sorting the edges in some order,
More informationCS 241 Week 4 Tutorial Solutions
CS 4 Week 4 Tutoril Solutions Writing n Assemler, Prt & Regulr Lnguges Prt Winter 8 Assemling instrutions utomtilly. slt $d, $s, $t. Solution: $d, $s, nd $t ll fit in -it signed integers sine they re 5-it
More informationThe Greedy Method. The Greedy Method
Lists nd Itertors /8/26 Presenttion for use with the textook, Algorithm Design nd Applictions, y M. T. Goodrich nd R. Tmssi, Wiley, 25 The Greedy Method The Greedy Method The greedy method is generl lgorithm
More informationUnit #9 : Definite Integral Properties, Fundamental Theorem of Calculus
Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl
More informationPresentation Martin Randers
Presenttion Mrtin Rnders Outline Introduction Algorithms Implementtion nd experiments Memory consumption Summry Introduction Introduction Evolution of species cn e modelled in trees Trees consist of nodes
More informationThe dictionary model allows several consecutive symbols, called phrases
A dptive Huffmn nd rithmetic methods re universl in the sense tht the encoder cn dpt to the sttistics of the source. But, dpttion is computtionlly expensive, prticulrly when k-th order Mrkov pproximtion
More informationBefore We Begin. Introduction to Spatial Domain Filtering. Introduction to Digital Image Processing. Overview (1): Administrative Details (1):
Overview (): Before We Begin Administrtive detils Review some questions to consider Winter 2006 Imge Enhncement in the Sptil Domin: Bsics of Sptil Filtering, Smoothing Sptil Filters, Order Sttistics Filters
More information12-B FRACTIONS AND DECIMALS
-B Frctions nd Decimls. () If ll four integers were negtive, their product would be positive, nd so could not equl one of them. If ll four integers were positive, their product would be much greter thn
More informationITEC2620 Introduction to Data Structures
ITEC0 Introduction to Dt Structures Lecture 7 Queues, Priority Queues Queues I A queue is First-In, First-Out = FIFO uffer e.g. line-ups People enter from the ck of the line People re served (exit) from
More informationUnit 5 Vocabulary. A function is a special relationship where each input has a single output.
MODULE 3 Terms Definition Picture/Exmple/Nottion 1 Function Nottion Function nottion is n efficient nd effective wy to write functions of ll types. This nottion llows you to identify the input vlue with
More informationOrthogonal line segment intersection
Computtionl Geometry [csci 3250] Line segment intersection The prolem (wht) Computtionl Geometry [csci 3250] Orthogonl line segment intersection Applictions (why) Algorithms (how) A specil cse: Orthogonl
More information1 Quad-Edge Construction Operators
CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike
More informationUnion-Find Problem. Using Arrays And Chains. A Set As A Tree. Result Of A Find Operation
Union-Find Problem Given set {,,, n} of n elements. Initilly ech element is in different set. ƒ {}, {},, {n} An intermixed sequence of union nd find opertions is performed. A union opertion combines two
More informationMATH 25 CLASS 5 NOTES, SEP
MATH 25 CLASS 5 NOTES, SEP 30 2011 Contents 1. A brief diversion: reltively prime numbers 1 2. Lest common multiples 3 3. Finding ll solutions to x + by = c 4 Quick links to definitions/theorems Euclid
More informationUT1553B BCRT True Dual-port Memory Interface
UTMC APPICATION NOTE UT553B BCRT True Dul-port Memory Interfce INTRODUCTION The UTMC UT553B BCRT is monolithic CMOS integrted circuit tht provides comprehensive MI-STD- 553B Bus Controller nd Remote Terminl
More informationΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών
ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop
More informationPointwise convergence need not behave well with respect to standard properties such as continuity.
Chpter 3 Uniform Convergence Lecture 9 Sequences of functions re of gret importnce in mny res of pure nd pplied mthemtics, nd their properties cn often be studied in the context of metric spces, s in Exmples
More informationSuffix Tries. Slides adapted from the course by Ben Langmead
Suffix Tries Slides dpted from the course y Ben Lngmed en.lngmed@gmil.com Indexing with suffixes Until now, our indexes hve een sed on extrcting sustrings from T A very different pproch is to extrct suffixes
More informationMa/CS 6b Class 1: Graph Recap
M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Adm Sheffer. Office hour: Tuesdys 4pm. dmsh@cltech.edu TA: Victor Kstkin. Office hour: Tuesdys 7pm. 1:00 Mondy, Wednesdy, nd Fridy. http://www.mth.cltech.edu/~2014-15/2term/m006/
More information9 Graph Cutting Procedures
9 Grph Cutting Procedures Lst clss we begn looking t how to embed rbitrry metrics into distributions of trees, nd proved the following theorem due to Brtl (1996): Theorem 9.1 (Brtl (1996)) Given metric
More informationMisrepresentation of Preferences
Misrepresenttion of Preferences Gicomo Bonnno Deprtment of Economics, University of Cliforni, Dvis, USA gfbonnno@ucdvis.edu Socil choice functions Arrow s theorem sys tht it is not possible to extrct from
More informationCSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona
CSc 453 Compilers nd Systems Softwre 4 : Lexicl Anlysis II Deprtment of Computer Science University of Arizon collerg@gmil.com Copyright c 2009 Christin Collerg Implementing Automt NFAs nd DFAs cn e hrd-coded
More informationSection 10.4 Hyperbolas
66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol
More informationMa/CS 6b Class 1: Graph Recap
M/CS 6 Clss 1: Grph Recp By Adm Sheffer Course Detils Instructor: Adm Sheffer. TA: Cosmin Pohot. 1pm Mondys, Wednesdys, nd Fridys. http://mth.cltech.edu/~2015-16/2term/m006/ Min ook: Introduction to Grph
More informationCIS 1068 Program Design and Abstraction Spring2015 Midterm Exam 1. Name SOLUTION
CIS 1068 Progrm Design nd Astrction Spring2015 Midterm Exm 1 Nme SOLUTION Pge Points Score 2 15 3 8 4 18 5 10 6 7 7 7 8 14 9 11 10 10 Totl 100 1 P ge 1. Progrm Trces (41 points, 50 minutes) Answer the
More informationTyping with Weird Keyboards Notes
Typing with Weird Keyords Notes Ykov Berchenko-Kogn August 25, 2012 Astrct Consider lnguge with n lphet consisting of just four letters,,,, nd. There is spelling rule tht sys tht whenever you see n next
More informationSection 3.1: Sequences and Series
Section.: Sequences d Series Sequences Let s strt out with the definition of sequence: sequence: ordered list of numbers, often with definite pttern Recll tht in set, order doesn t mtter so this is one
More informationImplementing Automata. CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona
Implementing utomt Sc 5 ompilers nd Systems Softwre : Lexicl nlysis II Deprtment of omputer Science University of rizon collerg@gmil.com opyright c 009 hristin ollerg NFs nd DFs cn e hrd-coded using this
More information1. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES)
Numbers nd Opertions, Algebr, nd Functions 45. SEQUENCES INVOLVING EXPONENTIAL GROWTH (GEOMETRIC SEQUENCES) In sequence of terms involving eponentil growth, which the testing service lso clls geometric
More informationQuiz2 45mins. Personal Number: Problem 1. (20pts) Here is an Table of Perl Regular Ex
Long Quiz2 45mins Nme: Personl Numer: Prolem. (20pts) Here is n Tle of Perl Regulr Ex Chrcter Description. single chrcter \s whitespce chrcter (spce, t, newline) \S non-whitespce chrcter \d digit (0-9)
More informationLecture 10: Suffix Trees
Computtionl Genomics Prof. Ron Shmir, Prof. Him Wolfson, Dr. Irit Gt-Viks School of Computer Science, Tel Aviv University גנומיקה חישובית פרופ' רון שמיר, פרופ' חיים וולפסון, דר' עירית גת-ויקס ביה"ס למדעי
More informationMTH 146 Conics Supplement
105- Review of Conics MTH 146 Conics Supplement In this section we review conics If ou ne more detils thn re present in the notes, r through section 105 of the ook Definition: A prol is the set of points
More informationLanguages. L((a (b)(c))*) = { ε,a,bc,aa,abc,bca,... } εw = wε = w. εabba = abbaε = abba. (a (b)(c)) *
Pln for Tody nd Beginning Next week Interpreter nd Compiler Structure, or Softwre Architecture Overview of Progrmming Assignments The MeggyJv compiler we will e uilding. Regulr Expressions Finite Stte
More informationcisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:
cisc1110 fll 2010 lecture VI.2 cll y vlue function prmeters more on functions more on cll y vlue nd cll y reference pssing strings to functions returning strings from functions vrile scope glol vriles
More informationReducing a DFA to a Minimal DFA
Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,
More informationOUTPUT DELIVERY SYSTEM
Differences in ODS formtting for HTML with Proc Print nd Proc Report Lur L. M. Thornton, USDA-ARS, Animl Improvement Progrms Lortory, Beltsville, MD ABSTRACT While Proc Print is terrific tool for dt checking
More informationGrade 7/8 Math Circles Geometric Arithmetic October 31, 2012
Fculty of Mthemtics Wterloo, Ontrio N2L 3G1 Grde 7/8 Mth Circles Geometric Arithmetic Octoer 31, 2012 Centre for Eduction in Mthemtics nd Computing Ancient Greece hs given irth to some of the most importnt
More informationCS 241. Fall 2017 Midterm Review Solutions. October 24, Bits and Bytes 1. 3 MIPS Assembler 6. 4 Regular Languages 7.
CS 241 Fll 2017 Midterm Review Solutions Octoer 24, 2017 Contents 1 Bits nd Bytes 1 2 MIPS Assemly Lnguge Progrmming 2 3 MIPS Assemler 6 4 Regulr Lnguges 7 5 Scnning 9 1 Bits nd Bytes 1. Give two s complement
More informationAlignment of Long Sequences. BMI/CS Spring 2012 Colin Dewey
Alignment of Long Sequences BMI/CS 776 www.biostt.wisc.edu/bmi776/ Spring 2012 Colin Dewey cdewey@biostt.wisc.edu Gols for Lecture the key concepts to understnd re the following how lrge-scle lignment
More informationAllocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation
Alloctor Bsics Dynmic Memory Alloction in the Hep (mlloc nd free) Pges too corse-grined for llocting individul objects. Insted: flexible-sized, word-ligned blocks. Allocted block (4 words) Free block (3
More informationSimplifying Algebra. Simplifying Algebra. Curriculum Ready.
Simplifying Alger Curriculum Redy www.mthletics.com This ooklet is ll out turning complex prolems into something simple. You will e le to do something like this! ( 9- # + 4 ' ) ' ( 9- + 7-) ' ' Give this
More informationA dual of the rectangle-segmentation problem for binary matrices
A dul of the rectngle-segmenttion prolem for inry mtrices Thoms Klinowski Astrct We consider the prolem to decompose inry mtrix into smll numer of inry mtrices whose -entries form rectngle. We show tht
More information1 Drawing 3D Objects in Adobe Illustrator
Drwing 3D Objects in Adobe Illustrtor 1 1 Drwing 3D Objects in Adobe Illustrtor This Tutoril will show you how to drw simple objects with three-dimensionl ppernce. At first we will drw rrows indicting
More informationINTRODUCTION TO SIMPLICIAL COMPLEXES
INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min
More informationNotes for Graph Theory
Notes for Grph Theory These re notes I wrote up for my grph theory clss in 06. They contin most of the topics typiclly found in grph theory course. There re proofs of lot of the results, ut not of everything.
More informationthis grammar generates the following language: Because this symbol will also be used in a later step, it receives the
LR() nlysis Drwcks of LR(). Look-hed symols s eplined efore, concerning LR(), it is possile to consult the net set to determine, in the reduction sttes, for which symols it would e possile to perform reductions.
More informationFall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.
15-112 Fll 2018 Midterm 1 October 11, 2018 Nme: Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or
More informationDynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012
Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.
More informationMA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork
MA1008 Clculus nd Liner Algebr for Engineers Course Notes for Section B Stephen Wills Deprtment of Mthemtics University College Cork s.wills@ucc.ie http://euclid.ucc.ie/pges/stff/wills/teching/m1008/ma1008.html
More informationLists in Lisp and Scheme
Lists in Lisp nd Scheme Lists in Lisp nd Scheme Lists re Lisp s fundmentl dt structures, ut there re others Arrys, chrcters, strings, etc. Common Lisp hs moved on from eing merely LISt Processor However,
More informationGeorge Boole. IT 3123 Hardware and Software Concepts. Switching Algebra. Boolean Functions. Boolean Functions. Truth Tables
George Boole IT 3123 Hrdwre nd Softwre Concepts My 28 Digitl Logic The Little Mn Computer 1815 1864 British mthemticin nd philosopher Mny contriutions to mthemtics. Boolen lger: n lger over finite sets
More informationSolving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016
Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence Winter 2016 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl
More information2014 Haskell January Test Regular Expressions and Finite Automata
0 Hskell Jnury Test Regulr Expressions nd Finite Automt This test comprises four prts nd the mximum mrk is 5. Prts I, II nd III re worth 3 of the 5 mrks vilble. The 0 Hskell Progrmming Prize will be wrded
More informationLexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay
Lexicl Anlysis Amith Snyl (www.cse.iit.c.in/ s) Deprtment of Computer Science nd Engineering, Indin Institute of Technology, Bomy Septemer 27 College of Engineering, Pune Lexicl Anlysis: 2/6 Recp The input
More informationGeometric transformations
Geometric trnsformtions Computer Grphics Some slides re bsed on Shy Shlom slides from TAU mn n n m m T A,,,,,, 2 1 2 22 12 1 21 11 Rows become columns nd columns become rows nm n n m m A,,,,,, 1 1 2 22
More informationa(e, x) = x. Diagrammatically, this is encoded as the following commutative diagrams / X
4. Mon, Sept. 30 Lst time, we defined the quotient topology coming from continuous surjection q : X! Y. Recll tht q is quotient mp (nd Y hs the quotient topology) if V Y is open precisely when q (V ) X
More informationSystems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits
Systems I Logic Design I Topics Digitl logic Logic gtes Simple comintionl logic circuits Simple C sttement.. C = + ; Wht pieces of hrdwre do you think you might need? Storge - for vlues,, C Computtion
More informationCompression Outline :Algorithms in the Real World. Lempel-Ziv Algorithms. LZ77: Sliding Window Lempel-Ziv
Compression Outline 15-853:Algorithms in the Rel World Dt Compression III Introduction: Lossy vs. Lossless, Benchmrks, Informtion Theory: Entropy, etc. Proility Coding: Huffmn + Arithmetic Coding Applictions
More informationDistributed Systems Principles and Paradigms
Distriuted Systems Principles nd Prdigms Chpter 11 (version April 7, 2008) Mrten vn Steen Vrije Universiteit Amsterdm, Fculty of Science Dept. Mthemtics nd Computer Science Room R4.20. Tel: (020) 598 7784
More informationMIPS I/O and Interrupt
MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,
More informationCSCE 531, Spring 2017, Midterm Exam Answer Key
CCE 531, pring 2017, Midterm Exm Answer Key 1. (15 points) Using the method descried in the ook or in clss, convert the following regulr expression into n equivlent (nondeterministic) finite utomton: (
More informationI/O Efficient Dynamic Data Structures for Longest Prefix Queries
I/O Efficient Dynmic Dt Structures for Longest Prefix Queries Moshe Hershcovitch 1 nd Him Kpln 2 1 Fculty of Electricl Engineering, moshik1@gmil.com 2 School of Computer Science, himk@cs.tu.c.il, Tel Aviv
More informationDeletion The Two Child Case 10 Delete(5) Deletion The Two Child Case. Balanced BST. Finally
Deletion Te Two Cild Cse Delete() Deletion Te Two Cild Cse Ide: Replce te deleted node wit vlue gurnteed to e etween te two cild sutrees! Options: succ from rigt sutree: findmin(t.rigt) pred from left
More information1.1. Interval Notation and Set Notation Essential Question When is it convenient to use set-builder notation to represent a set of numbers?
1.1 TEXAS ESSENTIAL KNOWLEDGE AND SKILLS Prepring for 2A.6.K, 2A.7.I Intervl Nottion nd Set Nottion Essentil Question When is it convenient to use set-uilder nottion to represent set of numers? A collection
More informationZZ - Advanced Math Review 2017
ZZ - Advnced Mth Review Mtrix Multipliction Given! nd! find the sum of the elements of the product BA First, rewrite the mtrices in the correct order to multiply The product is BA hs order x since B is
More informationSuffix trees. December Computational Genomics
Computtionl Genomics Prof Irit Gt-Viks, Prof. Ron Shmir, Prof. Roded Shrn School of Computer Science, Tel Aviv University גנומיקה חישובית פרופ' עירית גת-ויקס, פרופ' רון שמיר, פרופ' רודד שרן ביה"ס למדעי
More informationLECT-10, S-1 FP2P08, Javed I.
A Course on Foundtions of Peer-to-Peer Systems & Applictions LECT-10, S-1 CS /799 Foundtion of Peer-to-Peer Applictions & Systems Kent Stte University Dept. of Computer Science www.cs.kent.edu/~jved/clss-p2p08
More information6.3 Volumes. Just as area is always positive, so is volume and our attitudes towards finding it.
6.3 Volumes Just s re is lwys positive, so is volume nd our ttitudes towrds finding it. Let s review how to find the volume of regulr geometric prism, tht is, 3-dimensionl oject with two regulr fces seprted
More information