sorting

Keyword sorting algorithm

I have over 1000 surveys, many of which contains open-ended replies. I would like to be able to 'parse' in all the words and get a ranking of the most used words (disregarding common words) to spot a trend. How can I do this? Is there a program I can use? EDIT If a 3rd party solution is not available, it would be great if we can keep...

insertion sort for pdp-11

I'm studying pdp-11 and assembly, I'm very interested, is it possible to find insertion sort on assembly for pdp-11, thanks in advance for everyone, if yes where? ...

Improve performance of sorting files by extension

With a given array of file names, the most simpliest way to sort it by file extension is like this: Array.Sort(fileNames, (x, y) => Path.GetExtension(x).CompareTo(Path.GetExtension(y))); The problem is that on very long list (~800k) it takes very long to sort, while sorting by the whole file name is faster for a couple of seconds!...

Sort a list of dicts by dict values

I have a list of dictionaries: [{'title':'New York Times', 'title_url':'New_York_Times','id':4}, {'title':'USA Today','title_url':'USA_Today','id':6}, {'title':'Apple News','title_url':'Apple_News','id':2}] I'd like to sort it by the title, so elements with A go before Z: [{'title':'Apple News','title_url':'Apple_News','id':2}, {'...

Java - PriorityQueue vs sorted LinkedList

Hello, Which implementation is less "heavy": PriorityQueue or a sorted LinkedList (using a Comparator)? I want to have all the items sorted. The insertion will be very frequent and ocasionally I will have to run all the list to make some operations. Thank you! ...

Java - Collections.sort() performance

Hello, Im using Collections.sort() to sort a LinkedList whose elements implements Comparable interface, so they are sorted in a natural order. In the javadoc documentation its said this method uses mergesort algorithm wich has n*log(n) performance. My question is if there is a more efficient algorithm to sort my LinkedList? The size...

Search algorithm (with a sort algorithm already implemented)

Hello, Im doing a Java application and Im facing some doubts in which concerns performance. I have a PriorityQueue which guarantees me the element removed is the one with greater priority. That PriorityQueue has instances of class Event (which implements Comparable interface). Each Event is associated with a Entity. The size of that p...

PHP 5.2 Function needed for GENERIC sorting of a recordset array

Somebody must have come up with a solution for this by now. We are using PHP 5.2. (Don't ask me why.) I wrote a PHP class to display a recordset as an HTML table/datagrid, and I wish to expand it so that we can sort the datagrid by whichever column the user selects. In the below example data, we may need to sort the recordset array by Na...

Order records from multiple models by attribute

Given the three models “message”, “profile” and “comment” i want to merge them into one list, ordered by their common attribute “created_at”. I want to accomplish something like the project overview in Basecamp - see 3) here: http://basecamphq.com/tour#overview ...

jsf datatable lazy load filter and sorting

Hi, I have worked on several projects with a lot of data tables. The tables had sorting, filtering and paging of course on server side and with help of the db (all databases has implemented sording, filtering -where and limit the returned results). When workig on real application there are a thousands of even a millions rows. But I ha...

How do i parse a map (foreach) in the same order i created it (JAVA)

So i have a map that i created (inserted data) in an order i wanted. When parsing the map the 1st key returned in foreach is not the first key i inserted. Is there a way for that to happen? Also sorting my map is kinda tricky cause it has to be sorted by Value and in specific field within the Value. Ty ...

Sorting an array of objects in ActionScript 3

Hi, I'm trying to sort an array of objects with ActionScript 3. The array is like this: var arr:Array = new Array (); arr.push ({name:"John", date:"20080324", message:"Hi"}); arr.push ({name:"Susan", date:"20090528", message:"hello"}); can I do something with Array.sort(...) method? ...

Why does the Java Collections Framework offer two different ways to sort?

If I have a list of elements I would like to sort, Java offers two ways to go about this. For example, lets say I have a list of Movie objects and I’d like to sort them by title. One way I could do this is by calling the one-argument version of the static java.util.Collections.sort( ) method with my movie list as the single argument....

Rectangular divs with textual content are arranged in rows based on their sort order

Is it possible to create the following behavior with one or more existing JQuery plugin(s)/widget(s)... or with some other web framework? Rectangular divs with textual content are arranged in rows (left to right) based on their sort order, and then flow to the next line if needed (top to bottom). ...

What is the difference between these two nloglog(n) sorting algorithms? (Andersson et al., 1995 vs. Han, 2004)

Swanepoel's comment here lead me to this paper. Then, searching for an implementation in C, I came across this, which referenced another paper on an algorithm described here. Both papers describe integer sorting algorithms that run in O(nloglog(n)) time. What is the difference between the two? Have there been any more recent findings ...

Sorting a List based on an ArrayList within a custom Object

I am using a list to keep track of a number of custom Row objects as follows: Public Rows As List(Of Row)() Row has 2 properties, Key (a String) and Cells (an ArrayList). I need to be able to sort each Row within Rows based on a developer defined index of the Cells ArrayList. So for example based on the following Rows Row1.Cells =...

sort array with special characters in php

I have an array I'm trying to asort using php. The problem is that the array has accented characters in it and needs to be sorted using "french" rules. cote < côte < coté < côté I've tried many things, like using php collators, but I get the following error : PHP Fatal error: Class 'Collator' not found I've also tried to set loca...

PHP 5.2 Function needed for GENERIC sorting FOLLOWUP

OK, you guys gave me a great solution for sorting a recordset array last Friday. (http://stackoverflow.com/questions/2884325/php-5-2-function-needed-for-generic-sorting-of-a-recordset-array) But now when I implement it, I end up with an extra element in the recordset array. I won't wast space reposting the same info, as the link is abov...

Cakephp, good ordering / sorting behaviour?

Hi, Does anyone know any good ordering and sorting behaviours for cakephp? The sort where I can have "Move Up", "Move Down", "Move to top" and "Move to bottom"? That sort of this. Thanks! ...

sort an array of floats in c++

Hi, I have an array of (4) floating point numbers and need to sort the array in descending order. I'm quite new to c++, and was wondering what would be the best way to do this? Thanks. ...