id int64 0 25.6k | text stringlengths 0 4.59k |
|---|---|
23,400 | listsstacksand queues infix to postfix conversion not only can stack be used to evaluate postfix expressionbut we can also use stack to convert an expression in standard form (otherwise known as infixinto postfix we will concentrate on small version of the general problem by allowing only the operators +*()and insistin... |
23,401 | then is read and pushed onto the stack next is read and passed through to the output the state of affairs at this juncture is as followsstack ab output nexta is read the top entry on the operator stack has lower precedence than *so nothing is output and is put on the stack nextc is read and output thus farwe have stack... |
23,402 | listsstacksand queues the next symbol read is we pop and output and then push then we read and output stack abc*+de* output now we read )so the stack is emptied back to the we output stack abc*+de*foutput we read nextit is pushed onto the stack then is read and output stack abc*+de* + output the input is now emptyso we... |
23,403 | so that the new function knows where to go after it is done the variables have generally been assigned by the compiler to machine registersand there are certain to be conflicts (usually all functions get some variables assigned to register # )especially if recursion is involved the reason that this problem is similar t... |
23,404 | listsstacksand queues /*print container from start up to but not including end *template void printiterator startiterator endostream out cout whiletrue ifstart =end returnout <*start+<endl/print and advance start figure printing container without recursiona compiler might do this (you should notcontains , elements to p... |
23,405 | queue model the basic operations on queue are enqueuewhich inserts an element at the end of the list (called the rear)and dequeuewhich deletes (and returnsthe element at the start of the list (known as the frontfigure shows the abstract model of queue array implementation of queues as with stacksany list implementation... |
23,406 | listsstacksand queues initial state front back after enqueue( back front after enqueue( back front after dequeuewhich returns back front after dequeuewhich returns front back after dequeuewhich returns back front |
23,407 | after dequeuewhich returns and makes the queue empty back front the extra code required to implement the wraparound is minimal (although it probably doubles the running timeif incrementing either back or front causes it to go past the arraythe value is reset to the first position in the array some programmers use diffe... |
23,408 | listsstacksand queues further examples include the followingr calls to large companies are generally placed on queue when all operators are busy in large universitieswhere resources are limitedstudents must sign waiting list if all computers are occupied the student who has been at computer the longest is forced off fi... |
23,409 | swap two adjacent elements by adjusting only the links (and not the datausing singly linked lists doubly linked lists implement the stl find routine that returns the iterator containing the first occurrence of in the range that begins at start and extends up to but not including end if is not foundend is returned this ... |
23,410 | listsstacksand queues looking ahead in an stl iterator requires an application of operator++which in turn advances the iterator in some cases looking at the next item in the listwithout advancing to itmay be preferable write the member function with the declaration const_iterator operator+int const to facilitate this i... |
23,411 | write program to evaluate postfix expression write program to convert an infix expression that includes ()+-*and to postfix add the exponentiation operator to your repertoire write program to convert postfix expression to infix write routines to implement two stacks using only one array your stack routines should not d... |
23,412 | listsstacksand queues in the list assume that you are given linked list that contains nodeshoweverthe value of is unknown design an (nalgorithm to determine if the list contains cycle you may use (nextra space repeat part ( )but use only ( extra space (hintuse two iterators that are initially at the start of the list b... |
23,413 | trees for large amounts of inputthe linear access time of linked lists is prohibitive in this we look at simple data structure for which the average running time of most operations is (log nwe also sketch conceptually simple modification to this data structure that guarantees the above time bound in the worst case and ... |
23,414 | trees root figure generic tree figure tree in the tree of figure the root is node has as parent and kland as children each node may have an arbitrary number of childrenpossibly zero nodes with no children are known as leavesthe leaves in the tree above are bchipqklmand nodes with the same parent are siblingsthuskland a... |
23,415 | struct treenode object elementtreenode *firstchildtreenode *nextsibling}figure node declarations for trees figure first child/next sibling representation of the tree shown in figure structurebecause there would be too much wasted space the solution is simplekeep the children of each node in linked list of tree nodes th... |
23,416 | trees /usrmarkbookch ch figure coursealexjunk ch cop fallsprsumsyl syl syl junk billworkcoursecop fallgrades prog fallprog prog prog grades unix directory void filesystem::listallint depth const printnamedepth )/print the name of the object ifisdirectoryfor each file in this directory (for each childc listalldepth )fig... |
23,417 | /usr mark book ch ch ch course cop fall syl spr syl sum syl junk alex junk bill work course cop fall grades prog prog fall prog prog grades figure the (preorderdirectory listing node furthermoreline can be executed at most once for each child of each node but the number of children is exactly one less than the number o... |
23,418 | trees /usr*( book*( mark*( alex*( bill*( course*( junk ( junk ( work*( cop *( ch ( ch ( ch ( cop *( figure course*( fall*( fall*( fall*( spr*( sum*( syl ( syl ( syl ( grades( prog ( prog ( prog ( prog ( grades( unix directory with file sizes obtained via postorder traversal int filesystem::sizeconst int totalsize sizeo... |
23,419 | ch ch ch book syl fall syl spr syl sum cop course junk mark junk alex work grades prog prog fall prog prog grades fall cop course bill /usr figure trace of the size function root tl figure generic binary tree tr |
23,420 | trees figure worst-case binary tree implementation because binary tree node has at most two childrenwe can keep direct links to them the declaration of tree nodes is similar in structure to that for doubly linked listsin that node is structure consisting of the element information plus two pointers (left and rightto ot... |
23,421 | figure expression tree for ( (( gobtained by recursively evaluating the left and right subtrees in our examplethe left subtree evaluates to ( cand the right subtree evaluates to (( efg the entire tree therefore represents ( ( )((( efgwe can produce an (overly parenthesizedinfix expression by recursively producing paren... |
23,422 | trees the first two symbols are operandsso we create one-node trees and push pointers to them onto stack nexta is readso two pointers to trees are poppeda new tree is formedand pointer to it is pushed onto the stack nextcdand are readand for each one-node tree is created and pointer to the corresponding tree is pushed ... |
23,423 | continuinga is readso we pop two tree pointers and form new tree with as root finallythe last symbol is readtwo trees are mergedand pointer to the final tree is left on the stack |
23,424 | trees the search tree adt--binary search trees an important application of binary trees is their use in searching let us assume that each node in the tree stores an item in our exampleswe will assumefor simplicitythat these are integersalthough arbitrarily complex items are easily handled in +we will also assume that a... |
23,425 | template class binarysearchtree publicbinarysearchtree)binarysearchtreeconst binarysearchtree rhs )binarysearchtreebinarysearchtree &rhs )~binarysearchtree)const comparable findminconstconst comparable findmaxconstbool containsconst comparable constbool isemptyconstvoid printtreeostream out cout constvoid makeempty)voi... |
23,426 | trees /*returns true if is found in the tree *bool containsconst comparable const return containsxroot )/*insert into the treeduplicates are ignored *void insertconst comparable insertxroot )/*remove from the tree nothing is done if is not found *void removeconst comparable removexroot )figure illustration of public me... |
23,427 | /*internal method to test if an item is in subtree is item to search for is the node that roots the subtree *bool containsconst comparable xbinarynode * const ift =nullptr return falseelse ifx element return containsxt->left )else ift->element return containsxt->right )else return true/match figure contains operation f... |
23,428 | trees template class binarysearchtree public/same methodswith object replacing comparable privatebinarynode *rootcomparator islessthan/same methodswith object replacing comparable /*internal method to test if an item is in subtree is item to search for is the node that roots the subtree *bool containsconst object xbina... |
23,429 | /*internal method to find the smallest item in subtree return node containing the smallest item *binarynode findminbinarynode * const ift =nullptr return nullptrift->left =nullptr return treturn findmint->left )figure recursive implementation of findmin for binary search trees /*internal method to find the largest item... |
23,430 | trees this strategy does not work if the key that guides the operator is only part of larger structure if that is the casethen we can keep all of the structures that have the same key in an auxiliary data structuresuch as list or another search tree figure shows the code for the insertion routine lines and recursively ... |
23,431 | will be insert( , ->leftor insert( , ->righteither wayt is now reference to either ->left or ->rightmeaning that ->left or ->right will be changed to point at the new node all in alla slick maneuver remove as is common with many data structuresthe hardest operation is deletion once we have found the node to be deletedw... |
23,432 | trees figure deletion of node ( with two childrenbefore and after /*internal method to remove from subtree is the item to remove is the node that roots the subtree set the new root of the subtree *void removeconst comparable xbinarynode ift =nullptr return/item not founddo nothing ifx element removext->left )else ift->... |
23,433 | destructor and copy constructor as usualthe destructor calls makeempty the public makeempty (not shownsimply calls the private recursive version as shown in figure after recursively processing ' childrena call to delete is made for thus all nodes are recursively reclaimed notice that at the endtand thus rootis changed ... |
23,434 | trees /*copy constructor *binarysearchtreeconst binarysearchtree rhs rootnullptr root clonerhs root )/*internal method to clone subtree *binarynode clonebinarynode * const ift =nullptr return nullptrelse return new binarynodet->elementclonet->left )clonet->right }figure copy constructor and recursive clone member funct... |
23,435 | figure randomly generated binary search tree it seems only to be theoretical novelty it has been shown that if we alternateinsertions and deletions ( timesthen the trees will have an expected depth of nafter quarter-million random insert/remove pairsthe tree that was somewhat right-heavy in figure looks decidedly unb... |
23,436 | trees actually proved this in any eventthis phenomenon appears to be mostly theoretical noveltybecause the effect does not show up at all for small treesandstranger stillif ( insert/remove pairs are usedthen the tree seems to gain balancethe main point of this discussion is that deciding what "averagemeans is generally... |
23,437 | another balance condition would insist that every node must have left and right subtrees of the same height if the height of an empty subtree is defined to be - (as is usual)then only perfectly balanced trees of nodes would satisfy this criterion thusalthough this guarantees trees of small depththe balance condition is... |
23,438 | trees figure smallest avl tree of height let us call the node that must be rebalanced since any node has at most two childrenand height imbalance requires that ' two subtreesheights differ by twoit is easy to see that violation might occur in four cases an insertion into the left subtree of the left child of an inserti... |
23,439 | single rotation figure shows the single rotation that fixes case the before picture is on the left and the after is on the right let us analyze carefully what is going on node violates the avl balance property because its left subtree is two levels deeper than its right subtree (the dashed lines in the middle of the di... |
23,440 | trees figure avl property destroyed by insertion of then fixed by single rotation figure single rotation fixes case property is violated at the root we perform single rotation between the root and its left child to fix the problem here are the before and after trees before after dashed line joins the two nodes that are... |
23,441 | before after next we insert this causes balance problem at the rootsince its left subtree is of height and its right subtree would be height thereforewe perform single rotation at the root between and before after the rotation is performed by making child of and ' original left subtree the new right subtree of every it... |
23,442 | trees figure single rotation fails to fix case figure left-right double rotation to fix case tree may be viewed as four subtrees connected by three nodes as the diagram suggestsexactly one of tree or is two levels deeper than (unless all are empty)but we cannot be sure which one it turns out not to matterin figure both... |
23,443 | by double rotation in both cases the effect is the same as rotating between ' child and grandchildand then between and its new child we will continue our previous example by inserting through in reverse orderfollowed by and then inserting is easysince it does not destroy the balance propertybut inserting causes height ... |
23,444 | trees before after insertion of will also require single rotation after before to insert single rotation needs to be performedand the same is true for the subsequent insertion of we insert without rotationcreating an almost perfectly balanced tree before |
23,445 | finallywe will insert to show the symmetric case of the double rotation notice that causes the node containing to become unbalanced since is between and (which is ' child on the path to ) double rotation needs to be performedyielding the following tree after let us summarize what happens the programming details are fai... |
23,446 | trees struct avlnode comparable elementavlnode *leftavlnode *rightint heightavlnodeconst comparable eleavlnode *ltavlnode *rtint elementele }leftlt }rightrt }heighth avlnodecomparable &eleavlnode *ltavlnode *rtint elementstd::moveele }leftlt }rightrt }heighth }figure node declaration for avl trees /*return the height o... |
23,447 | /*internal method to insert into subtree is the item to insert is the node that roots the subtree set the new root of the subtree *void insertconst comparable xavlnode ift =nullptr new avlnodexnullptrnullptr }else ifx element insertxt->left )else ift->element insertxt->right )balancet )static const int allowed_imbalanc... |
23,448 | trees figure single rotation /*rotate binary tree node with left child for avl treesthis is single rotation for case update heightsthen set new root *void rotatewithleftchildavlnode avlnode * ->leftk ->left ->rightk ->right ->height maxheightk ->left )heightk ->right ->height maxheightk ->left ) ->height figure routine... |
23,449 | /*double rotate binary tree nodefirst left child with its right childthen node with new left child for avl treesthis is double rotation for case update heightsthen set new root *void doublewithleftchildavlnode rotatewithrightchildk ->left )rotatewithleftchildk )figure routine to perform double rotation /*internal metho... |
23,450 | trees instead of specifically to ensure that single rotations are done in these cases rather than double rotations we leave verification of the remaining cases as an exercise splay trees we now describe relatively simple data structure known as splay tree that guarantees that any consecutive tree operations starting fr... |
23,451 | the access path is dashed firstwe would perform single rotation between and its parentobtaining the following treek thenwe rotate between and obtaining the next treek then two more rotations are performed until we reach the root |
23,452 | trees these rotations have the effect of pushing all the way to the rootso that future accesses on are easy (for whileunfortunatelyit has pushed another node ( almost as deep as used to be an access on that node will then push another node deepand so on although this strategy makes future accesses of cheaperit has not ... |
23,453 | figure zig-zag figure zig-zig path let be (non-rootnode on the access path at which we are rotating if the parent of is the root of the treewe merely rotate and the root this is the last rotation along the access path otherwisex has both parent (pand grandparent ( )and there are two casesplus symmetriesto consider the ... |
23,454 | trees the next splay step at is zig-zigso we do the zig-zig rotation with and obtaining the final treek although it is hard to see from small examplessplaying not only moves the accessed node to the root but also has the effect of roughly halving the depth of most nodes on the access path (some shallow nodes are pushed... |
23,455 | takes unitsthe access on the node with item will only take about / units instead of unitsthere are no nodes quite as deep as before an access on the node with item will bring nodes to within / of the rootand this is repeated until the depth becomes roughly log (an example with is too small to see the effect wellfigures... |
23,456 | trees figure result of splaying the previous tree at node figure result of splaying the previous tree at node figure result of splaying the previous tree at node we can perform deletion by accessing the node to be deleted this puts the node at the root if it is deletedwe get two subtrees tl and tr (left and rightif we ... |
23,457 | figure result of splaying the previous tree at node figure result of splaying the previous tree at node figure result of splaying the previous tree at node figure result of splaying the previous tree at node |
23,458 | trees figure result of splaying the previous tree at node the analysis of splay trees is difficultbecause it must take into account the everchanging structure of the tree on the other handsplay trees are much simpler to program than most balanced search treessince there are fewer cases to consider and no balance inform... |
23,459 | /*print the tree contents in sorted order *void printtreeostream out cout const ifisemptyout <"empty tree<endlelse printtreerootout )/*internal method to print subtree rooted at in sorted order *void printtreebinarynode *tostream out const ift !nullptr printtreet->leftout )out element <endlprinttreet->rightout )figure ... |
23,460 | trees to the node that roots the subtreeand do not declare or pass any extra variables the more compact the codethe less likely that silly bug will turn up fourthless often usedtraversal (which we have not seen yetis level-order traversal in level-order traversalall nodes at depth are processed before any node at depth... |
23,461 | figure -ary tree of nodes has only three levels we want to reduce the number of disk accesses to very small constantsuch as three or four we are willing to write complicated code to do thisbecause machine instructions are essentially freeas long as we are not ridiculously unreasonable it should probably be clear that b... |
23,462 | trees figure -tree of order an example of -tree of order is shown in figure notice that all nonleaf nodes have between three and five children (and thus between two and four keys)the root could possibly have only two children herewe have it happens that and are the same in this examplebut this is not necessary since is... |
23,463 | figure -tree after insertion of into the tree in figure leavesboth guaranteed to have the minimum number of data records needed we form two leaves with three items each two disk accesses are required to write these leavesand third disk access is required to update the parent note that in the parentboth keys and branche... |
23,464 | trees figure insertion of into the -tree in figure causes split into two leaves and then split of the parent node when nonleaf node is splitas is the case hereits parent gains child what if the parent already has reached its limit of childrenthen we continue splitting nodes up the tree until either we find parent that ... |
23,465 | percolate all the way up to the root the root cannot have just one child (and even if this were allowedit would be sillyif root is left with one child as result of the adoption processthen we remove the root and make its child the new root of the tree this is the only way for -tree to lose height for examplesuppose we ... |
23,466 | trees set sforint ++ inserts end) )there are several versions of eraseint eraseconst object )iterator eraseiterator itr )iterator eraseiterator startiterator end )the first one-parameter erase removes (if foundand returns the number of items actually removedwhich is obviously either or the second one-parameter erase be... |
23,467 | iterator it returns references pair using only these operations is often not worthwhile because the syntactic baggage can be expensive fortunatelythe map has an important extra operation that yields simple syntax the array-indexing operator is overloaded for maps as followsvaluetype operator[const keytype key )the sema... |
23,468 | trees binary search tree typicallyan avl tree is not usedinsteadtop-down red-black treeswhich are discussed in section are often used an important issue in implementing set and map is providing support for the iterator classes of courseinternallythe iterator maintains pointer to the "currentnode in the iteration the ha... |
23,469 | void printhighchangeablesconst mapadjacentwordsint minwords forauto entry adjacentwords const vector words entry secondifwords size>minwords cout <entry first <(<words size<"):"forauto str words cout <<strcout <endlfigure given map containing words as keys and vector of words that differ in only one character as values... |
23,470 | trees /returns true if word and word are the same length /and differ in only one character bool onecharoffconst string word const string word ifword length!word lengthreturn falseint diffs forint word length)++ ifword !word if++diffs return falsereturn diffs = figure routine to check if two words differ in only one cha... |
23,471 | /computes map in which the keys are words and values are vectors of words /that differ in only one character from the corresponding key /uses quadratic algorithmbut speeds things up little by /maintaining an additional map that groups words by their length mapcomputeadjacentwordsconst vector words mapadjwordsmapwordsby... |
23,472 | trees the second character of the four-letter word groupwith new mapand then the third characterand finally the fourth character the general outline is for each group gcontaining words of length len for each position (ranging from to len- make an empty maprepstowords for each word obtain ' representative by removing po... |
23,473 | /remove one character in specified positioncomputing representative /words with same representatives are adjacentso populate map mapreptowordforauto str groupswords string rep strrep erasei )reptowordrep push_backstr )/and then look for map values with more than one string forauto entry reptoword const vector clique en... |
23,474 | trees search trees are of great importance in algorithm design they support almost all the useful operationsand the logarithmic average cost is very small nonrecursive implementations of search trees are somewhat fasterbut the recursive versions are sleekermore elegantand easier to understand and debug the problem with... |
23,475 | figure tree for exercises to show that the maximum number of nodes in binary tree of height is + full node is node with two children prove that the number of full nodes plus one is equal to the number of leaves in nonempty binary tree suppose binary tree has leaves lm at depths dm respectively -di < and determine when ... |
23,476 | trees let (nbe the average number of full nodes in an -node binary search tree determine the values of ( and ( show that for - ( (if( ) - (ni= show (by inductionthat ( ( )/ is solution to the equation in part ( )with the initial conditions in part (ad use the results of exercise to determine the average number of leave... |
23,477 | prove that the depth of random binary search tree (depth of the deepest nodeis (log )on average give precise expression for the minimum number of nodes in an avl tree of height what is the minimum number of nodes in an avl tree of height show the result of inserting into an initially empty avl tree keys are inserted ... |
23,478 | trees show that if all nodes in splay tree are accessed in sequential orderthen the total access time is ( )regardless of the initial tree write program to perform random operations on splay trees count the total number of rotations performed over the sequence how does the running time compare to avl trees and unbala... |
23,479 | write general-purpose tree-drawing program that will convert tree into the following graph-assembler instructionsa circle(xyb drawline(ijthe first instruction draws circle at (xy)and the second instruction connects the ith circle to the jth circle (circles are numbered in the order drawnyou should either make this prog... |
23,480 | trees figure two isomorphic trees what is the running time of your program (there is linear solution) show that via avl single rotationsany binary search tree can be transformed into another search tree (with the same itemsb give an algorithm to perform this transformation using ( log nrotations on average show that ... |
23,481 | ix{series|({ ix{series!geometric|({ ix{euler' constant{ ix{series!geometric|){ ix{series!arithmetic|({ ix{series!arithmetic|){ ix{series!harmonic|({ ix{euler' constant{ ix{series!harmonic|){ ix{series|){ figure sample input for exercise euler' constant series - arithmetic - geometric harmonic figure sample output for e... |
23,482 | trees is sometimes known as -tree survey of the different types of -trees is presented in [ empirical results of the various schemes are reported in [ analysis of - trees and -trees can be found in [ ][ ]and [ exercise is deceptively difficult solution can be found in [ exercise is from [ information on *-treesdescribe... |
23,483 | guibas and sedgewick" dichromatic framework for balanced trees,proceedings of the nineteenth annual ieee symposium on foundations of computer science ( ) - hibbard"some combinatorial properties of certain trees with applications to searching and sorting,journal of the acm ( ) - jonassen and knuth" trivial algorithm who... |
23,484 | |
23,485 | hashing in we discussed the search tree adtwhich allowed various operations on set of elements in this we discuss the hash table adtwhich supports only subset of the operations allowed by binary search trees the implementation of hash tables is frequently called hashing hashing is technique used for performing insertio... |
23,486 | hashing john phil dave mary figure an ideal hash table this is the basic idea of hashing the only remaining problems deal with choosing functiondeciding what to do when two keys hash to the same value (this is known as collision)and deciding on the table size hash function if the input keys are integersthen simply retu... |
23,487 | int hashconst string keyint tablesize int hashval forchar ch key hashval +chreturn hashval tablesizefigure simple hash function int hashconst string keyint tablesize return key key key tablesizefigure another possible hash function--not too good reasonably equitable distribution unfortunatelyenglish is not random altho... |
23,488 | hashing the hash function takes advantage of the fact that overflow is allowed and uses unsigned int to avoid introducing negative number the hash function described in figure is not necessarily the best with respect to table distributionbut it does have the merit of extreme simplicity and is reasonably fast if the key... |
23,489 | template class hashtable publicexplicit hashtableint size )bool containsconst hashedobj constvoid makeempty)bool insertconst hashedobj )bool inserthashedobj & )bool removeconst hashedobj )privatevectorthelistsint currentsize/the array of lists void rehash)size_t myhashconst hashedobj const}figure type declaration for s... |
23,490 | hashing default implementations of this template are provided for standard types such as int and stringthusthe hash function described in figure could be implemented as template class hash publicsize_t operator()const string key size_t hashval forchar ch key hashval hashval chreturn hashval}the type size_t is an unsign... |
23,491 | /example of an employee class class employee publicconst string getnameconst return namebool operator==const employee rhs const return getname=rhs getname)bool operator!=const employee rhs const return !*this =rhs/additional public members not shown privatestring namedouble salaryint seniority/additional private member... |
23,492 | hashing void makeemptyforauto thislist thelists thislist clear)bool containsconst hashedobj const auto whichlist thelistsmyhashx ]return findbeginwhichlist )endwhichlist ) !endwhichlist )bool removeconst hashedobj auto whichlist thelistsmyhashx ]auto itr findbeginwhichlist )endwhichlist ) )ifitr =endwhichlist return fa... |
23,493 | hash tables without linked lists separate chaining hashing has the disadvantage of using linked lists this could slow the algorithm down bit because of the time required to allocate new cells (especially in other languagesand essentially requires the implementation of second data structure an alternative to resolving c... |
23,494 | hashing unsuccessful searchesand ( /( )for successful searches the calculations are somewhat involved it is easy to see from the code that insertions and unsuccessful searches require the same number of probes moment' thought suggests thaton averagesuccessful searches should take less time than unsuccessful searches th... |
23,495 | , , figure number of probes plotted against load factor for linear probing (dashedand random strategy ( is successful searchu is unsuccessful searchand is insertionempty table after after after after after figure hash table with quadratic probingafter each insertion triedbut another collision occurs vacant cell is foun... |
23,496 | hashing theorem if quadratic probing is usedand the table size is primethen new element can always be inserted if the table is at least half empty proof let the table sizetablesizebe an (oddprime greater than we show that the first tablesize/ alternative locations (including the initial location ( )are all distinct tw... |
23,497 | template class hashtable publicexplicit hashtableint size )bool containsconst hashedobj constvoid makeempty)bool insertconst hashedobj )bool inserthashedobj & )bool removeconst hashedobj )enum entrytype activeemptydeleted }privatestruct hashentry hashedobj elemententrytype infohashentryconst hashedobj hashedobj}entryty... |
23,498 | hashing explicit hashtableint size arraynextprimesize makeempty)void makeemptycurrentsize forauto entry array entry info emptyfigure routines to initialize quadratic probing hash table bool containsconst hashedobj const return isactivefindposx )int findposconst hashedobj const int offset int currentpos myhashx )whilear... |
23,499 | bool insertconst hashedobj /insert as active int currentpos findposx )ifisactivecurrentpos return falsearraycurrentpos element xarraycurrentpos info active/rehashsee section if++currentsize array size rehash)return truebool removeconst hashedobj int currentpos findposx )if!isactivecurrentpos return falsearraycurrentpos... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.