# Questions tagged [sorting]

Sorting is the process of arranging similar items according to a predefined order.

14 questions
Filter by
Sorted by
Tagged with
1 vote
42 views

### Computing a sorting matrix for an upper triangular matrix

Assume I have a real upper triangular matrix $U$, there exists an orthogonal matrix $M$ such that $U' = M^T U M$ is also upper triangular and has the same eigenvalues as $U$ but sorted by value. Is ...
• 345
108 views

### How to stack N boxes of varying heights into M stacks, most evenly

The "standard" box-stacking algorithm(s) AFAIK assume a single stack and try to put the "largest" boxes on the bottom. The case I want to solve is simply to distribute the N boxes ...
• 41
1 vote
69 views

### Resampling an array of objects

Context I have an array of objects (or a list of dictionaries), sorted in order based on a property of each object, say, time. In JSON, it would look something ...
• 197
1 vote
60 views

### Two-dimensional ordering issue – alternate sort order ascending/descending to reduce fluctuations - trivial?

I have a solution in search of a problem that some of you could perhaps help me with. Let $L$ be a list of elements. Each element has two inherent properties/attributes ($a$, $b$) that can each be ...
• 23
438 views

### Sorting Triangle vertices based on indices for alpha blending (back to front) C++, OpenGL

I have implemented in OpenGL alpha blending for a triangle mesh. I render this mesh using a vector of indices that indicate which vertex from a vertices vector should be drawn. The problem is to ...
2k views

### A robust algorithm to sort a non-convex polygon vertices

Let v_{0},...,v_{N-1} be N points in a Cartesian xy plane defining the vertices of closed polygon (i.e. v_{N} = v_{0}). Let P_{0}...
• 139
1 vote
590 views

### Maintain sorted ring buffer [closed]

I would like to insert elements into a ring (circular) buffer one at a time and maintain a permutation array which keeps track of the sorted elements in ascending order. To do this, I have adapted the ...
• 1,068
70 views

### LAPACK zlapmt_ freezes code [closed]

I'm using LAPACK's zggev_ routine to solve some generalized eigenvalue problem. While it produces the correct results, I want the eigenvalues and according eigenvectors sorted by absolute value. For ...
1 vote
41 views

### An algorithm to turn descending order into ascending order, but why correct? [closed]

I wonder why does this algorithm below work well? Many appreciates! Task: Suppose all elements in an array with length $n = 2^m$ are in descending order: $a_1 > a_2 > ... > a_n$, we need to ...
1 vote
431 views

### extract exhaustive mutually exclusive intervals from larger set of intervals [closed]

I have a collection of time intervals with integer valued endpoints , e.g. (1,2), (2, 6) (5,6), and the number of events falling in each time interval, and I would like to determine if from them I ...
• 11
1 vote
1k views

What is the fastest multithreaded radix sort code out there? I am using radix sort to sort the Morton/Hilbert keys when constructing a tree structure. The number of identical keys is in the range of ...
1 vote
1k views

### Sorting eigenvalues by the dominant contribution

[Edited to simplify the question] I am trying to associate the eigenvalues $E$ of a matrix $H$ to the original rows of the matrix. Moreover, it would be trivial to sort the eigenvalues in ascending ...
• 5,429