sorting

Can Excel sort on correspondence to another column?

What I have: two columns of text data, that are given to contain only distinct (no duplicate) items. What I want: The second column sorted such that corresponding items are aligned in the same rows. If the first column contains an item with no match in the second columns, that row is left blank in the second column. If the second colu...

Trying to come up with an algorithm to sort to Spanish words.

Hello, I am writing a program to sort Spanish words.The letters are almost the same as the English alphabet, only with a few exceptions. a,b,c,ch,d,e,f,g,h,i,j,k,l,ll,m,n,ñ,o,p,q,r,rr,s,t,u,v,w,x,y,z Further, for this problem, assume that any pair of characters which can represent a letter does; for example, the combination ch would a...

Count the number of operations for a sorting algorithm

This is my assignment question: Explain with an example quick sort , merge sort and heap sort . further count the number of operations, by each of these sorting methods. I don't understand what exactly i have to answer in the context of " count the number of operations " ? I found something in coremen book in chapter 2, they have expla...

Best way to sort an array with the longest strings in the middle and the shortest at the beginning and end

Just for fun really. I was curious of the best way to do this. ...

How do I convert a set of String Hashes into a number evenly distributed from 1 to 5?

I have a set of strings that need to be load-balanced into 1 of 5 positions of a collection containing List<string>. How can I take the string.Hash() and convert that into an Int that is somewhat evenly distributed? I'm asking so I can figure out a solution for this ASP.NET issue. ...

Space complexity question

Possible Duplicate: Regarding in-place merge in an array I have an array, where the first and second half of the array is sorted, e.g. A[] = "2 4 7 1 5 20" No how do I sort the whole array in O(1) space complexity? Regards, Mithun ...

Is there a name for this sort?

What is the name for the sort used in this answer? I Googled for "perfect insertion sort" but didn't find anything. Here is the code from that answer: #this is O(n) instead of O(n log n) or worse sub perfect_insert_sort { my $h = shift; my @k; for my $k (keys %$h) { $k[$h->{$k}{order}] = $k; } return @k; } ...

Interruptible in-place sorting algorithm

I need to write a sorting program in C and it would be nice if the file could be sorted in place to save disk space. The data is valuable, so I need to ensure that if the process is interrupted (ctrl-c) the file is not corrupted. I can guarantee the power cord on the machine will not be yanked. Extra details: file is ~40GB, records are...

sorting javascript gets hang

Hi , I am rendering around 3000 records, i am using this sorting open source script , When i click the column, my browser getting hang very shortly , i cant able to continue, Is there any solution for this prob. link text ...

Lucene.Net Search by Order?

I have a bunch of docs with tags. Right now i sort based on score. However i would like to pull up X many documents and sort them by id newest first. How do i search that way and how do i limit the search to return X many docs? using lucene.net 2.9 -edit- The master data is in mysql. Maybe i should do a query there instead? find all doc...

Plone: How to sort the navtree portlet using another list as base order?

I have a navtree on a plone site, already using this configuration: navigation = mapping['navigation'] navigation.includeTop = True navigation.currentFolderOnly = False navigation.topLevel = 0 navigation.setProperty('metaTypesNotToList', ['ATBooleanCriterion', ...(another types go here) ..., MemberDataContainer']) navigation.setProperty...

Array sorting/searching technique in PHP

Hi, In PHP I have an array let say $array = array(2, 1, 8, 3, 6, 0, 10, 10)and I want to get second largest value of that array. Which sorting/searching technique will be best & how could I use it? ...

How can I remove duplicates and sorting at the same time in Perl?

Hi Everyone, I have an array of this kind @uniqarr = qw(error 0 goodrecordno:6123, error 0 goodrecordno:6143, error 1 goodrecordno:10245, error 1 goodrecordno:10678, error 1 goodrecordno:10698, error 2 goodrecordno:16245, error 2 goodrecordno:16123); I want the o/p as error 0 goodrecordno:6123 error 1 goodrecordno:10245 error 2 go...

How to handle nulls when using Java collection sort

Hi, When using Collection.sort in Java what should I return when one of the inner objects is null Example: Collections.sort(list, new Comparator<MyBean>() { public int compare(MyBean o1, MyBean o2) { return o2.getDate().compareTo(o1.getDate()); } }); Lets say o2 is not null but o2.getDate() it is, so should I return...

Trouble sorting JSON object

I have a JSON object collection: var Gallery = [ { "Order": 1, "Page": 1, "LargeImage": "large.jpg", "ThumbImage": "thumb.jpg" }, { "Order": 2, "Page": 1, "LargeImage": "large2.jpg", "ThumbImage": "thumb2.jpg" }]; I want to each over this object but after the collection is sorted on "Order". What is the best way to do this? ...

select equal sized number groups from a sequence of random numbers

say i have a list of 100 numbers, i want to split them into 5 groups which have the sum within each group closest to the mean of the numbers. the simplest solution is to sort the hundred numbers and take the max number and keep adding the smallest numbers until the sum goes beyond the avg. obviously that is not going to bring the best...

RadGrid Per Page Sorting

I'm tying to make a radgrid that sorts items like a bank statement. By this I mean it has to follow a specific pattern. All the data is pulled in one linq statement and put into what is essentially a list. Each page must have an ascending sort (by date dd-mm-yy) from top to bottom. This means we should see : 26/09/10 | item 1 | €9...

Using rich:dataTable how do i store current sorting and current page in a managed bean variable

Using richfaces 3.3.0 we have a rich:dataTable with sortyBy's in the rich:column components and with a rich:dataScrolling component. These allow the user to sort the table in any way they want and go through the pages, all in client memory. Usually our users spend a long time looking for a certain row by sorting and browsing the pages,...

Sorting Lists with sub items in C#

I'm trying to sort a list of orders and items based on a the earliest (lowest) creation date of one of the items in the list. So I have: public MyOrder { orderid int; IList<MyItems> orderitems; } public MyItems { DateTime itemcreatedate; } Say Order1 has two items in it with itemcreatedate 6/1/2010 and 6/15/2010 Order2 has two item...

Linq join on parameterized distinct key

I'm trying to LINQ two tables based on a dynamic key. User can change key via a combo box. Key may be money, string, double, int, etc. Currently I'm getting the data just fine, but without filtering out the doubles. I can filter the double in VB, but it's slooooow. I'd like to do it in the LINQ query right out of the gate. Here's the da...