## Is there an O(n) integer sorting algorithm?

The last week I stumbled over this paper where the authors mention on the second page: Note that this yields a linear running time for integer edge weights. The same on the third page: This yields a linear running time for integer edge weights and O(m log n) for comparison-based sorting. And on the 8th … Read more

## Randomize a sequence of div elements with jQuery

I’m trying to do my frist steps with jQuery but I have some trouble to understand how to find a list of child elements from a div parent element. I’m used to work with ActionScript 2 and ActionScript 3 so i could mistake some concept, like what is the better way to randomize a sequence … Read more

## How to specify an Order or Sort using the C# driver for MongoDB?

I’m trying to figure out how to sort a collection of documents server side by telling the C# driver what the sort order is, but it appears not to support that construct yet. Is it possible to do this any other way? Answer You can also do it using the SetSortOrder method on the MongoCursor … Read more

## Why quicksort is more popular than radix-sort?

Why quicksort(or introsort), or any comparison-based sorting algorithm is more common than radix-sort? Especially for sorting numbers. Radix-sort is not comparison based, hence may be faster than O(nlogn). In fact, it is O(kn), where k is the number of bits used to represent each item. And the memory overhead is not critical, since you may … Read more

## what is natural ordering when we talk about sorting?

What is meant by natural ordering . Suppose I have an Employee object with name , age and date of joining , sorting by what is natural ordering ? Answer Natural ordering is a kind of alphanumerical sort which seems natural to humans. In a classical alphanumerical sort we will have something like : 1 … Read more

## python sorting dictionary by length of values

I have found many threads for sorting by values like here but it doesn’t seem to be working for me… I have a dictionary of lists that have tuples. Each list has a different amount of tuples. I want to sort the dictionary by how many tuples each list contain. >>>to_format >>>{“one”:[(1,3),(1,4)],”two”:[(1,2),(1,2),(1,3)],”three”:[(1,1)]} >>>for key in … Read more

## Java List Sorting: Is there a way to keep a list permantly sorted automatically like TreeMap?

In Java you can build up an ArrayList with items and then call: Collections.sort(list, comparator); Is there anyway to pass in the Comparator at the time of list, creation like you can do with TreeMap? The goal is to be able add an element to the list and instead of having it automatically appended to … Read more

## The data source does not support server-side data paging

I have a GridView on my screen and need it to allow paging. Markup: <asp:GridView ID=”GridView1″ runat=”server” AllowPaging=”True” AutoGenerateColumns=”False” DataSourceID=”ObjectDataSource1″> <Columns> <asp:BoundField DataField=”appID” HeaderText=”appID” SortExpression=”appID” /> </Columns> </asp:GridView> <asp:ObjectDataSource ID=”ObjectDataSource1″ runat=”server” SelectMethod=”GetBookingId” TypeName=”AppointmentRepository”> <SelectParameters> <asp:Parameter Name=”maximumRows” Type=”Int32″ /> <asp:Parameter Name=”startRowIndex” Type=”Int32″ /> </SelectParameters> </asp:ObjectDataSource> Code-behind: ObjectDataSource1.SelectParameters[“maximumRows”].DefaultValue = “10”; ObjectDataSource1.SelectParameters[“startRowIndex”].DefaultValue = “0”; LINQ query: public IQueryable<tblAppointment> … Read more

## Sort dataGridView columns in C# ? (Windows Form)

I have a datagridview that i bind from an sql table, in that dv i have those attributes: Id, Name and Price. When i set the SortMode of the Name Columns to Automatic and i click on the header of this column i can sort this dv based on the first letter of the Name, … Read more

## How do I sort a std::vector by the values of a different std::vector?

I have several std::vector, all of the same length. I want to sort one of these vectors, and apply the same transformation to all of the other vectors. Is there a neat way of doing this? (preferably using the STL or Boost)? Some of the vectors hold ints and some of them std::strings. Pseudo code: … Read more