77,912 questions
0
votes
2
answers
48
views
Why does sorting reduces the time of my function?
time { < <(seq 0 20000) readarray -t array ; }
takes on my computer: 0.309s. But...
time { < <(seq 0 20000|sort) readarray -t array; }
takes only: 0.074s
Sorting should add time ...
-3
votes
1
answer
139
views
Why doesn’t my insertion sort implementation work? [closed]
I understand the idea of the insertion sorting algorithm, and I know how it works after watching many videos and doing research. However, I had never seen any code for it, so I tried to code it myself....
-10
votes
2
answers
120
views
How do I sort an array of objects by either number or string property value? [closed]
I have an array of objects whose values are a mixture of strings and integers. I have a script that sorts the array depending on the key I send to it. It works if the value of the passed key is a ...
Advice
0
votes
2
replies
37
views
Big O Notation - data structures
i am learning about big o notation and need a little bit of clarity before i diverge into the wrong path. my understanding is o() is suppose to represent the time it takes for a program to do a task ...
2
votes
0
answers
48
views
16-way radix sort without threadgroup/warp shared memory prefixsums
I've been implementing radix sort for SPH simulation use for some time now, and initially I've had increased to to use 4 bits radix and make it 16 way radix sort which I haven't seen documented too ...
0
votes
0
answers
47
views
Sorting problem in mongoose while sorting through query parameter [closed]
the code is working properly when i fetch normal data or try to fetch data based on condtions like less then or greater then all these are working properly
but when i try to sort the data that is not ...
Advice
0
votes
9
replies
51
views
Accessing Sort Index for JTable
In the Java file browser I’m working on, I’m running two components at the same time: a JTable and a JList. Both refer to the same file list, and I'd like both to be sorted the same way -- ideally by ...
3
votes
2
answers
163
views
sorting arrays of arrays of ints (2-d array) does not work (it sorts as strings; 1-d arrays work)
A 1-d array of ints sorts correctly.
An array of arrays of ints does not sort as ints; it sorts as strings.
(10,1,2) | Sort-Object
This works and is sorted as ints:
1
2
10
But consider this code:
$...
3
votes
3
answers
169
views
How do I optimize my 2D Array Point Searcher
So, I decided to make an algorithm with some linear and binary search where you have a 2D array like Array [,] = {{5,2}, {0,3}, {1,2}, {3,2}} and it finds the certain subarray for example like {5,2}. ...
1
vote
0
answers
95
views
What adjustments should be made to my code to make my products sort alphabetically when multiple items have the same stock status?
I own a website that sells rare clothing products sourced from all around the country. Because no item that we buy is ever in the same condition, we create a different listing for each item with ...
0
votes
1
answer
84
views
How do I sort a Pandas DataFrame using a column name stored in a variable?
I am working with a Pandas DataFrame containing student data (GRE scores, TOEFL scores, etc.). I need to sort this DataFrame based on a specific column, but the column name is provided by the user as ...
1
vote
1
answer
79
views
Angular Material: Programmatically setting MatSort does not update UI sort arrow
I'm working with an Angular Material table (mat-table) that has sorting enabled via matSort. Sorting works perfectly when I click on the column headers (mat-sort-header).
Now, I want to trigger the ...
Advice
1
vote
8
replies
146
views
Making a palindrome out of a string of random letters (or any given value type inputs)
Found this code exercise on W3R. Been trying to figure out the relationship between the outer and inner loop (i and j), but can't seem to wrap my head around it. If anyone could walk me through this ...
4
votes
3
answers
226
views
How to sort a dictionary of word counts by value while preserving the original key order? [duplicate]
I am trying to count word frequencies in a text and then sort them in descending order of frequency. So if two words have the same frequency, they should remain in the same order they first appeared ...
Best practices
1
vote
0
replies
35
views
How to effectively implement sorting in universe basic programming language
The current version of universe programming language I working on does not cater for SORT function. For certain application , there a need read from a record file which contains over 100 items ...