A DIGITAL MEMORY STRUCTURE AND DEVICE, AND METHODS FOR THE MANAGEMENT THEREOF

Abstract: A digital memory structure manages a subset N of a universe U = {0...M-1} of elements e, where the universe U is represented by a complete binary tree of height m+1 with elements e of the universe U at its leaves. The digital memory structure has an array of overlapped registers reg[i], preferably where 0 </= i </=M/2-1, for storing internal nodes of the binary tree along respective paths from ancestors of said leaves to root. Location j of register reg[i] is arranged to store internal node k, preferably where k = i div 2<j>)+ 2<m-j-1>). Any internal node of the binary tree is stored as tagged, if the right and/or the left subtree thereof contain(s) at least one element of subset N. The digital memory structure also has an array of pointers internal[1], preferably where 1 </=1 </=M-1), to the smallest element in the right subtree, and/or the largest element in the left subtree, of each respective internal node 1.

Description: A DIGITAL MEMORY STRUCTURE AND DEVICE, AND METHODS FOR THE MANAGEMENT THEREOF Technical Field The present invention relates to a digital memory structure for managing a subset of a universe of elements, including insertions and deletions of elements into/from said subset . The invention also relates to a digital memory device for implementing the digital memory structure. Background Art The so-called closest neighbour problem has several applications in the field of computers and computing. For instance, multiprocessing operating systems generally handle the scheduling of execution of program processes or jobs by a priority queue, in which individual processes are given respective positions depending on individual priority level, call for I/O interrupts, etc. The operating system uses the priority queue to decide which process to execute next, for instance the first process in the priority queue. The priority queue has to be dynamic, i.e. allow insertions and deletions of processes. The so-called union-split-find problem is another example of a dynamic closest neighbour problem. Unless the universe of elements, in which the dynamic closest neighbour problem is applied, is quite limited, prior art solutions have failed to provide limited response times for queries as well as updates. For instance, according to one previously known approach, if each element in the universe knows its closest neighbour, constant query response time is easily obtained, but updates are time consuming. This approach may be very attractive, when there are only a few updates, and is clearly helpful if there are none. A different approach is to note the presence or ab- sence of a value in a small number of places (a bit map is the extreme) , but this makes queries very costly. Summary of the Invention It is an object of the present invention to provide a constant time solution to the dynamic closest neighbour problem, for queries as well as updates. More specifically, it is an object of the present invention to provide a digital memory structure and device for allowing such constant time operations in a computerized environment. These objects are achieved by a digital memory struc- ture, a digital memory device and related methods according to the accompanying independent claims . Further objects, advantages and features of the present invention appear from the following description as well as from the subclaims and the attached drawings. Brief Description of the Drawings The present invention will now be described in more detail, reference being made to the accompanying drawings, in which FIGs 1-6 are binary tree representations for illustrating various aspects of the present invention, and FIG 7 is a schematic block diagram representing a digital memory device according to the invention. Detailed Disclosure A. Definitions Definition la: Let N be a subset of elements of the uni verse U = {θ . . . M- l} . Then the one -dimensional dynamic clo- sest neighbour (neighbourhood) problem is to support the following opera tions effi ciently: • Insert (e) , which inserts element e into the subset N. • Delete (e) , which deletes el ement e from the subset N. • Left (e) (Right (e) ) , which returns the largest (smallest) element of N smaller (larger) than e. If such an element does not exist, -∞ (+∞) is returned. To be able to talk also about both neighbours of the largest and the smallest element in N, we augment U by -∞ and +∞. Consequently, the right (left) neighbour of -∞ (+∞) is the smallest (largest) element in N. Definition lb: In the union-split- find , or interval sets, problem we have a set of contiguous and pairwise disjoint interval sets taken from a bounded universe. The interval I is identified by its minimum element, min(I) . The following operations are to be supported: • Find (e) , which returns min (I), where e e l, • Split (e) , which splits the interval I (e e l) into consecutive intervals J 2 and I 2 such that min(I 1 ) = min (I) and min(I 2 ) = e, and • Merge (I) , which puts elements from intervals I (e € I) and I 1 ( (e - 1) ε I x ) into the interval I 2 . Obviously, min(I 2 ) = mind^ . Since an interval is identified by its smallest element, we can replace the set of intervals with the set of these smallest elements. This makes the union-split-find and neighbourhood problems equivalent as shown in Table 1. Table 1 : A mapping between the neighbourhood and interval sets problems . neighbourhood <= interval sets Insert (e) <=> Split (e) Delete (I) <=> Merge (J) Left (e) => Find (e) Definition lc : In the priori ty gueue problem we have a se t of el ements , N, from a bounded universe and the following opera tions : • Insert (e) , which inserts an el ement e into N. • DeleteMin, whi ch deletes the small es t el ement from N and returns i t, • ChangePriority (e, Δ) , whi ch changes the val ue of the el ement e in N for A, • Delete (e) , which del etes an element e from N, and • MinPriority, which returns the small es t el ement in N. As presented in Table 2 below, priority queue operations can be efficiently emulated by the operations of the neighbourhood problem. Thus, the priority queue problem is no harder than the neighbourhood problem. However, it is not known to be easier. In summary, a solution of a neighbourhood problem gives us also solutions for the union- split-find and the priority queue problems with the same time and space bounds. Table 2 : A mapping of the priority queue problem onto the neighbourhood problem. priority queue => neighbourhood Insert (e) => Insert (e) DeleteMin => tmp : = Right ( - ∞) ; Delete (tmp); return tmp ChangePriority (e, Δ) => Delete (e) ; Insert (e + Δ) Delete (e) = Delete (e) MinPriority => Right ( - ∞) For the following discussion we study a complete binary tree (trie) 100 as shown in FIG 1 with the elements 110 of U at the leaves of the tree and those leaves 120 representing the elements of N joined in a doubly linked list 130. We tag each node 140 that is a root of a subtree containing an element of N (including leaves in N) . Furthermore, each tagged internal node has a pointer to the largest and smallest elements of N in its subtree. To find either neighbour of any element e β U, it is sufficient to find the other, as the desired value can be reached following pointers at the leaves. An approach to locating one of e's neighbours is to find the lowest tagged node on the path from the leaf e to the root. A linear scan does this in O(log M) time. Alternatively, it can be done using binary search with O(log (2) ) worst case running time . Summarizing the description above, we define: Definition 2: A simple tagged tree is a complete binary tree wi th elements of U at i ts leaves and (i . ) each node that is the root of a subtree containing an element of N is tagged, (ii.) each internal tagged node has a pointer to the largest and smallest elements of N in its subtree, and (Hi.) elements of N are connected in a doubly linked list. The neighbours of an element in a simple tagged tree are easily found in constant time, once the lowest tagged ancestor of the query point is found. The difficulty is that a single element of N may be referred to by up to lg M internal nodes. This would appear to impose a _ (lg M) bound on any update algorithm. A simple modification of the structure to remove a multiple reference problem begins with the idea of a splitting node (see boxed nodes 250 in Figure 2) . Definition 3: An internal node is a splitting node if there is at least one element of N in each of its subtrees. We now maintain tags and pointers only at splitting nodes. This does not quite solve the problem as a single element x of N may still be the smallest (largest) in up to lg M subtrees (see FIG 3) . The final twist is to maintain references to the leftmost (smallest) element in the right subtree and the rightmost (largest) element in the left subtree. That is to the "inside" rather than "outside" de- scendents. Thus, we have: Definition 4: A split tagged tree is a complete binary tree on U in which: (i.) a splitting node of the tree has a tag and pointers to the largest element in its left subtree and the smallest element in its right subtree, (ii.) each leaf representing an element from N is tagged, and (Hi.) the elements of N are connected in a doubly linked list. We will now show that a split tagged tree supports both constant time updates and constant time queries. To simplify further discussion, we introduce the following terms : Definition 5: The lowest common node (or lowest common ancestor) of two leaves is the root of the smallest subtree containing both leaves . Definition 6 The node n is a left (right) spli tting node of e, if e is a leaf in the left (right) subtree of n . The first left (right) spli tting node on a pa th from e to the root is the lowest left (right) spli tting node of e . To permit constant time updates only a few splitting nodes may have references to a given element in N. In fact, there are at most two such nodes: Lemma 1: Consider a spli t tagged tree, a tagged leaf e, and all left (right) subtrees at spli tting nodes of the tree . Then e is the largest (smallest) element in the left (right) subtree of e ' s lowest left (right) spli tting node, and in no other subtree rooted at a spli tting node . Proof: We prove only half of the lemma, since the other half is symmetrical. First, if e is the smallest ele- ment in N, then it has no left splitting node. Next, if n is e's right splitting node, then e is larger than any element in the left subtree of n . Since, by Definition 6, the lowest left splitting node n 2 is the first left splitting node on the path from e to the root, all other elements in the left subtree of n x are smaller than e. Finally, assume e is also the largest element in the left subtree of the left splitting node n i . Since n 2 is e's left splitting node, there is an element, f, in the right subtree of n λ and e < f . By Definition 6 n ± is above n l r and thus e and f are both in the left subtree of n ± . However, this contra- diets the assumption that e is the largest element in the left subtree of π i . QED Finally, the following lemma indicates how to answer queries quickly: Lemma 2: Let n λ and n r be e ' s lowest left and right spli tting nodes, respectively , and let x, y e N be the neighbours of e, where x < e < y. Then, if e έ N ei ther the pointers a t n λ or at n r point to x and y; and if e e N then the pointers a t n r refer to x and e, and those a t n λ refer to e and y. Proof: If e e N, this lemma follows from Lemma 1. If e ø N, FIG 4 presents two of four possible situations (the other two are symmetrical) . Let n_ be the lowest common node of x and y. By definition, it is also a splitting node, and moreover, it is a splitting node on a path from e to the root. Since x and y are e's neighbours, they are each other's neighbours in N, and therefore x is the largest element in n c 's left subtree and y the smallest element in n c 's right subtree. Consequently, the pointers at n c point to x and y, e's neighbours. A contradiction argument similar to that of the proof of Lemma 1 shows that n c is either n 2 or n r . QED B. Preferred Embodiment To solve the dynamic one-dimensional closest neighbour problem, we first describe a digital data structure and how it is stored in a digital memory device, and then give a set of algorithms. The data structure is a split tagged tree, from Definition 4, with the nodes represented in an array in standard heap order, i.e. the root is n l t n 2 and n 3 are its left and right child respectively. In general, node n ± has left and right children n 2i and n 2i+1 . To store this data structure, we divide a passive memory block into an overlapped and a non-overlapped (conventional) part. The graph describing the overlapped part is a complete binary tree of height m (it is a level shorter than the split tagged tree) , where the registers are represented by paths from leaves to the root (cf . FIG 5) . Thus, the leaves are not shared and appear in the least significant position of individual registers, while the root, which is shared by all registers, appears in the most significant position of registers. The bits of the overlapped memory, β i t where 1 < i < 2 m = M, are enumerated in standard heap order as well. Hence, reg[i].b[j] = β k where k = ( i div 2 j ) + 2 m - j '1 (1) since k = ( i + 2 m~1 ) div 2 j = (i div 2 j ) + 2 n " j - 1 . The reason for enumerating the bits in the overlapped memory is to define their interdependencies, i.e. in which registers and where in these registers does a certain bit appear. In real implementation the registers are words in a processor memory space - they are read and written as words at any other memory location. This brings us to a formal description of how the split tagged tree is stored in the memory: Definition 7: The memory representation of a spli t tagged tree from Defini tion 4 in Algori thm 1 consists of four variables residing in two parts of memory: reg: overlapped regis ters s toring internal nodes of the tree (see eg. (1 ) ) . Bi t β ± is set iff node n i is tagged . These registers reside in the overlapped memory. elt: l eaves of the tree, where bi t elt [e] is set , iff leaf e is tagged . internal: internal node pointers to the larges t element in the l eft subtree and to the small est el ement in the right subtree of a given node . Pointers internal [i] correspond to node rt.. leaf: ordered doubly linked list of elements of N. Algorithm 1: Memory representation of a split tagged tree (data structure) used for the dynamic neighbourhood problem CONST M = 2"; (* size of universe M * VAR { * BINARY TREE OF TAGS: * reg- ARRAY [0 . .M/2 - 1] OF WORD IN Yggdrasil (* internal nodes and * elt: ARRAY [0..M-1] OF BOOLEAN IN Conventional; (* leaves . * (* POINTERS: * internal: ARRAY [1..M-1] OF RECORD (* at internal nodes point to * left, (* the largest element m the left subtree and * right: WORD; (* the smallest element m the right subtree, and * END IN Conventional; leaf: ARRAY [0..Λ.-1] OF RECORD (* at leaves * prev, next: WORD; (* connect elements of N in a doubly linked list . * END IN Conventional; The size of this data structure is dominated by the arrays of pointers and remains Θ (M log M) bits. We will reduce it later. To find the neighbours of e, by Lemma 2 we need only find e's lowest left and right splitting nodes. By Definition 7 the register reg[e DIV 2] represents the path from the leaf e to the root and the set bits in the register correspond to splitting nodes. Therefore, we must separate those bits representing left internal nodes from those representing right internal nodes, and find the least significant set bit among each. To separate the bits consider a path from the leaf e to the root and the i th level node n k on this path. It is not hard to see that if e.b.i] = 0, where k = (e div 2 1 ) + 2 m~ (cf. eq. (1)), then element e is in the left subtree of n k and otherwise it is in the right subtree of n k . In other words, the element e itself is a mask that can be used to separate bits representing left and right internal splitting nodes, and hence expressions reg[e DIV 2] Λ e and reg[e DIV 2] Λ NOT(e) (2) extract bits representing e's right and left splitting nodes respectively. We can use such simple expressions only because we put the root of the tree in the most significant position of the overlapped registers reg [ . ] . Now it is easy to prove : Lemma 3: Given an element e e M we can compute i ts lowest left and right spli tting nodes in constant time . Proof: After separating bits by eq. (2) we compute the least significant set bit. QED We also require the lowest common node of elements e and f : Lemma 4: The lowest common node of two elements can be computed in constant time . Proof: The lowest common node of elements e and f is the last common node in the paths from the root to e and f . Therefore, the most significant set bit of exclusive or of e and f corresponds to the node immediately below the lowest common node. Algorithm 3 presents the details of the calculation. QED The operations required for the dynamic closest neighbour problem will be implemented in the following. We use the data structure of Definition 7. All implementations find both closes neighbours of e e U in N. From the preceding discussion and Algorithm 4, we easily see by Algorithm 5 : Lemma 5: The left and the right neighbours of e in N can be found in constant time . Algorithm 2: The lowest left and right splitting nodes of e. PROCEDURE LowestSplittmgNodes (e) tmp = e DIV 2, path = reg [tmp] , (* The path from e to the root, * ) j = LMB (path AND Negate (e) ) , (* the least significant set bi t by eg (2) , *) n λ = (tmp DIV 2 J ) + 2" 1 \ (* and the corresponding node by eg (1) *) j = LMB (path AND e) , (* Similarly, the lowest right spli tting node * ) __ r = (tmp DIV V) + 2 m l J , RETURN (__j, π r ) END LowestSplittmgNodes, Algorithm 3 : The lowest common node of e and f, and an appearance of a corresponding bit in overlapped registers. PROCEDURE LowestCommon Node (e, f) 3 = LMB (E XOR f ) + 1 , (* The appearance of b t m a register, *) n- = (e DIV 2 ] * 1 ) + 2"", (* and corresponding node by eg (1) *) RETURN (n., j) END LowestCommonNode, Algorithm 4: The neighbours of e e U in N. PROCEDURE Neighbours (e) , IF elt [e] THEN (* If e e N we can use a double linked list *) RETURN leaf [e] ELSE (n 2 , n r ) = LowestSplittmgNodes (e) (* Otherwise pointers at one * ) IF Between (internal [n , e) THEN (* of the lowest spli tting nodes *) RETURN internal [n (* point to both neighbours * ) ELSE RETURN internal [___] END END END Neighbours, Algorithm 5: Searching for the left and the right neighbour of e in N. PROCEDURE Left (e) , (left, right) = Neighbours (e) , RETURN left, END Left, PROCEDURE Right (e) , (left, right) = Neighbours (e) RETURN right, END Right, Algorithm 6: Insertion of e into N. PROCEDURE Insert (e) ; (n α , n r ) .= LowestSplittmgNodes (e) (* UPDATE LEAVES-*) (x, y) ■ = Neighbours (e) ,- (* Find both neighbours, *) elt [e] .= TRUE; { * tag a proper leaf and * ) leaf [x] .next := e, leaf [y] .prev: =e; (* insert e m a doubly linked list . *) (* UPDATE THE TREE- *; (n x , j x ) = LowestCommonNode (x, e) ,- (* First, lowest common nodes * ) (n y , j y ) ■ = LowestCommonNode (e, y) ; (* wi th both neighbours * ) IF n, > n, THEN (* and the lower of them will be *) n = n x , bιt:= 7 _ ELSE n:= n y , bιt- = j y END, (* a new spli tting node; * ) reg[e DIV 2] .b[bιt] = TRUE, (* so, i t gets a tag. *) IF e.b[bιt] = TRUE THEN * Finally, get e 's new lowest spli tting nodes and *) newRight . = n; newLeft:= n 2 ELSE newRιght:= n r ; newLeft:= n END; internal [newRight] . left := x; internal [newRight] right :=e; ( * update * ) internal [newLeft] . left .= e; internal [newLeft] .right := y, ( * their pointers . * ) END Insert; Algorithm 7: Deletion of e from N. PROCEDURE Delete (e) , (n 2 , n r J;= LowestSplittmgNodes (e) , (* UPDATE LEAVES: * (x, y) = Neighbours (e) ; (* Find both neighbours, * leaf [x] .next:=y, leaf [y] .prev:=x; (* delete e from a double linked and * elt [e] = FALSE, (* take a tag off a proper leaf . * (* UPDATE THE TREE: * IF n r > _ij THEN (* The lowest spli tting nodes * (tmp, b t) •= LowestCommonNode (x, e) ; hιgher:= n 2 ELSE (tmp, bit) = LowestCommonNode (e, y) , hιgher-= n. END, (* are treated differently: *) reg[e DIV 2] .b[bιt] := FALSE; (* the lower is no longer a spli tting node and * ) internal [higher] . left:=x; (* the higher gets pointers *) internal [higher] right : =y; (* to Jboth neighbours . *) END Delete; FIG 6 is helpful in describing the insert and delete operations. It shows the effect of inserting e into the corresponding diagrams of FIG 4. Now, to insert: Lemma 6: Updates necessary for an insertion can be per- formed in constant time . Proof : Let x and y be the left and right neighbours of e (e ø N) , which is to be inserted. We prove that Algorithm 6 properly inserts e into N maintaining the split tagged tree of Definition 4. First, the algorithm tags the proper leaf and inserts it in a doubly linked list, so the second and third parts of Definition 4 are satisfied. By a simple counting argument, it is easy to see that if we insert one element, exactly one internal node in a split tagged tree becomes a splitting node. Without loss of generality assume n r is the lowest right splitting node of e, n is the lowest common node of e and y, and n is lower than the lowest common node of x and e. To prove that Algorithm 6 also maintains the first part of Definition 4, we have to show that after the insertion n becomes a splitting node (it gets tagged) and that the pointers at e's lowest left and right splitting nodes are properly updated. As n is the lowest common node of e and y, these elements are in its left and right subtrees respectively (cf. left diagram in FIG 4) . Hence, n is a splitting node after the insertion. If n were a splitting node before the insertion, there would be at least one element, z, in the left subtree of n. Hence, either x < z < e or e < z < y, which contradicts the initial assumption about e's neighbours. Moreover, after the insertion e is the only element in the left subtree of n, and so n is also e's lowest left splitting node, while n r remains its lowest right splitting node. Algorithm 6 properly updates pointers at both nodes, while Lemma 2 guarantees that no other pointers need be changed. Constant run time follows from Algorithm 3 and Al- gorithm 4. QED Finally, we deal with a deletion: Lemma 7: An element can be deleted from N in constant time . Proof: Algorithm 7 takes constant time. Assuming e e N, its correctness follows from Lemma 2 by similar reasoning to the proof of Lemma 6. QED We conclude the section by: Theorem 1: Using the data structure described above, the one -dimensional dynamic closest neighbour problem on a uni verse of size M can be solved in constant time and O (M log M) bi ts of space . Proof: The space bound follows from the data structure described in Definition 7, and the time bound from Lemma 5 , Lemma 6 , and Lemma 7 QED C. Memory Implementation It turns out that the most difficult problem in the maintenance of the data structure for the problem of finding the closest neighbour to the left and/or to the right is to distribute information about the changes throughout the data structure quickly enough. The problem is solved by designing a special memory 700 according to FIG 7, which permits that a change in a single memory location is reflected in many other memory locations. The role of the memory 700 is to return on the data bus 750 the content of the memory location at the address put on the address bus 760; or to write the value put on the data bus into the memory location at the address put on the address bus. In detail, let our memory locations be w bits wide and let our memory consist of w memory banks 710. When we put on the address bus 760 an address a, we get from the first bank the first (least significant) bit of the memory location a, from the second bank the second bit of the me- mory location a, from the third bank the third bit and so on. Similarly, when we write into the memory. Each bank is in fact a 1-bit wide memory. More precisely, the i-th bank is a 1-bit wide memory with 2 Λ (w-i) bank-memory locations 740, (w-i) address inputs 720 and one data output 730. So, when the address a appears on the address bus, its (w-i) most significant bits are used in the bank i to retrieve the 1-bit value of the bank-memory location. The writing works similarly. From the above description, it is also obvious that our memory is easier to manufacture than the conventional memory, because all banks (bits) do not require all address lines, which simplifies the address decoders. D. Alternative Embodiments and Improvements The doubly linked list leaf is used only to find neighbours when e e N. In this case, by Lemma 2, the pointers to e's neighbours are located in its lowest splitting nodes, and so, by Lemma 3, they can be computed in constant time and we can dispense with the doubly linked list. The bit array elt stores tags at leaves of a binary tree. A leaf has a tag iff the corresponding element is in N. However, by Lemma 2, e e N iff one of the pointers at its lowest splitting node refers back to e. By Lemma 3 the lowest splitting node can be computed in constant time, so the array elt is redundant. Next, we reexamine internal, the array of m-bit pointers at the internal nodes. These references are to de- scendents of the nodes in question. Hence, the pointers need only indicate the path from the internal node itself to the relevant leaf. If the internal node is i levels above the leaves, this takes i bits. Moreover, it takes only i - 1 bits, since the value of the i h bit of the pointer to the largest (smallest) element in the left (right) subtree is 0 (1) . To summarize, from the data structure in Definition 7, we are left with overlapped registers reg, for a tree of tags, and an array of variable length pointers internal . The simplification of the data structure not only improves the space bound, but also the running time of the algorithms, as they need not maintain leaves, elt, and a doubly linked list leaf, at these leaves. A further saving in space is achieved by splitting the universe into buckets of m consecutive elements and representing each bucket by a bit map. The insertion and deletion in a bit map are trivial. Treating buckets as elements of a smaller /m-element universe (a bucket-element is present iff at least one of its elements is present) , we build the split tagged tree structure as described above. The bit maps require M bits, and the tree on the top only 3M/m + 0 (m) bits. The second application of this bucketing trick reduces the space requirement to M + M/m + 3M/m 2 + 0 (m) bits and so: Theorem 2: Using the above da ta structure, the one-dimen sional dynamic closest neighbour problem on the universe of size M can be supported in constant time using space M + M/lgM + o (M/lgM) bi ts . In some applications the only neighbour we are ever looking for is either the left or the right one. According to a further embodiment, this changes the definition of the problem from Definition 1; the insertion and deletion operations are still supported, but instead of supporting both Right and Left, we support only one of them. In particular, for an efficient implementation of the priority queue, it is sufficient to support the search for the right neighbour only (cf . Table 2) . As we will show, the support for search of only one neighbour further simplifies the data structure and hence speeds up the algorithm. Moreover, the support for deletion and search of the extreme element only even further simplifies the algorithms. The later problem is particularly important as it gives the direct solution of the priority queue problem. Below, we will discuss the search for the right neighbour problem, but with an appropriate change the same solution can be used to search for the left neighbour. We are still using the split tagged tree from Defini- tion 4, though slightly changed: ad(i.) with each splitting node is associated only information about the smallest node in the right subtree; ad(ii.) leaves are not stored; ad(iii.) the doubly linked list does not exist. This gives us the following data structure (cf. Definition 7 and Algorithm 1: CONST M=2 Λ m; { size of universe } VAR { binary tree of tags : } reg: ARRAY [O..Λf/2-l] OF WORD IN Overlapped; { the smallest element in the right subtree} right: ARRAY [1..M-1] OF WORD IN Conventional; where the "right" pointers can be of variable length - decreasing from the top to the bottom - if we want to save on space. This, however, increases the access time. The search procedure works similarly as before (cf . Algorithm 4) , only we do not test on being between the neighbours, but only which of the two possible candidates is to the right . The right neighbour of e is an element : that is to the right of e and is pointed to either by the pointer at the lowest left splitting node of e or by the pointer at the lowest right splitting node of e. If we want to support only the search for the leftmost element in the set, we store pointer n min to this element separately. When determining a right neighbour of an element e in the subset N of the digital memory structure described above, these steps may be carried out: evaluating register regie div 2] for determining the lowest left splitting node p 2 of e; and if p 2 exist, returning the pointers in inter- nal ip λ ] (otherwise no right neighbour exists) . The insertion and deletion are similar to the procedures before (cf. Algorithms 6 and 7), though slightly simpler : For the general insertion, we need to find only the lowest right splitting node of e, n r . Let y r be the element pointed to by the pointer at n r . First, a new splitting node is created at the lowest common node of e and y r ; n . Next, if y r is also the right neighbour of e, we update pointer at n r to point to e and the pointer at n to point at y r ; otherwise we only update the pointer at n to point at e. The special case, when e is the smallest element, is treated separately. Hence, an element e may be inserted into the subset N of the digital memory structure by: evaluating register re ie div 2] for determining the lowest right splitting node p r of e; letting y r be the element pointed to by p r ; determining a lowest common node q of element e and y r ; marking node q as tagged in register reg ie div 2] ; and updating pointers internal for nodes related to element e. A general deletion is achieved in the following way. Find both the lowest left and the lowest right splitting nodes. If the right is lower, mark it as not tagged and we are done. If not, update the pointer in the lowest right splitting node to point to the element now pointed to by the lowest left splitting node. Mark the lowest left splitting node as not tagged and we are done. Hence, an element e may be deleted from the subset N of the digital memory structure by: evaluating register reg ie div 2] for determining the lowest left and lowest right splitting node p λ and p r , respectively, of e; marking the lower of p 2 and p r as not tagged in register reg ie div 2] ; and updating pointers internal for nodes related to element e. In the previous section, a hardware implementation of a binary tree has been described, storing one bit in each node of the tree. It is clear that by using other than consecutive numbers 1, 2, 3 ... w as the number of address inputs, we could instead use any other sequence of numbers giving other output degrees of the tree, which all are a power of two. Furthermore, it can be of great value to have more than one memory bank with the same address inputs, since this will make it possible to store more than one bit in each node. In particular, by having one bank for all the leaves, two for the parents of the leaves, three for the next ones and so on, we could store the entire tree, including the pointers in the array internal , in the special memory. This will have the effect that we only have to make one memory access to get all of this information. The drawback of this solution is that we can not have the same num- ber of priority levels for the tree. Another application of using multiple banks with the same input addresses is to have several banks for the leaves. These can be used to store data associated with each leave. Again, data will then also be retrieved with one memory access .

Claims: CLAIMS 1. A digital memory device (700) comprising a plurality of memory banks (710) , each memory bank having a predetermined number of address input (s) (720), at least one data output (730) and a plurality of memory locations (740) arranged to store a respective digital value, characterized in that at least two of the memory banks (710) have a mutually different number of memory locations (740) and/or address inputs (720) . 2. A digital memory device (700) according to claim 1 for storing w-bit digital words, each memory bank representing a respective bit position i, where 0 < i < w-1, in the digital words, characterized in that each respective memory bank (710) has 2 (w~1] memory locations (740) and ( w-i ) address inputs (720) . 3. The use of a digital memory device (700) accor- ding to claim 1 or 2 for handling a dynamic closest neighbour problem, a priority queue or a union-split-find problem. 4. A digital memory structure for managing a subset N of a universe U = (0 . . .M-l} of elements e, the universe U being represented by a complete binary tree of height _n+l with elements e of the universe U at its leaves, characterized by: an array of overlapped registers reg [i] , preferably where 0 < i < M/2-1, for storing internal nodes of the binary tree along respective paths from ancestors of said leaves to root, wherein location j of register regr.i] is arranged to store internal node k, preferably where k = ( i div 2 J ) +2 m~J ~1 , and wherein any internal node of the binary tree is stored as tagged, if the right and/or the left sub- tree thereof contain (s) at least one element of subset N; and an array of pointers internal [1] , preferably where 1 ≤ 1 ≤ M- l , to the smallest element in the right subtree, and/or the largest element in the left subtree, of each respective internal node 1 . 5. A digital memory structure as in claim 4, further comprising an array of values el t [n] , where 0 < n ≤ M- l , for representing the leaves of the binary tree, wherein elt[n] is set to a first value, if leaf n is an element of subset N, and it otherwise set to a second value. 6. A digital memory structure as in claim 4 or 5 , further comprising a doubly linked list leaf of elements of N. 7. A method of determining a left and a right neighbour of an element e in the subset N of the digital memory structure according to any of claims 4-6, comprising the steps of : a) evaluating register regr[e div 2] for determining such internal nodes p 2 and p r , the left and the right subtree of which contain element e; b) returning internal [p r ] . left and internal [p 2 ] . right, if either pointer in the lower of the two nodes p 2 and p r points to e; and otherwise c) returning either pointers internal ip^ or pointers internal [p r ] . 8. A method of inserting an element e in the subset N of the digital memory structure according to any of claims 4-6, comprising the steps of: applying the method of claim 4 for determining the neighbours of element e; determining a lowest common node q of element e and its left and/or right neigbour, respectively; marking node g as tagged in register reg [e div 2] ; and updating pointers internal for nodes related to element e . 9. A method of deleting an element e from the subset N of the digital memory structure according to any of claims 4-6, comprising the steps of: applying the method of claim 4 for determining the neighbours of element e; determining a lowest common node q of element e and its left and/or right neigbour, respectively; marking node q as not tagged in register reg [ e div 2] ; and updating pointers internal for nodes related to element e. 10. A method of determining a right neighbour of an element e in the subset N of the digital memory structure according to any of claims 4-6, comprising the step of: evaluating register reg i e div 2] for determining the lowest splitting node p 2 of e; and if p 2 exists, returning the pointers in internal [p ± ] . 11. A method of inserting an element e in the subset N of the digital memory structure according to any of claims 4-6, comprising the step of: evaluating register reg i e div 2] for determining the lowest right splitting node p r of e; determining a lowest common node q of element e and the element pointed to by p r ; marking node q as tagged in register reg[e div 2] ; and updating pointers internal for nodes related to element e . 12. A method of deleting an element e from the subset N of the digital memory structure according to any of claims 4-6, comprising the step of: evaluating register reg ie div 2] for determining the lowest left and lowest right splitting node p 2 and p r , respectively, of e; marking the lower of p 2 and p r as not tagged in register reg i e div 2] ; and updating pointers internal for nodes related to element e . 13. The use of a digital memory structure according to any of claims 4-6 for handling a dynamic closest neighbour problem. 14. The use of a digital memory structure according to any of claims 4-6 for handling a priority queue. 15. The use of a digital memory structure according to any of claims 4-6 for handling a union-split-find problem. 16. A digital memory device (700) according to claim 1 or 2, containing in its memory banks (710) a digital memory structure according to any of claims 4-6.

Inventors: BRODNIK ANDREJ, CARLSSON SVANTE, MUNRO JAMES IAN, BRODNIK, ANDREJ, CARLSSON, SVANTE, MUNRO, JAMES, IAN
Applicants: BRODNIK ANDREJ, CARLSSON SVANTE, MUNRO JAMES IAN, PRIQUEUE AB, BRODNIK, ANDREJ, CARLSSON, SVANTE, MUNRO, JAMES, IAN
Application year: 1999
Main classification: G11B
IPC codes: G06F12, G11C7, G11C8