sorting Questions

5

Solved

I'm kinda a Delphi-newbie and I don't get how the Sort method of a TList of Records is called in order to sort the records by ascending integer value. I have a record like the following: type TM...
Overnight asked 6/11, 2012 at 13:35

6

A question that has me speculating is the following: Let's say we have a sorted array with the numbers {1,1,1,1,2,2,4,4,4}. Now, given that we can clearly see that we have six pairs on 1's, one p...
Costanzo asked 26/9, 2017 at 12:2

15

Solved

Design an efficient algorithm to sort 5 distinct - very large - keys less than 8 comparisons in the worst case. You can't use radix sort.
Gahan asked 7/10, 2009 at 23:20

2

Solved

I'm using elastic search and I would like to sort documents having same score to the query shown below, on the basis of higher number of - "likes" field - integer type stored in all documents. Code...
Unfold asked 20/7, 2016 at 21:46

6

In JavaScript (somewhat applicable elsewhere), where you don't know what target implementation your code is running on, is there a way to feature detect if the underlying sorting algorithm (of Arra...
Gentle asked 10/5, 2013 at 1:33

6

Solved

I have 2d array, dimension 3x10, and I want to sort by values in 2nd row, from lowest to highest value.
Principalities asked 31/1, 2010 at 23:11

3

Solved

I'm killing myself and dehydrating trying to get this array to sort. I have an array containing directories generated by; Dim Folders() As String = Directory.GetDirectories(RootPath) I need them t...
Grandsire asked 23/6, 2010 at 7:8

12

Solved

I want to sort items where the comparison is performed by humans: Pictures Priority of work items ... For these tasks the number of comparisons is the limiting factor for performance. What is...
Havener asked 15/5, 2009 at 6:19

2

Solved

Let's say I have a vector of a very simple struct: struct SimpleStruct { int a; int b; int c; }; std::vector<SimpleStruct> vs; I wish to sort this struct by 'a' leaving the positions of 'b' ...
Mormon asked 19/6, 2024 at 0:35

7

Is it feasible to sort pandas dataframe by values of a column, but also by index? If you sort a pandas dataframe by values of a column, you can get the resultant dataframe sorted by the column, bu...
Drunkard asked 29/11, 2013 at 2:15

5

Solved

I am trying to figure out how to sort a list of files by name and size. How do I sort by file name and size using "du -a" and not show directories? Using "du -a" 1 ./locatedFiles 0 ./testDir/j...
Ulrica asked 18/3, 2012 at 0:43

5

Solved

I get a ndarray reading it from a file, like this my_data = np.genfromtxt(input_file, delimiter='\t', skip_header=0) Example input (parsed) [[ 2. 1. 2. 0.] [ 2. 2. 100. 0.] [ 2. 3. 100. 0.] ...
Concertina asked 30/3, 2015 at 17:29

7

Solved

Say we have string a = "abc" string b = "abcdcabaabccbaa" Find location of all permutations of a in b. I am trying to find an effective algorithm for this. Pseudo code: sort st...
Kr asked 6/1, 2017 at 22:3

11

Solved

Why won't this function reverseArrayInPlace work? I want to do simply what the function says—reverse the order of elements, so that the results end up in the same array arr. I am choosing to do thi...
Habakkuk asked 5/9, 2015 at 22:57

4

Solved

I'd like to convert the JSON string "{ \"birthday\": \"1988-03-18\", \"address\": { \"state\": 24, \"city\": 8341, \"country\": 1 } }" to "{ \"address\": { \"city\": 8341, \"country\": 1, \"sta...
Duvetyn asked 19/1, 2013 at 18:8

4

[ 1 => ['id' => 1, 'sort' => 1], 3 => ['id' => 3, 'sort' => 3], 2 => ['id' => 2, 'sort' => 2], ] How do I sort it so that it's re-ordered using the inner 'sort' key? ...
Unripe asked 27/9, 2010 at 13:34

9

Solved

I have an array of objects. I want to move a selected object to the last position in the array. How do I do this in javascript or jquery? Here is some code I have: var sortedProductRow = this.pro...
Ninnyhammer asked 23/7, 2014 at 11:33

4

Solved

Hi I have a question about Batcher's odd-even-merge sort. I have the following code: public class Batcher { public static void batchsort(int a[], int l, int r) { int n = r-l+1; for (int p=1; p...
Compatible asked 30/5, 2010 at 10:48

2

Solved

For applicable data types a good radix sort can beat the pants off comparison sorts by a wide margin but std::sort is usually implemented as introsort. Is there a reason to not use radix sort to im...
Sanmicheli asked 6/10, 2015 at 9:47

2

Solved

I'm dealing with the last big 4 of C++ 20, attempting to learn the new main features. Trying some code from the web related to ranges, I've written: std::vector ints{ 6, 5, 2, 8 }; auto even = [](i...
Prejudice asked 28/9, 2020 at 12:54

3

Solved

I am new to R and currently trying to wrap my head around dataframes in R. I want to sort a dataframe by the column values, and then return the top of it after it has been sorted. As of now I only ...
Ar asked 30/8, 2021 at 19:12

9

Solved

I am new to php, I have php date array [0] => 11-01-2012 [1] => 01-01-2014 [2] => 01-01-2015 [3] => 09-02-2013 [4] => 01-01-2013 I want to sort it like : [0] => 11-01-2012 [1...
Berwick asked 7/11, 2016 at 10:20

12

Solved

I have been looking around the web for a while and I am wondering if there is a 'stable' defacto implementation of Radix Sort that is generally used? Two classifications of radix sorts are least s...
Fatigued asked 9/4, 2016 at 6:14

4

Solved

I am currently working on DataGrid Component from Material-UI. Data can be displayed, but the inbuilt sorting is not working as expected. When I try to sort ASC/DESC it is sorting based on the firs...
Cooksey asked 29/3, 2021 at 19:53

10

Solved

I have a bunch of sorted lists of objects, and a comparison function class Obj : def __init__(p) : self.points = p def cmp(a, b) : return a.points < b.points a = [Obj(1), Obj(3), Obj(8), .....
Gib asked 21/7, 2009 at 9:21

© 2022 - 2025 — McMap. All rights reserved.