id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
22,200 | sorting and selection merge-sort and recurrence equations there is another way to justify that the running time of the merge-sort algorithm is ( log (proposition namelywe can deal more directly with the recursive nature of the merge-sort algorithm in this sectionwe present such an analysis of the running time of merge-... |
22,201 | alternative implementations of merge-sort sorting linked lists the merge-sort algorithm can easily be adapted to use any form of basic queue as its container type in code fragment we provide such an implementationbased on use of the linkedqueue class from section the ( log nbound for merge-sort from proposition applies... |
22,202 | (as (bs (cs (ds ( ( ( (hs (ifigure example of an execution of the merge algorithmas implemented in code fragment using queues |
22,203 | bottom-up (nonrecursivemerge-sort there is nonrecursive version of array-based merge-sortwhich runs in ( log ntime it is bit faster than recursive merge-sort in practiceas it avoids the extra overheads of recursive calls and temporary memory at each level the main idea is to perform merge-sort bottom-upperforming the m... |
22,204 | quick-sort the next sorting algorithm we discuss is called quick-sort like merge-sortthis algorithm is also based on the divide-and-conquer paradigmbut it uses this technique in somewhat opposite manneras all the hard work is done before the recursive calls high-level description of quick-sort the quick-sort algorithm ... |
22,205 | like merge-sortthe execution of quick-sort can be visualized by means of binary recursion treecalled the quick-sort tree figure summarizes an execution of the quick-sort algorithm by showing the input and output sequences processed at each node of the quick-sort tree the step-by-step evolution of the quick-sort tree is... |
22,206 | ( ( ( ( ( ( figure visualization of quick-sort each node of the tree represents recursive call the nodes drawn with dashed lines represent calls that have not been made yet the node drawn with thick lines represents the running invocation the empty nodes drawn with thin lines represent terminated calls the remaining no... |
22,207 | ( ( ( ( ( (lfigure visualization of an execution of quick-sort note the concatenation step performed in ( (continues in figure |
22,208 | ( ( ( ( ( (rfigure visualization of an execution of quick-sort several invocations between (pand (qhave been omitted note the concatenation steps performed in (oand ( (continued from figure |
22,209 | performing quick-sort on general sequences in code fragment we give an implementation of the quick-sort algorithm that works on any sequence type that operates as queue this particular version relies on the linkedqueue class from section we provide more streamlined implementation of quick-sort using an array-based sequ... |
22,210 | running time of quick-sort we can analyze the running time of quick-sort with the same technique used for merge-sort in section namelywe can identify the time spent at each node of the quick-sort tree and sum up the running times for all the nodes examining code fragment we see that the divide step and the final concat... |
22,211 | randomized quick-sort one common method for analyzing quick-sort is to assume that the pivot will always divide the sequence in reasonably balanced manner we feel such an assumption would presuppose knowledge about the input distribution that is typically not availablehowever for examplewe would have to assume that we ... |
22,212 | now consider recursion trace for randomized quick-sort this trace defines binary treet such that each node in corresponds to different recursive call on subproblem of sorting portion of the original list say that node in is in size group if the size of ' subproblem is greater than ( / ) + and at most ( / ) let us analy... |
22,213 | additional optimizations for quick-sort an algorithm is in-place if it uses only small amount of memory in addition to that needed for the original input our implementation of heap-sortfrom section is an example of such an in-place sorting algorithm our implementation of quick-sort from code fragment does not qualify a... |
22,214 | divide step is performed by scanning the array simultaneously using local variables leftwhich advances forwardand rightwhich advances backwardswapping pairs of elements that are in reverse orderas shown in figure when these two indices pass each otherthe division step is complete and the algorithm completes by recurrin... |
22,215 | although the implementation we describe in this section for dividing the sequence into two pieces is in-placewe note that the complete quick-sort algorithm needs space for stack proportional to the depth of the recursion treewhich in this case can be as large as admittedlythe expected stack depth is (log )which is smal... |
22,216 | studying sorting through an algorithmic lens recapping our discussions on sorting to this pointwe have described several methods with either worst case or expected running time of ( log non an input sequence of size these methods include merge-sort and quick-sortdescribed in this as well as heap-sort (section in this s... |
22,217 | permutations and of are associated with the same external nodethen there are at least two objects xi and such that xi is before in but xi is after in at the same timethe output associated with must be specific reordering of swith either xi or appearing before the other but if and both cause the sorting algorithm to out... |
22,218 | linear-time sortingbucket-sort and radix-sort in the previous sectionwe showed that ( log ntime is necessaryin the worst caseto sort an -element sequence with comparison-based sorting algorithm natural question to askthenis whether there are other kinds of sorting algorithms that can be designed to run asymptotically f... |
22,219 | it is easy to see that bucket-sort runs in ( ntime and uses ( nspace hencebucket-sort is efficient when the range of values for the keys is small compared to the sequence size nsay (nor ( log nstillits performance deteriorates as grows compared to an important property of the bucket-sort algorithm is that it works corr... |
22,220 | sorting and selection to gain intuition before answering this questionwe consider the following example example consider the following sequence (we show only the keys) (( )( )( )( )( )( )( )( )if we sort stably on the first componentthen we get the sequence (( )( )( )( )( )( )( )( )if we then stably sort this sequence ... |
22,221 | comparing sorting algorithms at this pointit might be useful for us to take moment and consider all the algorithms we have studied in this book to sort an -element sequence considering running time and other factors we have studied several methodssuch as insertion-sortand selection-sortthat have ( )-time behavior in th... |
22,222 | quick-sort although its ( )-time worst-case performance makes quick-sort susceptible in real-time applications where we must make guarantees on the time needed to complete sorting operationwe expect its performance to be ( log )-timeand experimental studies have shown that it outperforms both heap-sort and merge-sort o... |
22,223 | python' built-in sorting functions python provides two built-in ways to sort data the first is the sort method of the list class as an examplesuppose that we define the following listcolors red green blue cyan magenta yellow that method has the effect of reordering the elements of the list into orderas defined by the n... |
22,224 | decorate-sort-undecorate design pattern python' support for key function when sorting is implemented using what is known as the decorate-sort-undecorate design pattern it proceeds in steps each element of the list is temporarily replaced with "decoratedversion that includes the result of the key function applied to the... |
22,225 | selection as important as it issorting is not the only interesting problem dealing with total order relation on set of elements there are number of applications in which we are interested in identifying single element in terms of its rank relative to the sorted order of the entire set examples include identifying the m... |
22,226 | randomized quick-select in applying the prune-and-search pattern to finding the kth smallest element in an unordered sequence of elementswe describe simple and practical algorithmknown as randomized quick-select this algorithm runs in (nexpected timetaken over all possible random choices made by the algorithmthis expec... |
22,227 | analyzing randomized quick-select showing that randomized quick-select runs in (ntime requires simple probabilistic argument the argument is based on the linearity of expectationwhich states that if and are random variables and is numberthen ( + ( ( and (cx ce( )where we use (zto denote the expected value of the expres... |
22,228 | exercises for help with exercisesplease visit the sitewww wiley com/college/goodrich reinforcement - give complete justification of proposition - in the merge-sort tree shown in figures through some edges are drawn as arrows what is the meaning of downward arrowhow about an upward arrowr- show that the running time of ... |
22,229 | - if the outermost while loop of our implementation of inplace quick sort (line of code fragment were changed to use condition left right (rather than left <right)there would be flaw explain the flaw and give specific input sequence on which such an implementation fails - if the conditional at line of our inplace quick... |
22,230 | creativity - linda claims to have an algorithm that takes an input sequence and produces an output sequence that is sorting of the elements in give an algorithmis sortedthat tests in (ntime if is sorted explain why the algorithm is sorted is not sufficient to prove particular output to linda' algorithm is sorting of de... |
22,231 | - our high-level description of quick-sort describes partitioning the elements into three sets leand ghaving keys less thanequal toor greater than the pivotrespectively howeverour in-place quick-sort implementation of code fragment does not gather all elements equal to the pivot into set an alternative strategy for an ... |
22,232 | sorting and selection - let be sequence of elements on which total order relation is defined recall that an inversion in is pair of elements and such that appears before in but describe an algorithm running in ( log ntime for determining the number of inversions in - let be sequence of integers describe method for prin... |
22,233 | - show that randomized quick-sort runs in ( log ntime with probability at least /nthat iswith high probabilityby answering the followinga for each input element xdefine cij (xto be / random variable that is if and only if element is in subproblems that belong to size group argue why we need not define cij for let xij b... |
22,234 | projects - implement nonrecursivein-place version of the quick-sort algorithmas described at the end of section - experimentally compare the performance of in-place quick-sort and version of quick-sort that is not in-place - perform series of benchmarking tests on version of merge-sort and quick-sort to determine which... |
22,235 | text processing contents abundance of digitized text notations for strings and the python str class pattern-matching algorithms brute force the boyer-moore algorithm the knuth-morris-pratt algorithm dynamic programming matrix chain-product dna and text sequence alignment text compression and the greedy method the huffm... |
22,236 | text processing abundance of digitized text despite the wealth of multimedia informationtext processing remains one of the dominant functions of computers computer are used to editstoreand display documentsand to transport documents over the internet furthermoredigital systems are used to archive wide range of textual ... |
22,237 | notations for strings and the python str class we use character strings as model for text when discuss algorithms for text processing character strings can come from wide variety of sourcesincluding scientificlinguisticand internet applications indeedthe following are examples of such stringss "cgtaaactgctttaatcaaacgct... |
22,238 | pattern-matching algorithms in the classic pattern-matching problemwe are given text string of length and pattern string of length mand want to find whether is substring of if sowe may want to find the lowest index within at which beginssuch that [ : +mequals por perhaps to find all indices of at which pattern begins t... |
22,239 | performance the analysis of the brute-force pattern-matching algorithm could not be simpler it consists of two nested loopswith the outer loop indexing through all possible starting indices of the pattern in the textand the inner loop indexing through each character of the patterncomparing it to its potentially corresp... |
22,240 | the boyer-moore algorithm at firstit might seem that it is always necessary to examine every character in in order to locate pattern as substring or to rule out its existence but this is not always the case the boyer-moore pattern-matching algorithmwhich we study in this sectioncan sometimes avoid comparisons between a... |
22,241 | the example of figure is rather basicbecause it only involves mismatches with the last character of the pattern more generallywhen match is found for that last characterthe algorithm continues by trying to extend the match with the second-to-last character of the pattern in its current alignment that process continues ... |
22,242 | text processing another occurrence the efficiency of the boyer-moore algorithm relies on creating lookup table that quickly determines where mismatched character occurs elsewhere in the pattern in particularwe define function last(cas if is in plast(cis the index of the last (rightmostoccurrence of in otherwisewe conve... |
22,243 | the correctness of the boyer-moore pattern-matching algorithm follows from the fact that each time the method makes shiftit is guaranteed not to "skipover any possible matches for last(cis the location of the last occurrence of in in figure we illustrate the execution of the boyer-moore pattern-matching algorithm on an... |
22,244 | the knuth-morris-pratt algorithm in examining the worst-case performances of the brute-force and boyer-moore pattern-matching algorithms on specific instances of the problemsuch as that given in example we should notice major inefficiency for certain alignment of the patternif we find several matching characters but th... |
22,245 | example consider the pattern "amalgamationfrom figure the knuth-morris-pratt (kmpfailure functionf ( )for the string is as shown in the following tablek [kf ( implementation our implementation of the kmp pattern-matching algorithm is shown in code fragment it relies on utility functioncompute kmp faildiscussed on the n... |
22,246 | constructing the kmp failure function to construct the failure functionwe use the method shown in code fragment which is "bootstrappingprocess that compares the pattern to itself as in the kmp algorithm each time we have two characters that matchwe set jk note that since we have throughout the execution of the algorith... |
22,247 | thusat each iteration of the loopeither or increases by at least (possibly both)hencethe total number of iterations of the while loop in the kmp patternmatching algorithm is at most achieving this boundof courseassumes that we have already computed the failure function for the algorithm for computing the failure functi... |
22,248 | dynamic programming in this sectionwe discuss the dynamic programming algorithm-design technique this technique is similar to the divide-and-conquer technique (section )in that it can be applied to wide variety of different problems dynamic programming can often be used to take problems that seem to require exponential... |
22,249 | defining subproblems one way to solve the matrix chain-product problem is to simply enumerate all the possible ways of parenthesizing the expression for and determine the number of multiplications performed by each one unfortunatelythe set of all different parenthesizations of the expression for is equal in number to t... |
22,250 | designing dynamic programming algorithm we can therefore characterize the optimal subproblem solutionnij as nij min {ni, nk+ di dk+ + } <=kj where ni, since no work is needed for single matrix that isnij is the minimumtaken over all possible places to perform the final multiplicationof the number of multiplications nee... |
22,251 | dna and text sequence alignment common text-processing problemwhich arises in genetics and software engineeringis to test the similarity between two text strings in genetics applicationthe two strings could correspond to two strands of dnafor which we want to compute similarities likewisein software engineering applica... |
22,252 | applying dynamic programming to the lcs problem recall that in the lcs problemwe are given two character stringsx and of length and mrespectivelyand are asked to find longest string that is subsequence of both and since and are character stringswe have natural set of indices with which to define subproblems--indices in... |
22,253 | the lcs algorithm the definition of , satisfies subproblem optimizationfor we cannot have longest common subsequence without also having longest common subsequences for the subproblems alsoit uses subproblem overlapbecause subproblem solution , can be used in several other problems (namelythe problems + , , + and + , +... |
22,254 | then we can move to the larger of , - and - , we continue this process until reaching some , (for exampleif or is as boundary casea python implementation of this strategy is given in code fragment this function constructs longest common subsequence in ( madditional timesince each pass of the while loop decrements eithe... |
22,255 | text compression and the greedy method in this sectionwe consider an important text-processing tasktext compression in this problemwe are given string defined over some alphabetsuch as the ascii or unicode character setsand we want to efficiently encode into small binary string (using only the characters and text compr... |
22,256 | (acharacter frequency (ba figure an illustration of an example huffman code for the input string " fast runner need never be afraid of the dark"(afrequency of each character of (bhuffman tree for string the code for character is obtained by tracing the path from the root of to the leaf where is storedand associating le... |
22,257 | algorithm huffman( )inputstring of length with distinct characters outputcoding tree for compute the frequency (cof each character of initialize priority queue for each character in do create single-node binary tree storing insert into with key (cwhile len( do remove min( remove min(create new binary tree with left sub... |
22,258 | tries the pattern-matching algorithms presented in section speed up the search in text by preprocessing the pattern (to compute the failure function in the knuthmorris-pratt algorithm or the last function in the boyer-moore algorithmin this sectionwe take complementary approachnamelywe present string searching algorith... |
22,259 | figure standard trie for the strings {bearbellbidbullbuysellstockstopof string of in factfor each character that can follow the prefix [ kin string of the set sthere is child of labeled with character in this waya trie concisely stores the common prefixes that exist among set of strings as special caseif there are only... |
22,260 | text processing trie for set of strings can be used to implement set or map whose keys are the strings of namelywe perform search in for string by tracing down from the root the path indicated by the characters in if this path can be traced and terminates at leaf nodethen we know is key in the map for examplein the tri... |
22,261 | (ab (bfigure word matching with standard trie(atext to be searched (articles and prepositionswhich are also known as stop wordsexcluded)(bstandard trie for the words in the textwith leaves augmented with indications of the index at which the given work begins in the text for examplethe leaf for the word stock notes tha... |
22,262 | compressed tries compressed trie is similar to standard trie but it ensures that each internal node in the trie has at least two children it enforces this rule by compressing chains of single-child nodes into individual edges (see figure let be standard trie we say that an internal node of is redundant if has one child... |
22,263 | the attentive reader may wonder whether the compression of paths provides any significant advantagesince it is offset by corresponding expansion of the node labels indeeda compressed trie is truly advantageous only when it is used as an auxiliary index structure over collection of strings already stored in primary stru... |
22,264 | suffix tries one of the primary applications for tries is for the case when the strings in the collection are all the suffixes of string such trie is called the suffix trie (also known as suffix tree or position treeof string for examplefigure shows the suffix trie for the eight suffixes of string "minimize for suffix ... |
22,265 | mi mize nimize ze nimize nimize ze ze ( : : : : : : : : : : (bfigure (asuffix trie for the string "minimize(bcompact representation of where pair denotes slice kin the reference string using suffix trie the suffix trie for string can be used to efficiently perform pattern-matching queries on text namelywe can determine... |
22,266 | search engine indexing the world wide web contains huge collection of text documents (web pagesinformation about these pages are gathered by program called web crawlerwhich then stores this information in special dictionary database web search engine allows users to retrieve relevant information from this databasethere... |
22,267 | exercises for help with exercisesplease visit the sitewww wiley com/college/goodrich reinforcement - list the prefixes of the string ="aaabbaaathat are also suffixes of - what is the longest (properprefix of the string "cgtacgttcgtacgthat is also suffix of this stringr- draw figure illustrating the comparisons done by ... |
22,268 | creativity - describe an example of text of length and pattern of length such that force the brute-force pattern-matching algorithm achieves running time that is (nmc- adapt the brute-force pattern-matching algorithm in order to implement functionrfind brute( , )that returns the index at which the rightmost occurrence ... |
22,269 | - modify the simplified boyer-moore algorithm presented in this using ideas from the kmp algorithm so that it runs in ( mtime - design an efficient algorithm for the matrix chain multiplication problem that outputs fully parenthesized expression for how to multiply the matrices in the chain using the minimum number of ... |
22,270 | - define the edit distance between two strings and of length and mrespectivelyto be the number of edits that it takes to change into an edit consists of character insertiona character deletionor character replacement for examplethe strings "algorithmand "rhythmhave edit distance design an (nm)-time algorithm for comput... |
22,271 | - perform an experimental analysis of the efficiency (number of character comparisons performedof the brute-force and kmp pattern-matching algorithms for varying-length patterns - perform an experimental analysis of the efficiency (number of character comparisons performedof the brute-force and boyer-moore patternmatch... |
22,272 | notes the kmp algorithm is described by knuthmorrisand pratt in their journal article [ ]and boyer and moore describe their algorithm in journal article published the same year [ in their articlehoweverknuth et al [ also prove that the boyer-moore algorithm runs in linear time more recentlycole [ shows that the boyer-m... |
22,273 | graph algorithms contents graphs the graph adt data structures for graphs edge list structure adjacency list structure adjacency map structure adjacency matrix structure python implementation graph traversals depth-first search dfs implementation and extensions breadth-first search transitive closure directed acyclic g... |
22,274 | graphs graph is way of representing relationships that exist between pairs of objects that isa graph is set of objectscalled verticestogether with collection of pairwise connections between themcalled edges graphs have applications in modeling many domainsincluding mappingtransportationcomputer networksand electrical e... |
22,275 | example we can associate with an object-oriented program graph whose vertices represent the classes defined in the programand whose edges indicate inheritance between classes there is an edge from vertex to vertex if the class for inherits from the class for such edges are directed because the inheritance relation only... |
22,276 | example we can study air transportation by constructing graph gcalled flight networkwhose vertices are associated with airportsand whose edges are associated with flights (see figure in graph gthe edges are directed because given flight has specific travel direction the endpoints of an edge in correspond respectively t... |
22,277 | path is sequence of alternating vertices and edges that starts at vertex and ends at vertex such that each edge is incident to its predecessor and successor vertex cycle is path that starts and ends at the same vertexand that includes at least one edge we say that path is simple if each vertex in the path is distinctan... |
22,278 | bos bos ord ord jfk jfk sfo sfo dfw dfw lax lax mia mia ( (bbos bos ord ord jfk sfo jfk sfo dfw dfw lax lax mia (cmia (dfigure examples of reachability in directed graph(aa directed path from bos to lax is highlighted(ba directed cycle (ordmiadfwlaxordis highlightedits vertices induce strongly connected subgraph(cthe s... |
22,279 | in the propositions that followwe explore few important properties of graphs proposition if is graph with edges and vertex set then deg( in justificationan edge (uvis counted twice in the summation aboveonce by its endpoint and once by its endpoint thusthe total contribution of the edges to the degrees of the vertices ... |
22,280 | the graph adt graph is collection of vertices and edges we model the abstraction as combination of three data typesvertexedgeand graph vertex is lightweight object that stores an arbitrary element provided by the user ( an airport code)we assume it supports methodelement)to retrieve the stored element an edge also stor... |
22,281 | data structures for graphs in this sectionwe introduce four data structures for representing graph in each representationwe maintain collection to store the vertices of graph howeverthe four representations differ greatly in the way they organize the edges in an edge listwe maintain an unordered list of all edges this ... |
22,282 | edge list structure the edge list structure is possibly the simplestthough not the most efficientrepresentation of graph all vertex objects are stored in an unordered list and all edge objects are stored in an unordered list we illustrate an example of the edge list structure for graph in figure (ah (bfigure (aa graph ... |
22,283 | performance of the edge list structure the performance of an edge list structure in fulfilling the graph adt is summarized in table we begin by discussing the space usagewhich is ( mfor representing graph with vertices and edges each individual vertex or edge instance uses ( spaceand the additional lists and use space ... |
22,284 | adjacency list structure in contrast to the edge list representation of graphthe adjacency list structure groups the edges of graph by storing them in smallersecondary containers that are associated with each individual vertex specificallyfor each vertex vwe maintain collection ( )called the incidence collection of vwh... |
22,285 | performance of the adjacency list structure table summarizes the performance of the adjacency list structure implementation of graphassuming that the primary collection and all secondary collections (vare implemented with doubly linked lists asymptoticallythe space requirements for an adjacency list are the same as an ... |
22,286 | adjacency map structure in the adjacency list structurewe assume that the secondary incidence collections are implemented as unordered linked lists such collection (vuses space proportional to (deg( ))allows an edge to be added or removed in ( timeand allows an iteration of all edges incident to vertex in (deg( )time h... |
22,287 | adjacency matrix structure the adjacency matrix structure for graph augments the edge list structure with matrix (that isa two-dimensional arrayas in section )which allows us to locate an edge between given pair of vertices in worst-case constant time in the adjacency matrix representationwe think of the vertices as be... |
22,288 | python implementation in this sectionwe provide an implementation of the graph adt our implementation will support directed or undirected graphsbut for ease of explanationwe first describe it in the context of an undirected graph we use variant of the adjacency map representation for each vertex vwe use python dictiona... |
22,289 | nested vertex class class vertex """lightweight vertex structure for graph ""slots _element def init (selfx) """do not call constructor directly use graph insert vertex( "" self element def element(self) """return element associated with this vertex "" return self element will allow vertex to be map/set key def hash (s... |
22,290 | graph algorithms class graph """representation of simple graph using an adjacency map "" def init (selfdirected=false) """create an empty graph (undirectedby default graph is directed if optional paramter is set to true "" self outgoing only create second map for directed graphuse alias for undirected self incoming if ... |
22,291 | def get edge(selfuv)"""return the edge from to vor none if not adjacent ""returns none if not adjacent return self outgoing[uget(vdef degree(selfvoutgoing=true)"""return number of (outgoingedges incident to vertex in the graph if graph is directedoptional parameter used to count incoming edges ""adj self outgoing if ou... |
22,292 | graph traversals greek mythology tells of an elaborate labyrinth that was built to house the monstrous minotaurwhich was part bull and part man this labyrinth was so complex that neither beast nor human could escape it no humanthat isuntil the greek herotheseuswith the help of the king' daughterariadnedecided to implem... |
22,293 | depth-first search the first traversal algorithm we consider in this section is depth-first search (dfsdepth-first search is useful for testing number of properties of graphsincluding whether there is path from one vertex to another and whether or not graph is connected depth-first search in graph is analogous to wande... |
22,294 | classifying graph edges with dfs an execution of depth-first search can be used to analyze the structure of graphbased upon the way in which edges are explored during the traversal the dfs process naturally identifies what is known as the depth-first search tree rooted at starting vertex whenever an edge (uvis used to ... |
22,295 | ( (ba ( (da ( ( figure example of depth-first search traversal on an undirected graph starting at vertex we assume that vertex' adjacencies are considered in alphabetical order visited vertices and explored edges are highlightedwith discovery edges drawn as solid lines and nontree (backedges as dashed lines(ainput grap... |
22,296 | properties of depth-first search there are number of observations that we can make about the depth-first search algorithmmany of which derive from the way the dfs algorithm partitions the edges of graph into groups we begin with the most significant property proposition let be an undirected graph on which dfs traversal... |
22,297 | running time of depth-first search in terms of its running timedepth-first search is an efficient method for traversing graph note that dfs is called at most once on each vertex (since it gets marked as visited)and therefore every edge is examined at most twice for an undirected graphonce from each of its end verticesa... |
22,298 | dfs implementation and extensions we begin by providing python implementation of the basic depth-first search algorithmoriginally described with pseudo-code in code fragment our dfs function is presented in code fragment def dfs(gudiscovered) """perform dfs of the undiscovered portion of graph starting at vertex discov... |
22,299 | reconstructing path from to we can use the basic dfs function as tool to identify the (directedpath leading from vertex to vif is reachable from this path can easily be reconstructed from the information that was recorded in the discovery dictionary during the traversal code fragment provides an implementation of secon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.