sorting

Heapsort in descending order not working

I have been looking at this for hours and can't figure this out. If the comparisons in the heapify function are changed to greater than, then the output is in increasing order as it should be. I want my list to be sorted in decreasing order though and it's not giving the correct output using the below code: #include <stdlib.h> #include ...

jQuery table sort

what is your best recommendation for table sorting with jQuery i have a very simple, manually updated table, 4 columns Facility Name, Phone #, City, Specialty i want the user to be able to sort by Facility name, and City only. there are so many out there, with so many unnecessary bells and whistles... your thought? ...

Logging And Easily Viewing Large Amounts Of Session Data In Java

I need to set up a logging system for my java web application that not only logs the usual stuff (error message, error level, etc) but can also log additional information as well such as session ID. Sure I suppose I could put the session ID in the error message, but the problem is that I will end up logging lots and lots of data for lots...

Is there a SQL technique for ordering by matching multiple criteria?

I have several tables that get JOINed together to form a table with columns designID garmentID colorID sizeID imageID I have a function that looks like this [variables in square brackets are optional]: getProductImages($designID, [$garmentID], [$colorID], [$sizeID]); I want it to return all imageIDs that match $designID in the foll...

Sort a Custom Class List<>

I would like to sort my list with the date property. This is my custom class: using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Test.Web { public class cTag { public int id { get; set; } public int regnumber { get; set; } public string date { get; set; } ...

Sort, pack and remap array of indexed values to minimize overlapping.

Sitation: overview: I have something like this: std::vector<SomeType> values; std::vector<int> indexes; struct Range{ int firstElement;//first element to be used in indexes array int numElements;//number of element to be used from indexed array int minIndex;/*minimum index encountered between firstElement and fir...

Order an array using another array as indexes C#

Hi, so if I have an array of characters char[] chars = new char[]{'f','a','d','e','c','b'}; and another array of integers that say what the sort order is: int[] sortOrder = new int[]{5,1,4,5,3,2}; how could I sort the data in the chars array, using the values in the sortOrder array to determine the order? In the above example, the...

Java: Sorting multiple ArrayLists synchronously or a single mapped ArrayList

I've only started learning Java about 3 months ago and this is my first post here, so please bear with me. I have multiple ArrayLists built from parsed XML that are directly related to each other in order. The arrays are later put into a single mapped ArrayList (groupData) to be read with a SimpleAdapter which creates the list in the An...

Python dictionaries: changing the order of nesting

I have a dictionary, with 300 key value pairs, where each of the keys are integers and the values are dictionaries with three key value pairs. The inner dictionaries all have the same keys, but different values. The whole thing looks pretty much like this: nested_dicts = {1: {'name1':88.4, 'name2':22.1, 'name3':115.7}, 2: {'...

Oracle 10g-Express Query

I want to perform a special query on a table in my oracle database. I want the result to be sorted according to an enum that I have. the enum goes as follows: private enum days { Saturday = 1, Sunday, Monday, Tuesday, Wednesday, Thursday, } I want the result to be sorted according to this enum. ...

Sorting an NSArray by a key-value relationship that is 2 levels deep

I have an NSArray of UILocalNotification objects that I need to sort according to a key within the UILocalNotification's userInfo property, which is an NSDictionary. I know how to sort NSArrays by a value that is one level deep, e.g., a key within an array of NSDictionaries, but two levels deep I'm lost. I want to do something like this ...

how to sort a ruby array of strings by length

How do I sort this: arr = ["aaa","aa","aaaa","a","aaaaa"]; into this arr = ["a","aa","aaa","aaaa","aaaaa"]; ...

incorrect use of ruby's sort_by function

My sort function is clearly not working, I am trying to sort ALL_VIEWS by @permalink.length: ALL_VIEWS.sort_by {|view| view.permalink.length} ALL_VIEWS[0..4].each do |view| puts view.inspect puts view.permalink.length end this produces: #<View:0x1014da7b8 @permalink="xxxx"> 4 #<View:0x1014da790 @permalink="yyyyy"> 5 #<View:0...

What kind of sorting algorithm is this?

int aux; for(int i=0;i<array.Count()-1;i++) { for(int j=i+1;j<array.Count();j++) { if(array[i] > array[j]) { aux = array[j]; array[j] = array[i]; array[i] = aux; } } } ...

Sort list in a list of lists F#

Hello guys, I'm trying to sort each Position (which is a list) in a Position list. Currently I'm doint like this: type Position = Position of list<int * Piece> and my function: let SortPositionList positionList : Position list = let rec loop list = match (list: Position list) with | [] -> [] | hd::tl -> [List.sortBy(f...

Sorting ArrayList of String[]

I have an arraylist of String[]: ArrayList< String [] > mystuff = new ArrayList < String [] > (); I want to sort them in largest-array-size ascending order. Example: mystuff = {["this", "is", "item", "one"], ["this", "is", "item", "two"], ["item"], ["item", "three"]} Should become: mystuff = {["item"], ["item", "thr...

How do I sort this JSON object by the languages on the right of each entry?

I am creating an Android app using PhoneGap and jqTouch, and I have a JSON object containing a word along with a language which that word is in. How can I sort this alphabetically, by the column on the right (the language), using Javascript? The end result should be Afrikaans as the first entry and Zulu as the last. var languages = { ...

Haskell sorting of an unorderable list using a proxy order

Suppose I have x :: [(n, a)] where n is a number and a is an unorderable item (is not of class Ord). I want to sort this list by n. I cannot do sort x because a is not orderable. I can replace a by indices and then assemble the new list using !! but this seems like a poor solution. Alternatives? ...

Custom query in drupal views - now can't sort.

The view with the custom query is being displayed in the right sidebar titled "Most Downloaded" here: http://tf2huds.com. The view with the query generated by views is right below it. To put in the custom query I'm using this code in the views.module file: <?php function views_views_pre_execute(&$view) { if($view->name=="hud_downloa...

Avoid requerying mysql db from Access when sorting

Hi there I have an MS Access frontend and MySQL backend. Everthing runs well however I am trying to avoid the following. On an Access form, I use it to do read queries. Once the results are shown on the Access form (excel like format), I can sort A-Z, Z-A etc The thing is that everytime I do any sorting, I can see on MySQL Administrator...