GB2284078A - Stably partitioning a sequential list with limited memory - Google Patents

Stably partitioning a sequential list with limited memory Download PDF

Info

Publication number
GB2284078A
GB2284078A GB9423237A GB9423237A GB2284078A GB 2284078 A GB2284078 A GB 2284078A GB 9423237 A GB9423237 A GB 9423237A GB 9423237 A GB9423237 A GB 9423237A GB 2284078 A GB2284078 A GB 2284078A
Authority
GB
United Kingdom
Prior art keywords
list
sublists
partitioned
partitioning
sublist
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
GB9423237A
Other versions
GB9423237D0 (en
Inventor
Mehdi Jazayeri
Meng Lee
Alexander A Stepanov
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HP Inc
Original Assignee
Hewlett Packard Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hewlett Packard Co filed Critical Hewlett Packard Co
Publication of GB9423237D0 publication Critical patent/GB9423237D0/en
Publication of GB2284078A publication Critical patent/GB2284078A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/22Arrangements for sorting or merging computer data on continuous record carriers, e.g. tape, drum, disc
    • G06F7/24Sorting, i.e. extracting data from one or more carriers, rearranging the data in numerical or other ordered sequence, and rerecording the sorted data on the original carrier or on a different carrier or set of carriers sorting methods in general
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

2284078 METHOD AND APPARATUS FOR STABLY PARTITIONING A SEQUENTIAL LIST 1 1
0. 5 The present invention relates to a method and apparatus for stably partitioning a sequential list, for example to a method and apparatus for stably partitioning a sequential list in a space-adaptive manner.
Sequential lists must be partitioned for use in many aspects of data processing. A sequential list could represent a wide variety of applications, including database records or other data lists. The partitioning of the list reorders the elements of the list in accordance with a predicate (or condition). Namely, with two-way partitioning, the elements (or objects) in the sequential list are rearranged such that all the elements satisfying the predicate appear in the list before all the elements that do not satisfy the predicate. As an example, database records could be reordered to have all employee records of managers listed before those of non-managers. With three-way partitioning, the elements (or objects) in the sequential list are rearranged into three parts such that if the predicate is applied to any object in the first part, it returns " -I "; if the predicate is applied to any object in the second part, it returns "0"; and if the predicate is applied to any object in the third part, it returns " + I ". The partitioning is stable if the relative order of the elements (or objects) in the original list is preserved in the resulting parts of the partitioned list.
A known procedure for partitioning was developed many years ago by C.A.R. Hoare and published in "Collected Algorithms from ACK" New York, 1980 (Algorithm 63). This known procedure did not Yield a stable partition.
0 Known stable partitioning techniques are of two types. The first type is an in-place approach which requires no temporary memory storage or buffering. The second type requires that the memory available be at least as large as the size of the sequential list being partitioned. See USL C++ Standard Components Library, published by AT&T and UNIX System Laboratories (Release 3.0).
The problem with these known stable partitioning techniques is that performance is not optimized in most cases. In particular, the in-place approach, which does not require any additional memory, has poor performance because it does not make use of available memory. The second type of known stable partitioning does not operate efficiently in situations where the available memory is less than the size of the sequential list.
The present invention seeks to Provide improved list partitioning.
According to an aspect of the present invention, there is provided a method of partitioning in a stable manner a sequential list in a data processing system comprising the steps of a) receiving a sequential list and a condition; b) determining the amount of memory available for use in the data processing system; c) when the size of the sequential list exceeds the amount of available memory, dividing the sequential list into sublists until the amount of available memory equals or exceeds the size of the sublists; d) partitioning in stable manner on the basis of the received condition, each of the sublists using the available memory to produce partitioned sublists; and e) combining the partitioned sublists to produce the partitioned list.
According to another aspect of the present invention, there is provided a partitioning apparatus for partitioning in a stable manner a sequential list comprising: a space-adaptive partitioning device operative to 3 0 receive a sequential list and a condition, to partition the sequential list on the basis of the condition and to output the partitioned list; and a memory, operatively connected to said partitioning device, for temporarily storing elements of the sequential list during partitioning of the sequential list; said partitioning device including comparison means for comparing the size of the list to be partitioned to the amount of memory available for use, dividing means for dividing the sequential list into sublists when said comparison means determines that the list size exceeds the amount of available memory, said dividing means being operative to subdivide repetitively the sequential list or sublists thereof until said comparison means indicates that the size of the resulting sublists no longer exceeds the amount of memory available; partitioning means for partitioning in stable manner each sublist by itself to produce partitioned sublists; and combining means for combining the partitioned sublists to produce the partitioned list.
The invention can provide a stable partitioning technique able to operate with optimised performance regardless of the size of the available memory, and which can adapt to the amount of available memory.
As a consequence, it is possible with preferred embodiments to utilise as much of the memory as is available even if the amount available is less than the size of the sequential list (one-dimensional array of objects) to be partitioned. Thus, stable partitioning can occur in a data processing system with optimised processing efficiency.
An embodiment of a space-adaptive stable partitioning apparatus according to the invention includes a space- 4 t adaptive partitioning device and a memory connected thereto. The spaceadaptive partitioning device receives a sequential list and a predicate, partitions the sequential list in accordance with the predicate, and outputs the partitioned list. The memory temporarily stores elements of the sequential list while the partitioning device partitions the sequential list. To operate in a space-adaptive manner, the apparatus preferably includes a comparison unit for comparing the list size with an amount of the memory which is available for use by the partitioning device, a division unit for dividing the sequential list into sublists when the comparison unit determines that the list size exceeds the amount of available memory, a partition unit for stably partitioning each sublist by itself to produce partitioned sublists, and a combine unit for combining the partitioned sublists to produce the partitioned list.
A preferred method, performed by a data processing system includes the steps of. receiving the sequential list and a predicate; determining an amount of the memory which is available for use; dividing, when the size of the sequential list exceeds the amount of available memory, the sequential list into sublists until the amount of available memory equals or exceeds the size of the sublists; stably partitioning, in accordance with the predicate, each of the sublists using the available memory to produce partitioned sublists; and combining the partitioned sublists to produce the partitioned list.
These stable partitioning techniques can yield optimal performance regardless of the amount of available memory. Moreover, the stable partitioning can, for example, be two-way or three- way partitioning.
z 0 An embodiment of the present invention is described below, by way of example only, with reference to the accompanying drawings, in which:
FIG. 1 is a block diagram of an embodiment of a space-adaptive partitioning apparatus; FIGS. 2A and 213 are schematic diagrams of a sequential list and available memory; FIGS. 3A, 3B and 3C are flow charts of a first embodiment of a space-adaptive stable partitioning technique according to the present invention; and FIGS. 4A, 413 and 4C are flow charts of a second embodiment of a space-adaptive stable partitioning technique according to the present invention.
FIG. 1 is a block diagram of an embodiment of a space-adaptive partitioning apparatus 1. The apparatus 1 includes a space-adaptive partitioning device 2 and a memory 4. The space-adaptive partitioning device 2 receives as inputs a sequential list 6 of elements and a condition or predicate 8, and outputs a partitioned list 10. The space-adaptive partitioning device 2 is also operatively connected to the memory 4.
The quantity of memory 4 available varies with application. The sequential list 6 is a one-dimensional array of objects (or elements).
Further, the sequential list can be of any size and width. As an example, 0 CW the list can vary from a few one-bit elements to many database records having multiple multi-bit fields. Since the sequential list 6 is defined as a one-dimensional array of objects, it does not include linked lists. The predicate 8 can be any condition. Examples of two-way predicates are: 0 or 1; male or- female; = to number or not = to number; odd or even; etc.
Examples of three-way predicates are - 1, 0 or + 1; < number, = number or > number; etc.
FIGS. 2A and 2B are schematic diagrams illustrating examples of a sequential list 6' and available memory 4'. The sequential list 6' has ten elements, and the available memory 4' is capable of storing up to five elements. For simplicity, the remainder of the description will concentrate on the simplified case such as illustrated in FIGS. 2A and 2B.
is The general operation of the space-adaptive partitioning apparatus 1 is as follows.
An important aspect of the operation of the space-adaptive partitioning apparatus 1 is that it varies in accordance with the amount of memory 4 that is available. Typically, the amount of memory 4 (data storage) available in an apparatus or computer system is limited and allocated to numerous operations or tasks. Here, the space-adaptive partitioning device 2 determines or is told the amount of memory (e.g., buffering) that the memory 4 can offer the device 2. The space-adaptive partitioning device 2 is then able to adapt its operation so as to make best use of the memory 4 that is available.
First, the operation of the space-adaptive partitioning apparatus 1 is described for the case of two-way stable partitioning.
When the amount of available memory 4 is at least as large as the size of the sequential list 6, then each element in the list 6 is processed in order from the beginning. If the element satisfies the predicate, then the element is moved into the next available location in the list 6. On the other X 7 hand, if the element does not satisfy the predicate, then the element is moved into the next available position in the memory 4. After processing all the elements in the list 6 in this manner, all the elements in the memory 4 are copied to the remaining positions in the list 6. The list 6 is then a partitioned list. It should be noted that the operation of the apparatus 1 preserves the relative order of the objects in the original list, thus making the stable partitioning technique not only space- adaptive but also stable.
When the amount of available memory 4 is not as large as the size of the list 6, the processing differs. Namely, prior to processing the list 6, the list 6 is divided in half. The processing now treats each portion of the list 6 as a separate list (sublist). The size of the sublist is then again compared with the amount of available memory 4. If the size of the sublist does not exceed the amount of available memory 4, the processing for each sublist of the list 6 proceeds as above making use of the memory which is available.
If the size of the sublist exceeds the amount of available memory 4, the halving or subdividing continues in a recursive manner until the condition is met. After processing (i.e., partitioning) each sublist of the list 6 as its own list, each pair of partitioned sublists is combined by swapping (or rotating) the second part of the first sublist and the first part of the second sublist. It should be noted that for every division of the list 6 there will be a subsequent combining operation.
Next, the operation of the space-adaptive partitioning apparatus 1 is described for the case of three-way stable partitioning.
When the amount of available memory 4 is at least as large as the size of the sequential list 6, then each element in the list 6 is processed in order from the beginning. If the predicate applied to the element returns "1 % then the element is moved into the next available location in the list 6; if it returns "0", then the element is moved into the next available position in the available memory 4 starting at the beginning of the memory 4, if it returns " + 1 ", then the element is moved into the next available position in 0 the available memory 4 starting at the rear or end of the memory 4. After processing all the elements in the list 6 in this manner, all the elements in the beginning portion of the memory 4 are copied in order to the remaining positions in the list 6, and all the elements in the end portion of the memory 4 are copied in reverse order to theremaining portions in the list 6. The list 6 is then a partitioned list. It should be noted that the operation of the apparatus 1 preserves the relative order of the objects in the original list, thus making it not only space- adaptive but also stable.
When the amount of available memory 4 is not as large as the size of the list 6, the processing differs. Namely, prior to processing the list 6, the list 6 is divided in half. The processing now treats each part of the list 6 as a separate list (sublist). The size of the sublist is then again compared with the amount of available memory 4. If the size of the sublist does not exceed the amount of available memory 4, the processing for each sublist of the list 6 proceeds as above making use of the memory which is available. If the size of the sublist exceeds the amount of available memory 4, the halving or subdividing continues in a recursive manner until the condition is met. After processing (i.e., partitioning) each sublist of the list 6 as its own list, each pair of partitioned sublists is combined by first swapping (or rotating) the first and second parts of the second sublist with the third part of the first sublist, and second swapping (or rotating) the first part of the second sublist with the third part of the first partition. It should be noted that for every division of the list 6 there will be a subsequent combining operation.
The operation of the space-adaptive partitioning device 2 is described in more detail below.
FIGS. 3A, 3B and 3C are flow charts of the space-adaptive stable partitioning technique according to a first embodiment of the present invention.
Q 9 According to the first embodiment, the space-adaptive stable partitioning technique or method begins with a decision 12. The decision 12 turns on whether or not the available memory 4 is greater than or equal to the size of the list 6.
In the first case, namely, when the decision 12 determines that the amount of available memory 4 is at least equal in size to the size of the list 6, then the list 6 can be partitioned without any adaptation to the amount of available memory 4. The processing steps for this case are discussed in detail below with reference to FIG. 3C.
In the second case, namely, when the decision 12 determines that the amount of available memory 4 is less than the size of the list 6, the processing differs. In this case, the list is divided 14 in half, thereby producing two sublists. For simplicity, FIGS. 3A and 3B correspond to a situation where only one halving or division is necessary. However, in general, the sublists would thereafter be repeatedly divided until their size is less than or equal to the amount of available memory 4. Hence, preferable, the dividing would be a recursive operation. Table I provided below illustrates the division of the sequential list 6 into sublists with those sublists being again subdivided into even smaller sublists.
TABLE I
Sequential List L1 L2 L3 L4 L5 L6 L7 L8 L9 L10 L11 0 1- 9 [ 5 1 4 1 2 1 0 1 7 1 1 1 6 1 8 1-3 Sublist 1-A Sublist 1-B 0 1 9 1 5 1 4 1 2 11 0 F7_[_1 1 6 1 8 1-31 SL 2-A SL 2-B SL 2-C SL 2-D 0 1 9 11 5 1 4 1 2 11 0) 1 7 1 1 l 6 1 8 1 37 0 The double bared lines " 11 " indicate where the divisions occurred.
Although Table I illustrates subdividing multiple times, the remainder of the description assumes for the most part that the original list 6 need only be divided 14 once. Therefore, for future examples, the sequential list 6 in Table I will be used, but it will be assumed that the available memory 4 can store up to six elements and that the only sublists are the first sublist (Sublist 1-A) which contains five elements and the second sublist (Sublist 1-B) which contains six elements.
In any event, after the division 14, pointers are initialized. Namely, a pointer P1 is set 16 to point to the address of the first element in the first sublist of the list 6, and a current location pointer (CLP) is set 18 to P1.
Next, the elements of the first sublist are processed element by element to produce a first partitioned sublist. First, a decision 20 is made is based on whether the element at P1 satisfies the predicate. In this example, it is assumed that the predicate is odd. If the element at P1 satisfies the predicate, then the element at P1 is moved 22 to the current location in the sublist as identified by CLP. Since the CLP is now occupied by the element at P I, the CLP is thereafter incremented 24 so that it points to the next available location in the sublist. On the other hand, if the element at P1 does not satisfy the predicate, then the element at P1 is copied 26 to the next available position in the available memory 4. For example, the first element in the working example of Table I for the first sublist is T". Hence, "0" would be moved to the first address location in the available memory 4 because it does not satisfy the predicate (odd).
In either case, following blocks 24 and 26, the pointer P1 is incremented 28, thus signifying that the method is ready to process the next element in the sublist. Next, a decision 30 is made based on whether P1 is greater than the number of elements in the sublist. If not, the processing returns to repeat blocks 20-28 for other elements in the sublist until the 3 11 0 condition is satisfied. In the working example, when the Pointer P1 is at six for the first sublist, it exceeds the size of the first sublist which is five. The method then knows that all the elements in the sublist have been processed.
When decision 30 is satisfied, the sublist being processed has been partitioned. However, to be complete, all the elements being temporarily held in the available memory 4 are copied 32 to the sublist beginning at the location identified by the CLP. The partitioned sublist is then complete.
Next, a decision 34 is made based on whether all sublists have been partitioned. If the second sublist has not yet been processed, the decision 34 causes blocks 18-32 to be repeated for the second sublist after first setting 36 pointer P1 to the address of the first element in the second sublist.
After completing the processing for both the first and second sublists, decision 34 is satisfied. At this point, the sublists of the sequential list 6 are themselves partitioned. That is, the list 6 itself has been changed. Table II illustrates the elements of the list at this stage for the working example.
Table][I
First Partitioned Sublist Second Partitioned Sublist 9 1 5] 0 1 4 1 2 7 _1 1 1 3 1 0 1 6 1 8 Note, however, at this stage of processing (as shown in Table II) the second portion of the first sublist contains elements not satisfying the predicate (i.e., "0", 'W' and "2"), and the first portion of the second sublist contains elements that do satisfy the predicate (i.e., "7", "P' and "V). Hence, to obtain the partition of the entire list 6, the contiguous locations of these portions must be swapped 38. The swapping 38 can be achieved in a number of known ways by those in the art. For example, one may use an in-place rotate scheme. Alternatively, however, it is preferable to make use of the available memory 4 in performing the swap operation because it will usually be faster. As an example, if one of the portions needing moved fits i 0 11 into the available memory 4, the portion is moved there; thereafter, the other portion needing moved is moved into its vacated slots in the list, and finally, the portion held in the available memory 4 is moved to the now vacant other portion.
In the more general case, if multiple subdividing is required, each pair of adjacent sublists generated by a subdivision operation would be combined in the reverse order of their subdivision until the combination produces the partitioned list. For example, with reference to Table I, initially (after partitioning) SL 2-A would be combined with SL 2-B, and SL 2-C would be combined with SL 2-D, thereafter the resulting partitioned sublists I-A and I-B would be combined to produce the partitioned list.
In any case, after performing block 38, the entire list 6 is now partitioned. Table III illustrates the partitioned list for the working example.
Table HI
Partitioned List 9 1 5 J.7 1 1 1 3 1 0 1 4 1 2 1_ 0 1 6 1 8 A final operation of the method of the first embodiment is to set 40 a partition pointer to identify where in the partitioned list the division is between those elements satisfying the predicate and those not. This completes the embodiment of the method for the case when the size of the list 6 exceeds the amount of memory 4 available.
Although the above-described method describes the operation of the space-adaptive partitioning technique, the first embodiment also operates in the case where the available memory 4 is at least equal to the size of the list 6. In this case, the list 6 need not be divided or otherwise adapted to the size of the available memory 4. Here, the method operates as follows. The decision 12 directs control to block 42 because the amount of available memory 4 is at least equal to the size of the list 6 (FIG. 3C). Initially, 113 0 pointer P I is set 42 to the address of the first element in the list 6, and the current location pointer (CLP) is set 44 to the value of Pl.
Next, a decision 46 is made based on whether the element of the list 6 at location P1 satisfies the predicate 8. If the element at P1 satisfies the predicate 8, the element at location P1 is moved 48 into the current location in the list 6 which is identified by the CLP. The CLP is then incremented so as to point to the next available location in the list 6. If, on the other hand, the element at P1 does not satisfy the predicate 8, then the element at P1 is copied 52 to the next available position in memory.
In either case, following blocks 50 and 52, the pointer P1 is incremented 54 so as to point to the next element to be processed. Next, a decision 56 is made based on whether pointer P1 is greater than the number of elements in the list 6. If P1 is not greater than the number of elements in the list 6, then blocks 46-54 are repeated until the condition is satisfied (e.g., all the elements in the list processed). If, on the other hand, P1 is greater than the number of elements in the list 6, all the elements held in available memory 4 are copied 58 to the list 6 beginning at the location of the CLP. Finally, the partition pointer for the partitioned list is set 60.
FIGS. 4A, 4B and 4C are flow charts of the space-adaptive stable partitioning technique according to a second embodiment of the present invention. The second embodiment is similar to the first embodiment but relates to a three-partition approach, whereas the first embodiment relates to a two-partition approach. The second embodiment is described in detail below with reference to FIGS. 4A, 4B and 4C.
Initially, a decision 62 is made upon comparing the size of the list 6 with the amount of available memory 4. If the amount of available memory 4 is at least as large as the list size, then the stable partitioning technique need not adapt itself to the space available in the memory. In this case, the processing follows the operations discussed below with reference to FIG.
4C.
0 k On the other hand, when the amount of memory 4 available is smaller than the list size, the stable partitioning operates differently so that it adapts itself to the amount of memory 4 which is available. First, the list 6 is divided 64 in half. As with the first embodiment, in the general case, the dividing would be repeated until the condition of block 62 is satisfied. However, for simplicity, it is assumed that only one halving is needed.
Next, several pointers are initialized. In particular, pointer P1 is set 66 to the address of the first element in the first sublist. A current location pointer (CLP) is set 68 to the value of P1. In addition, a pointer MEM_FRONT is set 68 to the first location in available memory 4, and a pointer MEM - REAR is set 68 to the last location in available memory 4.
Once the pointers are initialized, the elements are compared one at a time with the predicate. Here, there are three results of the comparison, namely " - 1 ", " 0 " or " + 1 " or <, = or >, the later is used hereinafter. If decision 70 determines that the element at P1 is less than the predicate, then the element at P1 is moved 72 to the sublist at the location indicated by CLP, and CLP is incremented 74. If decision 76 determines that the element at P1 is equal to the predicate, then the element at P1 is moved 78 to the available memory 4 at the location of MEM - FRONT, and MEM-FRONT is incremented 80. If decision 82 determines that the element at P1 is greater than the predicate, then the element at P1 is moved 84 to the available memory 4 at the location of MEM-REAR, and MEM-REAR is incremented 86. Whichever of these three branches that is active for a given element, afterwards the pointer P1 is incremented 88 so as to point to the element to be processed next.
Next, a decision 90 is made based on a comparison of pointer P1 with the number of elements in the sublist. If the comparison indicates that all the elements in the sublist have not been processed, then the processing repeats blocks 70-88 until all the elements in the sublist have been processed.
0 J5 Once all the elements have been processed, the elements held in available memory starting from the front of the available memory 4 and ending with location MEM - FRONT - 1 are copied 92 in order to the sublist beginning at the location of CLP. Then, the elements held in available memory starting from the end of the available memory 4 and ending with location MEM-REAR + 1 are copied 94 in reverse order to the sublist.
Next, a decision 96 is made based on whether both of the sublists have been processed. If only the first sublist has been processed, then pointer P I is set 98 to the address of the first element in the second sublist, and blocks 68-94 are repeated for the second sublist.
At this point, both sublists have been individually partitioned. To obtain the desired partitioned list, these partitioned sublists must be combined. Initially, the first and second parts of the second sublist are swapped 100 with the third part of the first sublist. Thereafter, the first part of the second sublist is swapped 102 with the third part of the first sublist. Notice that in this embodiment two swap operations are needed for the three-way partition, whereas in the first embodiment only one swap was needed.
Finally, partition pointers are set 104 for the partitioned list. Since the list is partitioned into three parts, two pointers are needed to point to the boundaries between the parts.
Although the above-described method describes the operation of the spaceadaptive technique, the second embodiment also operates in the case where the available memory 4 is at least equal to the size of the list 6. In this case, the list 6 need not be divided or otherwise adapted to the size of the available memory 4. Here, the method operates as follows. The decision 62 directs control to block 106 when the amount of available memory 4 is at least equal to the size of the list 6 (FIG. 4Q. Initially, pointers are initialized 106. Pointer P1 is set 106 to the address of the first element in the list 6, CLP is set 106 to the value of P1, pointer 1 4P 6 MEM_FRONT is set 106 to the first location of available memory 4, and pointer MEM - REAR is set 106 to the last location of available memory 4. Once the pointers are initialized, the elements are compared one at a time
with the predicate. As before, there are three results of the comparison, namely "- 1 % "0" or " + 1 " or <, = or >, the later is used hereinafter. If decision 108 determines that the element at P1 is less than the predicate, then the element at P 1 is moved 110 to the list at the location indicated by CLP, and CLP is incremented 112. If decision 114 determines that the element at P1 is equal to the predicate, then the element at P1 is moved 116 to the available memory 4 at the location of MEM-FRONT, and MEM_FRONT is incremented 118. If decision 120 determines that the element at P1 is greater than the predicate, then the element at P1 is moved 122 to the available memory 4 at the location of MEM - REAR, and MEM REAR is incremented 124. Whichever of these three branches that is active for a given element, afterwards the pointer P1 is incremented 126 so as to point to the element to be processed next.
Next, a decision 128 is made based on a comparison of pointer P1 with the number of elements in the list 6. If the comparison indicates that all the elements in the list 6 have not been processed, then the processing repeats blocks 108-126 until all the elements in the list have been processed.
Once all the elements in the list 6 have been processed, the elements held in available memory starting from the front of the available memory 4 and ending with location MEM-FRONT - 1 are copied 130 in order to the list beginning at the location of CLP. Then, the elements held in available memory starting from the end of the available memory 4 and ending with location MEM_REAR + 1 are copied 132 in reverse order to the list 6.
At this point, the list 6 is partitioned. The partition pointers are set 134 for the partitioned list. The processing according to the second embodiment is then completed.
t J 113 Although the above described embodiments physically move the position of the objects (or elements) within a sequential list so as to partition the list, the objects need not be physically moved if the sequential list itself comprises pointers. For example, the sequential list may be a one-dimensional array of pointers which point to individual database records which are to be partitioned in accordance with a predicate. Here, the objects of the list point to the storage location (e. g., record) of the elements actually compared with the predicate. In this example, the partitioning is the same, except that the partitioned list will be the list of pointers suitable rearranged so as to group all the pointers of the list which point to records that satisfy the predicate before those that do not.
By using the space-adaptive stable partitioning techniques described above, substantial speed gains are realized even when only a small amount of extra memory is available.
The partitioning techniques described above can be used in conjunction with a sorting technique to sort repimy a sequential list. An example of this type of usage is described in detail in our copending British patent application no. (RJ/N2630) filed the same day as this application.
The disclosures in United States patent application no. 08/155,980, from which this application claims priority, and in the abstract accompanying this application are incorporated herein by reference.
I

Claims (1)

1. A method of partitioning in a stable manner a sequential list in a data processing system comprising the steps of IT a) receiving a sequential list and a condition; b) determining the amount of memory available for use in the data processing system; c) when the size of the sequential list exceeds the amount of available memory, dividing the sequential list into sublists until the amount of available memory equals or exceeds the size of the sublists; d) partitioning in stable manner on the basis of the received condition, each of the sublists using the available memory to produce partitioned sublists; and e) combining the partitioned sublists to produce the partitioned list.
2. A method as recited in claim 1, wherein, for each of the sublists said partitioning step includes the step of placing all the objects of the sublist that satisfy the predicate before the objects that do not.
3. A method as recited in claim 2, wherein the partitioned sublists are combined so that all the objects in the partitioned list that satisfy the predicate are placed before the objects that do not.
4. A method as recited in claim 1, 2 or 3, wherein said combining step includes the step of rotating a second portion of one of the sublists with a first portion of an adjacent sublist.
5. A method as recited in claim 1, 2, 3 or 4, wherein said combining step includes the step of swapping a second portion of one of the sublists with a first portion of an adjacent sublist.
IQ 6. A method as recited in any preceding claim, wherein the partitioned sublists are combined in the reverse order in which they were divided.
7. A method as recited in any preceding claim, wherein when each of the partitioned sublists includes a condition -satisfying portion and a condition-nonsatisfying portion, the combining step includes, for a pair of partitioned sublists, the step of swapping the condition- satisfying portion of a second sublist of the pair with the condition -nonsatisfying portion of a first sublist of the pair, the first sublist of the pair being closer to the beginning of the sequential list than the second sublist.
8. A method as recited in any preceding claim, wherein the order of objects in the partitioned list that do not satisfy the condition is the same as their order in the sequential list.
9. A method as recited in any preceding claim, wherein the combining step comprises the step of producing a partition pointer for the partitioned list.
10. A method according to any preceding claim, wherein the partitioning step performs a three-way partition on each of the sublists.
Partitioning apparatus for partitioning in a stable manner a sequential list comprising:
a space-adaptive partitioning device operative to receive a sequential list and a condition, to partition the sequential list on the basis of the condition and to output the partitioned list; and a memory, operatively connected to said partitioning device, for temporarily storing elements of the sequential list during partitioning of the sequential list; said partitioning device including comparison means for comparing the size of the list to be partitioned to the amount of memory available for use, dividing means for dividing the sequential list into sublists when said comparison means determines that the list size exceeds the amount of available memory, said dividing means being operative to subdivide repetitively the sequential list or sublists thereof until said comparison means indicates that the size of the resulting sublists no longer exceeds the amount of memory available; partitioning means for partitioning in stable manner each sublist by itself to produce partitioned sublists; and combining means for combining the partitioned sublists to produce the partitioned list.
12. A method of partitioning a list substantially as hereinbefore described with reference to and as illustrated in the accompanying drawings.
13. Partitioning apparatus substantially as hereinbef ore described with reference to and as illustrated in the accompanying drawings
GB9423237A 1993-11-19 1994-11-17 Stably partitioning a sequential list with limited memory Withdrawn GB2284078A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US15598093A 1993-11-19 1993-11-19

Publications (2)

Publication Number Publication Date
GB9423237D0 GB9423237D0 (en) 1995-01-04
GB2284078A true GB2284078A (en) 1995-05-24

Family

ID=22557565

Family Applications (1)

Application Number Title Priority Date Filing Date
GB9423237A Withdrawn GB2284078A (en) 1993-11-19 1994-11-17 Stably partitioning a sequential list with limited memory

Country Status (3)

Country Link
JP (1) JPH07192008A (en)
DE (1) DE4422208A1 (en)
GB (1) GB2284078A (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5268849B2 (en) * 2009-09-30 2013-08-21 京セラドキュメントソリューションズ株式会社 Display device, image forming apparatus equipped with the same, and electronic apparatus

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB1289451A (en) * 1970-05-04 1972-09-20
GB1563482A (en) * 1975-10-16 1980-03-26 Singer Co Multipass sorter for arranging an input list into numerical order
GB1571961A (en) * 1976-05-12 1980-07-23 Ibm Data handling apparatus for storing and permuting equal length records
EP0221358A2 (en) * 1985-11-07 1987-05-13 International Business Machines Corporation Sort string generation in a staged storage system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB1289451A (en) * 1970-05-04 1972-09-20
GB1563482A (en) * 1975-10-16 1980-03-26 Singer Co Multipass sorter for arranging an input list into numerical order
GB1571961A (en) * 1976-05-12 1980-07-23 Ibm Data handling apparatus for storing and permuting equal length records
EP0221358A2 (en) * 1985-11-07 1987-05-13 International Business Machines Corporation Sort string generation in a staged storage system

Also Published As

Publication number Publication date
DE4422208A1 (en) 1995-06-01
GB9423237D0 (en) 1995-01-04
JPH07192008A (en) 1995-07-28

Similar Documents

Publication Publication Date Title
DE4293456B4 (en) Electronic logic circuit
US5179699A (en) Partitioning of sorted lists for multiprocessors sort and merge
US6748405B2 (en) Method and circuits for performing the quick search of the minimum/maximum value among a set of numbers
DE69732873T2 (en) System for compressing / decompressing data
JP3378257B2 (en) System and method for nested split coding of sparse datasets
JPH0789372B2 (en) Image processing device
US5122979A (en) Method and a digital electronic device for the evaluation of an extremum of a set of binary encoded data words
DE69032828T2 (en) Sorting accelerator that uses a bidirectional sorter as a mixer
US6618804B1 (en) System and method for rearranging bits of a data word in accordance with a mask using sorting
KR100221248B1 (en) Extensible median filter
GB2268607A (en) Font data creation method
DE60221567T2 (en) INSERT-GRADERS
JP2002515669A (en) Sequence generator
US5727200A (en) Parallel merge sorting apparatus with an accelerated section
GB2284078A (en) Stably partitioning a sequential list with limited memory
US5440736A (en) Sorter for records having different amounts of data
GB2284079A (en) Sorting or merging lists
US6208764B1 (en) Rank filter using a linked-list to link elements in a memory array in numerical order
WO1991000652A1 (en) Process and device for coding a sequence of elements
US6938064B1 (en) Method for computing fast Fourier transform and inverse fast Fourier transform
DE69029544T2 (en) Memory architecture and hashing circuitry
US20020150305A1 (en) Data filtering apparatus and method
EP1162546A2 (en) In-place memory management for FFT
Prasanna et al. Scalable data parallel object recognition using geometric hashing on CM-5
US6411958B1 (en) Data processing system and method for generating a structured listing of symbols

Legal Events

Date Code Title Description
WAP Application withdrawn, taken to be withdrawn or refused ** after publication under section 16(1)