sorting

Obtaining memory available to JVM at runtime

I'm trying to sort a bunch of data such that that the size of data input to the program can be larger than the memory available to the JVM, and handling that requires external sort which is much slower than Quicksort. Is there any way of obtaining memory available to the JVM at runtime such that I could use in place sorting as much as p...

sphinxsearch , Mysql like : order by lang='2' desc , time_popular desc

is it possible with sphinx to sort a result like this mysql query? order by lang='2' desc , time_popular desc so get the latest documents with lang=2 in fist position. I really need your help :) ...

Sort algorithm with fewest number of operations

What is the sort algorithm with fewest number of operations? I need to implement it in HLSL as part of a pixel shader effect v2.0 for WPF, so it needs to have a really small number of operations, considering Pixel Shader's limitations. I need to sort 9 values, specifically the current pixel and its neighbors. ...

Array.sort Sorting Stability in Different Browsers

What is the stability of Array.sort in different browsers. I know that the ECMA Script specification does not specify which algorithm to use, nor does it specify whether the sort should be stable. I've found this information for Firefox at https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/sort which s...

How do I sort a concatenated array in JavaScript?

My code: var company=new Array("Kestrel Moon:","BB:"); var basicPri=new Array(1165,1231); for(var i=0;i<15;i++){ var companyTotal=company[i].concat(basicPri[… document.write(""+companyTotal+"") It shows on the screen: Kestrel Moon: 1165 BB: 1231 I want to sort the array so that it goes ascending order of highest value of price so...

Sorting of table column by string length not working as intended when done in IB via cocoa - bindings

Hi all, I made a sample application displaying list of employees with their salaries over NSTableView using NSArrayController. Basic functionality is working as intended. Also sorting is working fine when Selector - compare or caseInsensitiveCompare is assigned in attribute pane for table column- employeeName. Problem occurs when I tr...

Python sorting problem

Possible Duplicate: Python analog of natsort function (sort a list using a natural order algorithm) I'm sure this is simple but I can't figure it out. I have a list of strings like this(after using sorted on it): Season 2, Episode 1: A Flight to Remember Season 2, Episode 20: Anthology of Interest I Season 2, Episode 2: Mars ...

JTable's and DefaultTableModel's row indexes lose their synchronization after I sort JTable

JAVA NETBEANS // resultsTable, myModel JTable resultsTable; DefaultTableModel myModel; //javax.swing.table.DefaultTableModel myModel = (DefaultTableModel) resultsTable.getModel(); // event of clicking on item of table String value = (String) myModel.getValueAt(resultsTable.getSelectedRow(), columnIndex) I use JTable and DefaultTab...

How to sort by hexadecimals in xslt?

Hi, im trying to sort my transformed output by a element which contains a hex value. <xsl:sort select="Generation/Sirio/Code" data-type="number"/> Values are plain old Hex: 00 01 02 ... 0A ... FF but they are getting sorted like that: 0A FF 00 01 02, which indicates that the sorting method fails as soon as there are character involved...

CompareTo may return 0, alternative to TreeSet/TreeMap

I need a sorted set of objects and am currently using the TreeSet. My problem is that the compareTo of the objects will often return 0, meaning the order of those two objects is to be left unchanged. TreeMap (used by TreeSet by default) will then regard them as the same object, which is not true. What alternative to TreeMap can I use? ...

Coldfusion 8: Array of structs to struct of structs

I've got an array items[] Each item in items[] is a struct. item has keys id, date, value (i.e., item.id, item.date, item.value) I want to use StructSort to sort the item collection by a date Is this the best way to do it in ColdFusion 8: <cfset allStructs = StructNew()> <cfloop array = #items# index = "item"> <cfset allStructs[it...

Sorting a 2 dimensional array on multiple columns

I need to sort a 2 dimensional array of doubles on multiple columns using either C or C++. Could someone point me to the algorithm that I should use or an existing library (perhaps boost?) that has this functionality? I have a feeling that writing a recursive function may be the way to go but I am too lazy to write out the algorithm or ...

sorting a gridview alphabetically when columns are codes

hi there i have a gridview populated by a Web Service search function. some of the columns in the grid are templatefields, because the values coming back from the search (in a datatable) are ids - i then use these ids to lookup the values when the rowdatabound event is triggered and populate a label or some such. this means that my sor...

Sort List based on dynamically generated numbers in C++

I have a list of objects ("Move"'s in this case) that I want to sort based on their calculated evaluation. So, I have the List, and a bunch of numbers that are "associated" with an element in the list. I now want to sort the List elements with the first element having the lowest associated number, and the last having the highest. Once th...

How to determine if a List is sorted in Java?

I would like a method that takes a List<T> where T implements Comparable and returns true or false depending on whether the list is sorted or not. What is the best way to implement this in Java? It's obvious that generics and wildcards are meant to be able to handle such things easily, but I'm getting all tangled up. It would also be ...

Sorting Custom Objects with Parameter in .NET?

Let's say I have a custom object of Foo Is there anyway I can sort through a list of these objects, like list<of foo>.sort() and also be able to sort this list with a passable parameter. which will influence the sort? list<of foo>.sort(pValue) I'm guessing I'll need to define two separate sorts, but I am not sure. EDIT: using bu...

ASP.NET ObjectDataSource Sorting Twice

Hello, I'm working with some existing code uses an objectDataSource and that calls a sort method inside a DLL that I don't have access to. I'm trying to add a custom field to sort and I basically want to re-sort after the initial sort. I don't know if this can be done but before the GridView is displayed, I need to intercept the code an...

GridView ObjectDataSource LINQ Paging and Sorting using multiple table query.

I am trying to create a pageing and sorting object data source that before execution returns all results, then sorts on these results before filtering and then using the take and skip methods with the aim of retrieving just a subset of results from the database (saving on database traffic). this is based on the following article: http:/...

how to sort xml data in jQuery

how can i sort all officers based on their ranks jQuery $.get('officers.xml', function(grade){ $(grade).find('officer').each(function(){ var $rank = $(this).attr('rank'); }); }); XML (officer.xml) <grade> <officer rank="2"></student> <officer rank="3"></student> <officer rank="1"></student> </grade> thanks. ...

How do I sort a file that has a very long list of items?

I have a text file that has a very long list of items. So I want to sort them alphabetically but I do not want to load all the file into the memory (RAM). I tried loading all the contents of the file to an array and sort them just like I do normally. But the system complains that there are no much memory!! Thanks, Mohammad ...