Category "sorting"

Merging 4 sorted Arrays into one

I have this method to merge 2 sorted arrays into one sorted array: public void merge(T[] a, int l1, int r1, T[] b, int l2, int r2, T[] c, int l3) {

Slow MongoDB aggregate with $sort on _id field

I have a records collection with the following indexes: {"_id":1} {"car.make":1,"city":1,"car.mileage":1} And performing the following query: db.records.agg

How to sort Plotly bar chart in descending order

I have created a basic bar chart in plotly that I would like to sort by descending order. I couldn't find an easy way to specify this in the plotly syntax, so

Redis Command To Sort Keys

The Redis command keys * will return a list of all keys and scan 0 is a more recent way to do something similar, but with less blocking. Do any commands exist t

Sorting an array of strings in C++

I am trying to accomplish the following task: List the students in alphabetic order, sorted by last name. Do not change the given case of the names. Do not ch

sorting rows in a pandas dataframe in a way which is not alphabetical

I have some dataframes (df) with categorical data starting with: a, b, c and a category for "remaining categories". I would like to sort the month column in t

The ArraySort callback is not sorting my array in the correct order

Using ColdFusion to sort an multi-dimensional array based on a "Price per sq. ft" field from high to low. It has been in production and worked in testing, but

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

I have parameters like this that need to be sorted (Note: I am sorting AFTER converting the key=>value combinations to strings): $param['SignatureMethod']

Pivot table sorting

I have a pivot table result as below : len MERCHANT_NAME MCC_CODE 0.0 58635982 742.0 7378 763.0 750 780.0 281 1

Sort array of objects with date field by date

Give the following array of objects, I need to sort them by the date field ascending. var myArray = [ { name: "Joe Blow", date: "Mon Oct 31 2016 00:0

Order images based on similarity

I have a lot of images in a folder that I would like to put in order based on how similar they are. The images are histological slides from a tissue microarray

How can I order columns in a box chart in JFreeChart?

I have a box chart with multiple boxes in rows and columns. The ordering of the boxes is wrong. Each row (color) is labeled by an enum constant of type Multiple

Golang custom sort is faster than native sort

I was just playing around with sorting in golang and I found a qsort function on stackoverflow. It seems to run about twice as fast as the native sort function

Sorting strings in descending order in Javascript (Most efficiently)?

W3CSchools has this example: var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.sort(); fruits.reverse(); Is this the most efficient way to sort str

PHP sort array of objects by two properties

I have an array Array ( [0] => stdClass Object ( [tab_option_name_selector] => 2 [fieldtype] => notes [order] => 12

sort nested list data in python

I am trying to sort a nested list in python(3.8.5). I have a list like - [['1', 'A', 2, 5, 45, 10], ['2', 'B', 8, 15, 65, 20], ['3', 'C', 32, 35, 25, 140], [

How to sort list of tuples based on variable in tuple

Given a list of tuples in this format (item,[dependency, priority]) where the first element indicates an item, and the first element of the second indicates a d

HashMap should be unsorted but still sorts according to key

According to these: http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html Difference between HashMap, LinkedHashMap and TreeMap java beginner : How k

Insertion sort error occurring in a C program

I am probably missing something simple here, but I was looking over some simple algorithms in C and have not been able to get the insertion sort in the code bel

(Python) Heapsort min heap implementation for Non Increasing Order Sorting. What am I doing wrong?

def min_heapify(A,k, n): left = 2*k +1 right = 2*k +2 n=int(len(A)) if left < n and A[left] < A[k]: smallest = left else: