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

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

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