sorting

Is there a SortedList<T> class in .net ? (not SortedList<Key,Value> which is actually a kind of SortedDictionnary)

I need to sort some objects according to their contents (in fact according to one of their properties, which is NOT the key and may be duplicated between different objects) .net provides two classes (SortedDictionnary and SortedList), and both are some kind of Dictionaries. The only difference (AFAIK) is that SortedDictionnary uses a bi...

Sort TreeView Automatically Upon Adding Nodes

Is there an easy way to add nodes to a WinForms .NET TreeView control where the new nodes being added are inserted at the correct index so the entire list of nodes is sorted alphabetically? Pretty much having the same result as TreeView.Sort(). I have a TreeView that continually grows to a couple hundred nodes. The user can view this Tr...

How to sort a list of objects in Python, based on an attribute of the objects?

I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves. The list looks like: >>> ut [<Tag: 128>, <Tag: 2008>, <Tag: <>, <Tag: actionscript>, <Tag: addresses>, <Tag: aes>, <Tag: ajax> ...] Each object has a count: >>> ut[1].count 1L I need to sort the list by number of counts descending. ...

How to sort a string of characters in objective-C?

I'm looking for an Objective-C way of sorting characters in a string, as per the answer to this question. Ideally a function that takes an NSString and returns the sorted equivalent. Additionally I'd like to run length encode sequences of 3 or more repeats. So, for example "mississippi" first becomes "iiiimppssss", and then could be s...

Sorting an array of an array of objects in PHP by key value

Basically I have a setup like the following: Array ( [0] => Array ( [0] => stdClass Object ( [nid] => 1 [title] => title1 [uid] => 1 [parent] => 0 [weight] => -15 [name] => name1 [value] => 0 ) [1] => stdClass Object ( [nid] => 2 [title] => title2 [uid] => 1 [parent] => 0 [weight] => -7 [name] => name2 [value] => 100 ) ...

C# Data structure Algorithm

Hi Techies, I recently gave a interview to one of the TOP software company. I was completely stuck with only one question asked by interviewer to me, which was Q. I have a machine with 512 mb / 1 GB RAM and I have to sort a file (XML, or any) of 4 GB size. How will I proceed? What will be the data structure, and which sorting algorith...

Implementing sort/page feature when using POCOs with ASP.net Data Controls

I am not a big fan of datasets so I use POCO to return data. I have achieved paging and sorting using custom methods that I create for a POCO type that work on page size and give me a set of the complete POCO collection at a time, I use methods that check for name of the DataItem clicked and sort order to do that sort. Creating such meth...

IComparer problem + How do I sort an array of strings naturally (FILE_10 > FILE_2) in .NET?

SOLVED at the bottom of my post. Or more specifically: I have a bunch of FileInfo objects (I need the FileInfo objects to exclude hidden, system and reparse point files). I need to sort FileInfo[] naturally based on their FileInfo.FullName. So FILE_10.ext should come after FILE_2.ext. Luckily the FileInfo[] contains files of only one ...

How do I sort a tab seperated file on the nth column using cygwin sort?

I have a huge tab separated file which I want to sort on its 2nd column. I need to use the tab character as the field delimiter in cygwin sort. So I need something like this: sort -t \t -k 2,2 in.txt > out.txt But the command prompt evaluates '\t' literally and not as the tab character. Note that I need to do this on a Windows machine...

C#: Custom sort of DataGridView

I need to sort a DataGridView with Natural Sorting (Like in Explorer) so that numbers and text (in the same column) are sorted naturally, and not alphabetically (so that "place 3" comes before "place 20", etc.). I have a DataGridView, where I have set a DataView as DataSource. The DataView contains a DataTable which is created with some ...

STL __merge_without_buffer algorithm?

Where can I get a decent high-level description of the algorithm used in __merge_without_buffer() in the C++ STL? I'm trying to reimplement this code in the D programming language, with some enhancements. I can't seem to grok what it's doing at the algorithmic level from just reading the STL source code because there are too many low-l...

How sort a System.Collections.Generic.List in VB.Net ?

I using a genric list(m_equipmentList ) which is collection of objects (Schedule_Payitem). How can sort list according to a proerty of child object ? Dim m_equipmentList As New List(Of Schedule_Payitem) Need to sort m_equipmentList on basis of resourceid property of Schedule_Payitem. ...

Java sort String array of file names by their extension

I have an array of filenames and need to sort that array by the extensions of the filename. Is there an easy way to do this? ...

python, sorting a list by a key that's a substring of each element

Part of a programme builds this list, [u'1 x Affinity for war', u'1 x Intellect', u'2 x Charisma', u'2 x Perception', u'3 x Population growth', u'4 x Affinity for the land', u'5 x Morale'] I'm currently trying to sort it alphabetically by the name of the evolution rather than by the number. Is there any way I can do this without just ...

Windows Explorer sort method

Hi all, I'm looking for an algorithm that sorts strings similar to the way files (and folders) are sorted in Windows Explorer. It seems that numeric values in strings are taken into account when sorted which results in something like name 1, name 2, name 10 instead of name 1, name 10, name 2 which you get with a regular string com...

Flex - ActionScript: how do I use SortField to sort my data numericly

From the documentation: SortField () constructor public function SortField(name:String = null, caseInsensitive:Boolean = false, descending:Boolean = false, numeric:Object = null) I'm confused on the last part - numeric:Object = null Here is my function: private function createXMLDataProvider():XMLListCollection{ var sort...

CMS that organizes and sort nicely

Witch CMS(+plugin/module) have the best way to organize content and multiple sorting options for lists? ...

C#: Generic sorted container that can return the sorted position of a newly added object?

I need a generic container that keeps its elements sorted and can be asked where (at which position) it would insert a new element, without actually inserting it. Does such a container exist in the .NET libraries? The best illustration is an example (container sorts characters by ASCII value, let's assume unicode does not exist): sorte...

I need a problem for my algorithm. I need like search engine input data

Hello! Imagine you have some products, or items, or just anything that you want to see in some order of importance. Like you want in a search engine. Like websites. And you don't know how to sort them. But you have some criteria that give you a clue. You have a bag of criteria, and according to each, you can find a sorting, but you cann...

Most efficient way to sort parallel arrays in a restricted-feature language

The environment: I am working in a proprietary scripting language where there is no such thing as a user-defined function. I have various loops and local variables of primitive types that I can create and use. I have two related arrays, "times" and "values". They both contain floating point values. I want to numerically sort the "ti...