sorting

fast sorting using .net 3.5 framework

Hello everybody In a scientific application I'm writing (vb.net) I use a huge collection of object stored in a tree structure. Every object exposes a LastAccessed property (datetime) that stores the last time the node was accessed by the algorithm. I need to find a fast way to find the N least accessed objects in the structure. I'm us...

Sort list box options using mootools1.2

Hi all Below is my HTML <select name="name" id="id"> <option value="1">ZZZ</option> <option value="1">PPP</option> <option value="1">SSS</option> <option value="1">AAA</option> </select> I want that this select box will be sorted according to below. <select name="name" id="id"> <option value="1">AAA</option> ...

how to get alphabetically next and prev records wiht minimal fetched records??

I have a page that is displaying a company name and its details from a table A. Now say i have a company displayed,and its name is 'Company_one' now i want to have alphabetically sorted next company and previous company and their details etc. The data in my table is not sorted.Its stored as it gets the data. So now what kind of query...

Gridview paging and sorting do not work after changing datasource in codebehind??

I am having a gridview with an object datasource binded in the markup(aspx page). When page loads it directly works fine with all sorting and paging properties. However, i need to filter display on gridview so i have to change the datasource of the gridview on the code behind. It works fine.. i mean the filtering and displaying is good...

Sorting a tree structure by folders first in Ruby

I have an array of paths, array = [ 'a.txt', 'b/a.txt', 'a/a.txt', 'a/z/a.txt' ] I need to create a tree structure (for the jTree plugin), but it has to be sorted by folders first (alphabetically) and then leafs (alphabetically too). A sorted tree structure with the above example would look like this: a z a.txt a.txt b a.txt...

Best way to sort an NSArray of NSDictionary's?

Hi, I'm struggling with trying to sort an array of dictionarys. My dictionaries have a couple of values of interest, price, popularity etc. Any suggestions? ...

In Haskell, how can you sort a list of infinite lists of strings?

So basically, if I have a (finite or infinite) list of (finite or infinite) lists of strings, is it possible to sort the list by length first and then by lexicographic order, excluding duplicates? A sample input/output would be: Input: [["a", "b",...], ["a", "aa", "aaa"], ["b", "bb", "bbb",...], ...] Output: ["a", "b", "aa", "bb", "a...

jquery datatables question...

EDIT Nevermind... I really was missing the obvious... duh. I have a five-column table and am using jquery.datatables.js (http://www.datatables.net/). I'm trying to figure out how to remove sorting for the first and fifth columns so that it's not an option at all... I've tried the function below, but it's still adding a sort to the c...

Sorting NSTableColumn contents

Hey, I have a problem with sorting NSTableColumn contents. In my NSTableView there are three columns: File, Size, Path. The contents are stored in NSMutableArray. Each object in this array is a NSDictionary containing three keys: file, size and path - value for each is a NSString. In Interface Builder, in each Table Column's attribute...

Is it possible to use array_shift() in PHP and get the key?

I have a list of files in an array where the filename is the key and the value is the last modified date in seconds. They are sorted from oldest to newest. The files are glob()'d in, and then sorted this way using asort($fileNameToLastModified, SORT_NUMERIC); I use array_shift() to get the oldest file. Unfortunately, it seems to be ...

How to sort a list so that managers are always ahead of their subordinates (How do I do a topological sort in Groovy, or an FP language)

I am working on a project using Groovy, and I would like to take an array of employees, so that no manager follows their subordinates in the array. The reason being that I need to add people to a database and I would prefer not to do it in two passes. So, I basically have: <employees> <employee> <employeeid>12</employeeid> ...

Sorting Arrays by More the One Value, and Prioritizing the Sort based on Column data.

I'm looking for a way to sort an array, based on the information in each row, based on the information in certain cells, that I'll call columns. Each row has columns that must be sorted based on the priority of: timetime, lapcount & timestamp. Each column cotains this information: split1, split2, split3, laptime, lapcount, timestamp. ...

How can I sort just part of a huge list using .NET?

In .NET, the Generics Lists have a sort function that accepts IComparer or Comparison. I'd like to sort just part of a list. Hopefully I can specify the start index, count of elements to sort, and a lambda function. It looks like you can only use lambda functions to do this if you're sorting the entire list. Is that right or did I mi...

The intersection of two sorted arrays.

Given two sorted arrays: A and B. The size of array A is La and the size of array B is Lb. How to find the intersection of A and B? If La is much bigger than Lb, then will there be any difference for the intersection finding algorithm? ...

Sort Outlook Inbox "Arrange By" | Switch between FROM and Conversation View

Using VBA and a toolbar button, I'd like to be able to Switch between FROM and Conversation View, but I just can't work how to or find the code to do this. I tried the Sort Methods but, they only work in memory and don't re-sort the actual inbox. I use Conversation View for GMail style functionality with my Sent items BCC'd to myself, ...

Sort multiple columns while using a bindingsource or bindinglist

Hi everyone. I have a problem I am trying to fix and it's sorting a DataGridView on multiple columns. I have read that this option is not a feature built-in the DataGridView and I have to implement it. I have found multiple solutions, but none quite got to do the work. I'm also quite a newbie in C# and I don't know much of the .Net lib...

To have an Integer pointing to 3 ordered lists in Java

Which datastructure would you use in the place of X to have efficient merges, sorts and additions as described below? #1 Possible solution: one HashMap to X -datastructure Having a HashMap pointing from fileID to some datastructure linking word, wordCount and wordID may be a good solution. However, I have not found a way to implement i...

Stable/repeatable random sort (MySQL, Rails)

I'd like to paginate through a randomly sorted list of ActiveRecord models (rows from MySQL database). However, this randomization needs to persist on a per-session basis, so that other people that visit the website also receive a random, paginate-able list of records. Let's say there are enough entities (tens of thousands) that storin...

Sort Hash Tables Glib - qsort

I'm trying to sort a GLib hash table by id that looks something like: key - id { "Red", 2, "BLue", 4, "Yellow", 5, "Orange", 8 } I'm just not sure how to approach this because GLib does not have a sort method. I was thinking to use qsort or GCompareFunc Any ideas will be appreciate it! ...

Why doesn't Perl's "sort" put these hash keys in numeric order?

#!/usr/bin/perl use strict; use warnings; my %hash; foreach ( 1 .. 10 ) { $hash{$_} = $_; } foreach ( sort(keys %hash) ) { print $_ . ": " . "$hash{$_}" . "\n" ; } When I execute the above code, the result is as below: 1: 1 10: 10 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 I expect "10: 10" to be the last one that...