id
int64
0
25.6k
text
stringlengths
0
4.59k
22,000
the euler tour traversal of binary tree in section we introduced the concept of an euler tour traversal of general graphusing the template method pattern in designing the eulertour class that class provided methods hook previsit and hook postvisit that could be overridden to customize tour in code fragment we provide b...
22,001
figure an inorder drawing of binary tree to demonstrate use of the binaryeulertour frameworkwe develop subclass that computes graphical layout of binary treeas shown in figure the geometry is determined by an algorithm that assigns xand -coordinates to each position of binary tree using the following two rulesx(pis the...
22,002
case studyan expression tree in example we introduced the use of binary tree to represent the structure of an arithmetic expression in this sectionwe define new expressiontree class that provides support for constructing such treesand for displaying and evaluating the arithmetic expression that such tree represents our...
22,003
class expressiontree(linkedbinarytree) """an arithmetic expression tree "" def init (selftokenleft=noneright=none) """create an expression tree in single parameter formtoken should be leaf value ( ) and the expression tree will have that value at an isolated node in three-parameter versiontoken should be an operator an...
22,004
expression tree evaluation the numeric evaluation of an expression tree can be accomplished with simple application of postorder traversal if we know the values represented by the two subtrees of an internal positionwe can calculate the result of the computation that position designates pseudo-code for the recursive ev...
22,005
building an expression tree the constructor for the expressiontree classfrom code fragment provides basic functionality for combining existing trees to build larger expression trees howeverthe question still remains how to construct tree that represents an expression for given stringsuch as ((( + ) )/(( - )+ )to automa...
22,006
exercises for help with exercisesplease visit the sitewww wiley com/college/goodrich reinforcement - the following questions refer to the tree of figure which node is the rootb what are the internal nodesc how many descendants does node cs haved how many ancestors does node cs havee what are the siblings of node homewo...
22,007
- find the value of the arithmetic expression associated with each subtree of the binary tree of figure - draw an arithmetic expression tree that has four external nodesstoring the numbers and (with each number stored in distinct external nodebut not necessarily in this order)and has three internal nodeseach storing an...
22,008
- in what order are positions visited during postorder traversal of the tree of figure - let be an ordered tree with more than one node is it possible that the preorder traversal of visits the nodes in the same order as the postorder traversal of if sogive an exampleotherwiseexplain why this cannot occur likewiseis it ...
22,009
- let be (not necessarily properbinary tree with nodesand let be the sum of the depths of all the external nodes of show that if has the minimum number of external nodes possiblethen is (nand if has the maximum number of external nodes possiblethen is ( log nc- let be (possibly improperbinary tree with nodesand let be ...
22,010
- describe how to clone linkedbinarytree instance representing proper binary treewith use of the attach method - describe how to clone linkedbinarytree instance representing (not necessarily properbinary treewith use of the add left and add right methods - we can define binary tree representation for an ordered general...
22,011
- given proper binary tree define the reflection of to be the binary tree such that each node in is also in but the left child of in is ' right child in and the right child of in is ' left child in show that preorder traversal of proper binary tree is the same as the postorder traversal of ' reflectionbut in reverse or...
22,012
sales domestic international canada america africa overseas europe (aasia australia sales domestic international canada america overseas africa europe asia australia (bfigure (atree (bindented parenthetic representation of - the indented parenthetic representation of tree is variation of the parenthetic representation ...
22,013
- note that the build expression tree function of the expressiontree class is written in such way that leaf token can be any stringfor exampleit parses the expression ( *( + )howeverwithin the evaluate methodan error would occur when attempting to convert leaf token to number modify the evaluate method to accept an opt...
22,014
(ac (bfigure (aslicing floor plan(bslicing tree associated with the floor plan of the basic rectangles namelythis problem requires the assignment of values (pand (pto each position of the slicing tree such thatif is leaf whose basic rectangle has minimum width if is an internal positionassociated with max( () ( ) hori...
22,015
- write program that can play tic-tac-toe effectively (see section to do thisyou will need to create game tree which is tree where each position corresponds to game configurationwhichin this caseis representation of the tic-tac-toe board (see section the root corresponds to the initial configuration for each internal p...
22,016
priority queues contents the priority queue abstract data type priorities the priority queue adt implementing priority queue the composition design pattern implementation with an unsorted list implementation with sorted list heaps the heap data structure implementing priority queue with heap array-based representation ...
22,017
the priority queue abstract data type priorities in we introduced the queue adt as collection of objects that are added and removed according to the first-infirst-out (fifoprinciple company' customer call center embodies such model in which waiting customers are told "calls will be answered in the order that they were ...
22,018
the priority queue adt formallywe model an element and its priority as key-value pair we define the priority queue adt to support the following methods for priority queue pp add(kv)insert an item with key and value into priority queue min)return tuple( , )representing the key and value of an item in priority queue with...
22,019
implementing priority queue in this sectionwe show how to implement priority queue by storing its entries in positional list (see section we provide two realizationsdepending on whether or not we keep the entries in sorted by key the composition design pattern one challenge in implementing priority queue is that we mus...
22,020
implementation with an unsorted list in our first concrete implementation of priority queuewe store entries within an unsorted list our unsortedpriorityqueue class is given in code fragment inheriting from the priorityqueuebase class introduced in code fragment for internal storagekey-value pairs are represented as com...
22,021
class unsortedpriorityqueue(priorityqueuebase)base class defines item """ min-oriented priority queue implemented with an unsorted list "" nonpublic utility def find min(self) """return position of item with minimum key ""is empty inherited from base class if self is empty) raise emptypriority queue is empty small self...
22,022
implementation with sorted list an alternative implementation of priority queue uses positional listyet maintaining entries sorted by nondecreasing keys this ensures that the first element of the list is an entry with the smallest key our sortedpriorityqueue class is given in code fragment the implementation of min and...
22,023
class sortedpriorityqueue(priorityqueuebase)base class defines item """ min-oriented priority queue implemented with sorted list "" def init (self) """create new empty priority queue "" self data positionallist def len (self) """return the number of items in the priority queue "" return len(self data def add(selfkeyval...
22,024
heaps the two strategies for implementing priority queue adt in the previous section demonstrate an interesting trade-off when using an unsorted list to store entrieswe can perform insertions in ( timebut finding or removing an element with minimum key requires an ( )-time loop through the entire collection in contrast...
22,025
( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ,wfigure example of heap storing entries with integer keys the last position is the one storing entry ( , the tree in figure is complete because levels and are fulland the six nodes in level are in the six leftmost possible positions at that level in formalizing what we...
22,026
implementing priority queue with heap proposition has an important consequencefor it implies that if we can perform update operations on heap in time proportional to its heightthen those operations will run in logarithmic time let us therefore turn to the problem of how to efficiently perform various priority queue met...
22,027
( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( ( ...
22,028
removing the item with minimum key let us now turn to method remove min of the priority queue adt we know that an entry with the smallest key is stored at the root of (even if there is more than one entry with smallest keyhoweverin general we cannot simply delete node rbecause this would leave two disconnected subtrees...
22,029
( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( ( , ( , ( , ( , ( , ( , ( ( , ( , ( , ( , ( ( , ( , ( , ( ...
22,030
array-based representation of complete binary tree the array-based representation of binary tree (section is especially suitable for complete binary tree we recall that in this implementationthe elements of are stored in an array-based list such that the element at position in is stored in with index equal to the level...
22,031
class heappriorityqueue(priorityqueuebase)base class defines item """ min-oriented priority queue implemented with binary heap "" nonpublic behaviors def parent(selfj) return ( - / def left(selfj) return def right(selfj) return def has left(selfj) return self left(jlen(self dataindex beyond end of list def has right(se...
22,032
public behaviors def init (self)"""create new empty priority queue ""self data def len (self)"""return the number of items in the priority queue ""return len(self datadef add(selfkeyvalue)"""add key-value pair to the priority queue ""self data append(self item(keyvalue)upheap newly added position self upheap(len(self d...
22,033
analysis of heap-based priority queue table shows the running time of the priority queue adt methods for the heap implementation of priority queueassuming that two keys can be compared in ( time and that the heap is implemented with an array-based or linked-based tree representation in shorteach of the priority queue a...
22,034
bottom-up heap construction if we start with an initially empty heapn successive calls to the add operation will run in ( log ntime in the worst case howeverif all key-value pairs to be stored in the heap are given in advancesuch as during the first phase of the heapsort algorithmthere is an alternative bottom-up const...
22,035
( ( ( ( ( ( ( (hfigure bottom-up construction of heap with entries( and bwe begin by constructing -entry heaps on the bottom level( and dwe combine these heaps into -entry heapsand then ( and -entry heapsuntil ( and hwe create the final heap the paths of the down-heap bubblings are highlighted in (dfand hfor simplicity...
22,036
python implementation of bottom-up heap construction implementing bottom-up heap construction is quite easygiven the existence of "down-heaputility function the "mergingof two equally sized heaps that are subtrees of common position pas described in the opening of this sectioncan be accomplished simply by down-heaping ...
22,037
asymptotic analysis of bottom-up heap construction bottom-up heap construction is asymptotically faster than incrementally inserting keys into an initially empty heap intuitivelywe are performing single downheap operation at each position in the treerather than single up-heap operation from each since more nodes are cl...
22,038
python' heapq module python' standard distribution includes heapq module that provides support for heap-based priority queues that module does not provide any priority queue classinstead it provides functions that allow standard python list to be managed as heap its model is essentially the same as our ownwith elements...
22,039
sorting with priority queue in defining the priority queue adtwe noted that any type of object can be used as keybut that any pair of keys must be comparable to each otherand that the set of keys be naturally ordered in pythonit is common to rely on the operator to define such an orderin which case the following proper...
22,040
apple banana suppose that we have an application in which we have list of strings that are all known to represent integral values ( )and our goal is to sort the strings according to those integral values in pythonthe standard approach for customizing the order for sorting algorithm is to provideas an optional parameter...
22,041
input phase phase ( (bcollection ( ( ( priority queue (( ( ( ( ( ( ( ( ( (( ( ( ( ( ( ( ( ( ( ( ( (figure execution of selection-sort on collection ( insertion-sort if we implement the priority queue using sorted listthen we improve the running time of phase to ( )for each remove min operation on now takes ( time unfor...
22,042
heap-sort as we have previously observedrealizing priority queue with heap has the advantage that all the methods in the priority queue adt run in logarithmic time or better hencethis realization is suitable for applications where fast running times are sought for all the priority queue methods thereforelet us again co...
22,043
in the second phase of the algorithmwe start with an empty sequence and move the boundary between the heap and the sequence from right to leftone step at time at step ifor nwe remove maximum element from the heap and store it at index in generalwe say that sorting algorithm is in-place if it uses only small amount of m...
22,044
adaptable priority queues the methods of the priority queue adt given in section are sufficient for most basic applications of priority queuessuch as sorting howeverthere are situations in which additional methods would be usefulas shown by the scenarios below involving the standby airline passenger application standby...
22,045
implementing an adaptable priority queue in this sectionwe provide python implementation of an adaptable priority queue as an extension of our heappriorityqueue class from section to implement locator classwe will extend the existing item composite to add an additional field designating the current index of the element...
22,046
with its left child( , )at index of the listthen swapped with its right child( , )at index of the list in the final configurationthe locator instances for all affected elements have been modified to reflect their new location it is important to emphasize that the locator instances have not changed identity the user' to...
22,047
ride the remove min method because the only change in behavior for the adaptable priority queue is again provided by the overridden swap method the update and remove methods provide the core new functionality for the adaptable priority queue we perform robust checking of the validity of locator that is sent by caller (...
22,048
def add(selfkeyvalue)"""add key-value pair ""token self locator(keyvaluelen(self data)initiaize locator index self data append(tokenself upheap(len(self data return token def update(selflocnewkeynewval)"""update the key and value for the entry identified by locator loc "" loc index if not ( < len(selfand self data[jis ...
22,049
exercises for help with exercisesplease visit the sitewww wiley com/college/goodrich reinforcement - how long would it take to remove the log nsmallest elements from heap that contains entriesusing the remove min operationr- suppose you label each position of binary tree with key equal to its preorder rank under what c...
22,050
- consider situation in which user has numeric keys and wishes to have priority queue that is maximum-oriented how could standard (minorientedpriority queue be used for such purposer- illustrate the execution of the in-place heap-sort algorithm on the following input sequence( - let be complete binary tree such that po...
22,051
creativity - show how to implement the stack adt using only priority queue and one additional integer instance variable - show how to implement the fifo queue adt using only priority queue and one additional integer instance variable - professor idle suggests the following solution to the previous problem whenever an i...
22,052
- we can represent path from the root to given node of binary tree by means of binary stringwhere means "go to the left childand means "go to the right child for examplethe path from the root to the node storing ( , in the heap of figure is represented by " design an (log )-time algorithm for finding the last node of c...
22,053
- given classpriorityqueuethat implements the minimum-oriented priority queue adtprovide an implementation of maxpriorityqueue class that adapts to provide maximum-oriented abstraction with methods addmaxand remove max your implementation should not make any assumption about the internal workings of the original priori...
22,054
- write program that can process sequence of stock buy and sell orders as described in exercise - - let be set of points in the plane with distinct integer xand ycoordinates let be complete binary tree storing the points from at its external nodessuch that the points are ordered left to right by increasing -coordinates...
22,055
mapshash tablesand skip lists contents maps and dictionaries the map adt applicationcounting word frequencies python' mutablemapping abstract base class our mapbase class simple unsorted map implementation hash tables hash functions collision-handling schemes load factorsrehashingand efficiency python hash table implem...
22,056
maps and dictionaries python' dict class is arguably the most significant data structure in the language it represents an abstraction known as dictionary in which unique keys are mapped to associated values because of the relationship they express between keys and valuesdictionaries are commonly known as associative ar...
22,057
the map adt in this sectionwe introduce the map adtand define its behaviors to be consistent with those of python' built-in dict class we begin by listing what we consider the most significant five behaviors of map as followsm[ ]return the value associated with key in map mif one existsotherwise raise keyerror in pytho...
22,058
popitem)remove an arbitrary key-value pair from the mapand return ( ,vtuple representing the removed pair if map is emptyraise keyerror clear)remove all key-value pairs from the map keys)return set-like view of all keys of values)return set-like view of all values of items)return set-like view of ( ,vtuples for all ent...
22,059
applicationcounting word frequencies as case study for using mapconsider the problem of counting the number of occurrences of words in document this is standard task when performing statistical analysis of documentfor examplewhen categorizing an email or news article map is an ideal data structure to use herefor we can...
22,060
python' mutablemapping abstract base class section provides an introduction to the concept of an abstract base class and the role of such classes in python' collections module methods that are declared to be abstract in such base class must be implemented by concrete subclasses howeveran abstract base class may provide...
22,061
our mapbase class we will be providing many different implementations of the map adtin the remainder of this and nextusing variety of data structures demonstrating trade-off of advantages and disadvantages figure provides preview of those classes the mutablemapping abstract base classfrom python' collections module and...
22,062
mapshash tablesand skip lists class mapbase(mutablemapping) """our own abstract base class that includes nonpublic item class "" nested item class class item """lightweight composite to store key-value pairs as map items ""slots _key _value def init (selfkv) self key self value def eq (selfother)compare items based on ...
22,063
class unsortedtablemap(mapbase) """map implementation using an unordered list "" def init (self) """create an empty map ""list of item' self table def getitem (selfk) """return value associated with key (raise keyerror if not found"" for item in self table if =item key return item value raise keyerrorkey errorrepr( ) d...
22,064
hash tables in this sectionwe introduce one of the most practical data structures for implementing mapand the one that is used by python' own implementation of the dict class this structure is known as hash table intuitivelya map supports the abstraction of using keys as indices with syntax such as [kas mental warm-upc...
22,065
hash functions the goal of hash functionhis to map each key to an integer in the range [ ]where is the capacity of the bucket array for hash table equipped with such hash functionhthe main idea of this approach is to use the hash function valueh( )as an index into our bucket arrayainstead of the key (which may not be a...
22,066
hash codes the first action that hash function performs is to take an arbitrary key in our map and compute an integer that is called the hash code for kthis integer need not be in the range [ ]and may even be negative we desire that the set of hash codes assigned to our keys should avoid collisions as much as possible ...
22,067
collisions for common groups of strings in particular"temp and "temp collide using this functionas do "stop""tops""pots"and "spota better hash code should somehow take into consideration the positions of the xi ' an alternative hash codewhich does exactly thisis to choose nonzero constanta  and use as hash code the va...
22,068
mapshash tablesand skip lists an implementation of cyclic-shift hash code computation for character string in python appears as followsdef hash code( )mask ( < = for character in sh ( +ord(characterreturn limit to -bit integers -bit cyclic shift of running sum add in value of next character as with the traditional poly...
22,069
hash codes in python the standard mechanism for computing hash codes in python is built-in function with signature hash(xthat returns an integer value that serves as the hash code for object howeveronly immutable data types are deemed hashable in python this restriction is meant to ensure that particular object' hash c...
22,070
compression functions the hash code for key will typically not be suitable for immediate use with bucket arraybecause the integer hash code may be negative or may exceed the capacity of the bucket array thusonce we have determined an integer hash code for key object kthere is still the issue of mapping that integer int...
22,071
collision-handling schemes the main idea of hash table is to take bucket arrayaand hash functionhand use them to implement map by storing each item (kvin the "bucketa[ ( )this simple idea is challengedhoweverwhen we have two distinct keysk and such that ( ( the existence of such collisions prevents us from simply inser...
22,072
open addressing the separate chaining rule has many nice propertiessuch as affording simple implementations of map operationsbut it nevertheless has one slight disadvantageit requires the use of an auxiliary data structure-- list--to hold items with colliding keys if space is at premium (for exampleif we are writing pr...
22,073
to implement deletionwe cannot simply remove found item from its slot in the array for exampleafter the insertion of key portrayed in figure if the item with key were trivially deleteda subsequent search for would fail because that search would start by probing at index then index and then index at which an empty cell ...
22,074
load factorsrehashingand efficiency in the hash table schemes described thus farit is important that the load factorl /nbe kept below with separate chainingas gets very close to the probability of collision greatly increaseswhich adds overhead to our operationssince we must revert to linear-time list-based methods in b...
22,075
operation list getitem setitem delitem len iter (no(no(no( (nhash table expected worst case ( (no( (no( (no( ( (no(ntable comparison of the running times of the methods of map realized by means of an unsorted list (as in section or hash table we let denote the number of items in the mapand we assume that the bucket arr...
22,076
python hash table implementation in this sectionwe develop two implementations of hash tableone using separate chaining and the other using open addressing with linear probing while these approaches to collision resolution are quite differentthere are great many commonalities to the hashing algorithms for that reasonwe...
22,077
class hashmapbase(mapbase) """abstract base class for map using hash-table with mad compression "" def init (selfcap= = ) """create an empty hash-table map "" self table cap none number of entries in the map self prime for mad compression self prime scale from to - for mad self scale randrange( - shift from to - for ma...
22,078
separate chaining code fragment provides concrete implementation of hash table with separate chainingin the form of the chainhashmap class to represent single bucketit relies on an instance of the unsortedtablemap class from code fragment the first three methods in the class use index to access the potential bucket in ...
22,079
linear probing our implementation of probehashmap classusing open addressing with linear probingis given in code fragments and in order to support deletionswe use technique described in section in which we place special marker in table location at which an item has been deletedso that we can distinguish between it and ...
22,080
def bucket getitem(selfjk)founds self find slot(jkif not foundraise keyerrorkey errorreturn self table[svalue repr( )def bucket setitem(selfjkv)founds self find slot(jkif not foundself table[sself item( ,vself + elseself table[svalue def bucket delitem(selfjk)founds self find slot(jkif not foundraise keyerrorkey errorr...
22,081
sorted maps the traditional map adt allows user to look up the value associated with given keybut the search for that key is form known as an exact search for examplecomputer systems often maintain information about events that have occurred (such as financial transactions)organizing such events based upon what are kno...
22,082
sorted search tables several data structures can efficiently support the sorted map adtand we will examine some advanced techniques in section and in this sectionwe begin by exploring simple implementation of sorted map we store the map' items in an array-based sequence so that they are in increasing order of their key...
22,083
implementation in code fragments through we present complete implementation of classsortedtablemapthat supports the sorted map adt the most notable feature of our design is the inclusion of find index utility function this method using the binary search algorithmbut by convention returns the index of the leftmost item ...
22,084
mapshash tablesand skip lists class sortedtablemap(mapbase) """map implementation using sorted table "" nonpublic behaviors def find index(selfklowhigh) """return index of the leftmost item with key greater than or equal to return high if no such item qualifies that isj will be returned such that all items of slice tab...
22,085
def setitem (selfkv)"""assign value to key koverwriting existing value if present "" self find index( len(self table if len(self tableand self table[jkey =kreassign value self table[jvalue elseadds new item self table insert(jself item( , )def delitem (selfk)"""remove item associated with key (raise keyerror if not fou...
22,086
def find ge(selfk)"""return (key,valuepair with least key greater than or equal to "" key > self find index( len(self table if len(self table)return (self table[jkeyself table[jvalueelsereturn none def find lt(selfk)"""return (key,valuepair with greatest key strictly less than "" key > self find index( len(self table i...
22,087
analysis we conclude by analyzing the performance of our sortedtablemap implementation summary of the running times for all methods of the sorted map adt (including the traditional map operationsis given in table it should be clear that the len find minand find max methods run in ( timeand that iterating the keys of th...
22,088
two applications of sorted maps in this sectionwe explore applications in which there is particular advantage to using sorted map rather than traditional (unsortedmap to apply sorted mapkeys must come from domain that is totally ordered furthermoreto take advantage of the inexact or range searches afforded by sorted ma...
22,089
maxima sets life is full of trade-offs we often have to trade off desired performance measure against corresponding cost supposefor the sake of an examplewe are interested in maintaining database rating automobiles by their maximum speeds and their cost we would like to allow someone with certain amount of money to que...
22,090
mapshash tablesand skip lists maintaining maxima set with sorted map we can store the set of maxima pairs in sorted mapmso that the cost is the key field and performance (speedis the value field we can then implement operations add(cp)which adds new cost-performance pair (cp)and best( )which returns the best pair with ...
22,091
skip lists an interesting data structure for realizing the sorted map adt is the skip list in section we saw that sorted array will allow (log )-time searches via the binary search algorithm unfortunatelyupdate operations on sorted array have (nworst-case running time because of the need to shift elements in we demonst...
22,092
mapshash tablesand skip lists and place that item in si+ if the coin comes up "heads thuswe expect to have about / itemss to have about / itemsandin generalsi to have about / items in other wordswe expect the height of to be about log the halving of the number of items from one list to the next is not enforced as an ex...
22,093
search and update operations in skip list the skip-list structure affords simple map search and update algorithms in factall of the skip-list search and update algorithms are based on an elegant skipsearch method that takes key and finds the position of the item in list that has the largest key less than or equal to (w...
22,094
algorithm skipsearch( )inputa search key outputposition in the bottom list with the largest key such that key( < start {begin at start positionwhile below( none do below( {drop downwhile >key(next( )do next( {scan forwardreturn code fragment algorthm to search skip list for key as it turns outthe expected running time...
22,095
algorithm skipinsert( , )inputkey and value outputtopmost position of the item inserted in the skip list skipsearch(kq none { will represent top node in new item' toweri - repeat + if > then + {add new level to the skip listt next(ss insertafterabove(nones(-none){grow leftmost towerinsertafterabove(st(+none){grow right...
22,096
removal in skip list like the search and insertion algorithmsthe removal algorithm for skip list is quite simple in factit is even easier than the insertion algorithm that isto perform the map operation del [kwe begin by executing method skipsearch(kif the position stores an entry with key different from kwe raise keye...
22,097
maintaining the topmost level skip list must maintain reference to the start position (the topmostleft position in sas an instance variableand must have policy for any insertion that wishes to continue inserting new entry past the top level of there are two possible courses of action we can takeboth of which have their...
22,098
mapshash tablesand skip lists bounding the height of skip list because the insertion step involves randomizationa more accurate analysis of skip lists involves bit of probability at firstthis might seem like major undertakingfor complete and thorough probabilistic analysis could require deep mathematics (andindeedthere...
22,099
so we have yet to bound the number of scan-forward steps we make let ni be the number of keys examined while scanning forward at level observe thatafter the key at the starting positioneach additional key examined in scan-forward at level cannot also belong to level if any of these keys were on the previous levelwe wou...