Skip to main content

Questions tagged [sorting]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
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 ...
Makogan's user avatar
  • 345
2 votes
1 answer
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 ...
Jim's user avatar
  • 41
1 vote
1 answer
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 ...
Seth Lutske's user avatar
1 vote
2 answers
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 ...
Rien's user avatar
  • 23
2 votes
1 answer
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 ...
Petros Yannopoulos's user avatar
2 votes
1 answer
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}...
John Snow's user avatar
  • 139
1 vote
0 answers
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 ...
vibe's user avatar
  • 1,068
0 votes
1 answer
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 ...
Artur's user avatar
  • 3
1 vote
0 answers
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 ...
Jiongjiong Li's user avatar
1 vote
1 answer
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 ...
Mike's user avatar
  • 11
1 vote
2 answers
1k views

Fastest multithreaded radix sort

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 ...
Rio Yokota's user avatar
1 vote
1 answer
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 ...
boyfarrell's user avatar
  • 5,429
4 votes
1 answer
496 views

Is it possible to compute quantiles of a set of numbers, without first sorting those numbers?

I apologize in advances if this is the wrong place to be asking this question, (I had considered putting it on CV first). I am studying financial (S&P, Dow Jones, etc) data, and would like to ...
TheGrapeBeyond's user avatar
2 votes
2 answers
355 views

Quicksort - difference in time

I'm testing Quicksort based on Niklaus Wirth algorithm. I'm checking how much time I need to sort an array. There is interesting thing that for an array consisting elements in these sequence: 1 3 ...
luke's user avatar
  • 23