sort (4,109)


c# - How do you sort a dictionary by value?

c# - How do you sort a dictionary by value?

I often have to sort a dictionary, consisting of keys & values, by value. For example, I have a hash of words and respective frequencies, that I want to order by frequency. There is a SortedList which…


algorithm - Efficiently get sorted sums of a sorted list

You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are…


How do I remove duplicate items from an array in Perl?

I have an array in Perl: my @my_array=("one","two","three","two","three"); How do I remove the duplicates from the array?…


algorithm - Merge Sort a Linked List

I was recently brushing up on some fundamentals and found merge sorting a linked list to be a pretty good challenge. If you have a good implementation then show it off here.…


c++ - How does one rank an array(sort) by value?*With a twist*

I would like to sort an array in ascending order using C/C++. The outcome is an array containing element indexes. Each index is corespondent to the element location in the sorted array. Example Input…


Sorting an IList in C#

So I came across an interesting problem today. We have a WCF web service that returns an IList. Not really a big deal until I wanted to sort it. Turns out the IList interface doesn't have a sort metho…



java - shortcut for creating a Map from a List in groovy?

I'd like some sorthand for this: Map rowToMap(row){def rowMap=[:]; row.columns.each{ rowMap[it.name]=it.val}return rowMap;}given the way the GDK stuff is, I'd expect to be able to do something like: M…


Comparing Arrays of Objects in JavaScript

I want to compare 2 arrays of objects in JavaScript code. The objects have 8 total properties, but each object will not have a value for each, and the arrays are never going to be any larger than 8 it…


bash - Why doesn't**sort** sort the same on every machine?

Using the same sort command with the same input produces different results on different machines. How do I fix that?…


sql server - Natural(human alpha-numeric) sort in Microsoft SQL 2005

We have a large database on which we have DB side pagination. This is quick, returning a page of 50 rows from millions of records in a small fraction of a second. Users can define their own sort, basi…




array list order how example descending java value multiple python