New answers tagged sorting
1
vote
Ordering function with recognition of duplicates
Using Association - related functions (which were not available at the time the question was posted):
...
1
vote
Sort matrix by columns and rows without changing them
Using ReverseSort:
ReverseSort[ReverseSort /@ Transpose[tab]]
(*{{1, 1, 1, 1}, {1, 1, 1, 0}, {1, 1, 0, 0}, {1, 0, 0, 0}}*)
1
vote
1
vote
Implementing HeapSort in WL
Thanks go for Daniel for helping me to fix my problem. The fixed code is shown below:
...
1
vote
2
votes
Accepted
How to sort filenames in actual numerical order?
Just use SortBy[names, {StringLength, Identity}]
With numbers:
...
5
votes
8
votes
How to sort filenames in actual numerical order?
This approach doesn't require extracting the numerical identifier. It first groups by length of filename and then lexicographically within each group.
...
1
vote
Retaining and reusing a one-to-one mapping from a sort
Since V 12.0 there is OrderingBy which simplifies the solution considerably:
...
5
votes
How to sort filenames in actual numerical order?
same way, but extract number automatically.
...
5
votes
How to sort filenames in actual numerical order?
$Version
(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)
Clear["Global`*"]
File names in random order
...
5
votes
Accepted
4
votes
5
votes
Reproducing a ranking function that behaves like Excel's RANK
xlRanks = 1 + Length @ # - Ceiling @ Statistics`Library`GetDataRankings @ # &;
Examples:
...
4
votes
2
votes
Inserting an integer into a sorted list
1. Introduction
Since V 12.1 there is CreateDataStructure
A link to its many members:
DataStructures
A suitable choice for the question at hand would be ...
0
votes
Writing a function that sorts by low powers while ignoring higher powers of various variables
If I decompress your example and assign it to "ampl", then I can run the following code on it:
...
0
votes
Sorting a list of lines such that they are successively connected
Here is what I coded. Here, $u$ has a list of lines. $v$ is the list of directed lines. To this end, the initial line segment must be specified, i.e., $v_{1}=u_{15}$ below.
...
Top 50 recent answers are included
Related Tags
sorting × 424list-manipulation × 167
matrix × 35
order × 26
functions × 22
performance-tuning × 21
plotting × 20
string-manipulation × 13
dataset × 11
output-formatting × 10
associations × 10
import × 9
filtering × 9
function-construction × 8
graphs-and-networks × 8
linear-algebra × 8
polynomials × 8
gathering × 8
programming × 7
eigenvalues × 7
permutation × 7
data × 6
files-and-directories × 6
code-request × 6
algorithm × 6