Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
X + Y sorting
In computer science, X + Y sorting is the problem of sorting pairs of numbers by their sums. Applications of the problem include transit fare minimisation, VLSI design, and sparse polynomial multiplication. As with comparison sorting and integer sorting more generally, algorithms for this problem can be based only on comparisons of these sums, or on other operations that work only when the inputs are small integers.
It is unknown whether this problem has a comparison-based solution whose running time is asymptotically faster than sorting an unstructured list of equally many items. Therefore, research on the problem has focused on two approaches to settle the question of whether such an improvement is possible: the development of algorithms that improve on unstructured sorting in their number of comparisons rather than in their total running time, and lower bounds for the number of comparisons based on counting cells in subdivisions of high-dimensional spaces. Both approaches are historically tied together, in that the first algorithms that used few comparisons were based on the weakness of the cell-counting lower bounds.
The input to the sorting problem consists of two finite collections of numbers and , of the same length. The problem's output is the collection of all pairs of a number from and a number from , arranged into sorted order by the sum of each pair. As a small example, for the inputs and , the output should be the list of pairsof one element from and one element from , listed in sorted order by their sums of pairsOne way to solve the problem would be to construct the pairs to be sorted (the Cartesian product of the two collections) and use these pairs as input to a standard comparison sorting algorithm such as merge sort or heapsort. When the inputs have length , they form pairs, and the time to sort the pairs in this way is . In terms of its big O notation, this method is the fastest known algorithm for sorting. Whether a faster algorithm exists is an open problem, posed by Elwyn Berlekamp prior to 1975.
A variant of the problem sorts the sumset, the set of sums of pairs, with duplicate sums condensed to a single value. For this variant, the size of the sumset may be significantly smaller than , and output-sensitive algorithms for constructing it have been investigated.
Steven Skiena recounts a practical application in transit fare minimisation, an instance of the shortest path problem: find the cheapest two-hop airplane ticket between two given cities, from an input that describes both the cost of each hop and which pairs of hops may be combined into a single ticket. Skiena's solution consists of sorting pairs of hops by their total cost as an instance of the sorting problem, and then testing the resulting pairs in this sorted order until finding one that is allowed. To generate the sorted pairs in this order, Skiena uses a priority queue of pairs, initially containing only a single pair, the one consisting of the two cheapest hops. Then, when a pair is removed from the queue and found to be disallowed, two more pairs are added, with one of these two pairs combining with the next hop after in a sorted list of the hops to the destination, and the other pair combining with the next hop after in a sorted list of hops from the start. In this way, each successive pair can be found in logarithmic time, and only the pairs up to the first allowable one need to be sorted.
sorting is the most expensive subroutine in an algorithm for a problem in VLSI design, in which one must place two subunits of a VLSI circuit side-by-side along a communications channel in order to minimize the width of the channel needed to route pairs of wires from one subunit to the other. As one subunit is continuously shifted relative to the other, the channel width only changes at discrete positions where the ends of two wires line up with each other, and finding the sorted ordering of these positions in order to compute the sequence of changes to the width can be performed by sorting. If this sorting problem could be sped up, it would also speed up this VLSI design task.
Another application involves polynomial multiplication for polynomials of a single variable that may have many fewer terms than their degrees. The product of two polynomials can be expressed as a sum of products of pairs of terms, one from each polynomial, and placing these term-by-term products into degree order amounts to sorting them by the sum of degrees. For example, the instance of sorting with given as an example above corresponds to the multiplication of two three-term polynomials to produce a nine-term polynomial: The degrees are always integers, so integer-based algorithms for sorting may be applied. However, for polynomials whose number of terms is comparable to their degree, FFT-based polynomial multiplication algorithms may be significantly more efficient than term-by-term multiplication.
A well-known lower bound for unstructured sorting, in the decision tree model, is based on the factorial number of sorted orders that an unstructured list may have. Because each comparison can at best reduce the number of possible orderings by a factor of two, sorting requires a number of comparisons at least equal to the binary logarithm of the factorial, which is . Early work on sorting followed a similar approach by asking how many different sorted orderings are possible for this problem, and proving that this number is at most . However, because its binary logarithm is at most , much smaller than the known time bounds for sorting, this method can only lead to weak lower bounds on the number of comparisons.
Hub AI
X + Y sorting AI simulator
(@X + Y sorting_simulator)
X + Y sorting
In computer science, X + Y sorting is the problem of sorting pairs of numbers by their sums. Applications of the problem include transit fare minimisation, VLSI design, and sparse polynomial multiplication. As with comparison sorting and integer sorting more generally, algorithms for this problem can be based only on comparisons of these sums, or on other operations that work only when the inputs are small integers.
It is unknown whether this problem has a comparison-based solution whose running time is asymptotically faster than sorting an unstructured list of equally many items. Therefore, research on the problem has focused on two approaches to settle the question of whether such an improvement is possible: the development of algorithms that improve on unstructured sorting in their number of comparisons rather than in their total running time, and lower bounds for the number of comparisons based on counting cells in subdivisions of high-dimensional spaces. Both approaches are historically tied together, in that the first algorithms that used few comparisons were based on the weakness of the cell-counting lower bounds.
The input to the sorting problem consists of two finite collections of numbers and , of the same length. The problem's output is the collection of all pairs of a number from and a number from , arranged into sorted order by the sum of each pair. As a small example, for the inputs and , the output should be the list of pairsof one element from and one element from , listed in sorted order by their sums of pairsOne way to solve the problem would be to construct the pairs to be sorted (the Cartesian product of the two collections) and use these pairs as input to a standard comparison sorting algorithm such as merge sort or heapsort. When the inputs have length , they form pairs, and the time to sort the pairs in this way is . In terms of its big O notation, this method is the fastest known algorithm for sorting. Whether a faster algorithm exists is an open problem, posed by Elwyn Berlekamp prior to 1975.
A variant of the problem sorts the sumset, the set of sums of pairs, with duplicate sums condensed to a single value. For this variant, the size of the sumset may be significantly smaller than , and output-sensitive algorithms for constructing it have been investigated.
Steven Skiena recounts a practical application in transit fare minimisation, an instance of the shortest path problem: find the cheapest two-hop airplane ticket between two given cities, from an input that describes both the cost of each hop and which pairs of hops may be combined into a single ticket. Skiena's solution consists of sorting pairs of hops by their total cost as an instance of the sorting problem, and then testing the resulting pairs in this sorted order until finding one that is allowed. To generate the sorted pairs in this order, Skiena uses a priority queue of pairs, initially containing only a single pair, the one consisting of the two cheapest hops. Then, when a pair is removed from the queue and found to be disallowed, two more pairs are added, with one of these two pairs combining with the next hop after in a sorted list of the hops to the destination, and the other pair combining with the next hop after in a sorted list of hops from the start. In this way, each successive pair can be found in logarithmic time, and only the pairs up to the first allowable one need to be sorted.
sorting is the most expensive subroutine in an algorithm for a problem in VLSI design, in which one must place two subunits of a VLSI circuit side-by-side along a communications channel in order to minimize the width of the channel needed to route pairs of wires from one subunit to the other. As one subunit is continuously shifted relative to the other, the channel width only changes at discrete positions where the ends of two wires line up with each other, and finding the sorted ordering of these positions in order to compute the sequence of changes to the width can be performed by sorting. If this sorting problem could be sped up, it would also speed up this VLSI design task.
Another application involves polynomial multiplication for polynomials of a single variable that may have many fewer terms than their degrees. The product of two polynomials can be expressed as a sum of products of pairs of terms, one from each polynomial, and placing these term-by-term products into degree order amounts to sorting them by the sum of degrees. For example, the instance of sorting with given as an example above corresponds to the multiplication of two three-term polynomials to produce a nine-term polynomial: The degrees are always integers, so integer-based algorithms for sorting may be applied. However, for polynomials whose number of terms is comparable to their degree, FFT-based polynomial multiplication algorithms may be significantly more efficient than term-by-term multiplication.
A well-known lower bound for unstructured sorting, in the decision tree model, is based on the factorial number of sorted orders that an unstructured list may have. Because each comparison can at best reduce the number of possible orderings by a factor of two, sorting requires a number of comparisons at least equal to the binary logarithm of the factorial, which is . Early work on sorting followed a similar approach by asking how many different sorted orderings are possible for this problem, and proving that this number is at most . However, because its binary logarithm is at most , much smaller than the known time bounds for sorting, this method can only lead to weak lower bounds on the number of comparisons.