sorting

Sorting the values before they are send to the reducer.

I'm thinking about building a small testing application in hadoop to get the hang of the system. The application I have in mind will be in the realm of doing statistics. I want to have "The 10 worst values for each key" from my reducer function (where I must assume the possibility a huge number of values for some keys). What I have pla...

javascript array sorting

barValues is an array I'm passing to a function. Within the function I have this: alert(barValues); var sortedBarValues = barValues; sortedBarValues.sort(function(a,b){return b - a}); alert(barValues); I'm trying to end up with two arrays. barValues being the original array and sortedBarValues being a copy of that array, now sorted....

Sorting a GridView based on weights in another database table...

I have a GridView being populated from a non-SQL database that we use internally. One of those fields is a stockroom location. (Example: AAA, AAB, AAC, etc.) In another database (SQL) I keep a list of all stockrooms and give them a weight. The weight is just an integer; the higher the integer, the further away the stockroom is. I need ...

ms Access form subform sort

I have a form where I specify information that is used by a subform in tabular view. The subform then displays entries for the item specified in the main form. Each entry has a date associated with it. I would like the entries to show up sorted by date such that the latest dates are at the bottom, and when you add an entry in the subf...

asp.net vb.net gridview - can't sort!

I try to make this gridview sortable, but it simply doesn't work, anyone know why? Dim sql As String = "SELECT Product_ID, Code, Trade_Name " sql = sql & "FROM Product " sql = sql & "WHERE Category = ? " Dim conn As String = WebConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim dad As New OleDbDataAdapt...

How to quickly resort a list with only one changed value?

Let's say I have a list of objects that are sorted by a specific field on that object. If one of the objects changes that property, its position in the sorted list would need to be updated. What sorting algorithm or "tricks" could I use to very quickly sort this list, given that it falls out of sort only one item at a time? The data st...

.Net ComboBox Binding Issue

I have 2 comboboxes, each are bound to the the same DataTable like so: channelTypeCB.DataSource = SynergyData.ds.Tables["ChannelTypes"]; channelTypeCB.DisplayMember = "channelType"; channelTypeCB.ValueMember = "channelTypeID"; channelTypeCB.BindingContext = new BindingContext(); newSKChanTypeCB.DataSource = SynergyD...

MPI array syncronization

Hello, I am learning MPI, so i though i could write simple odd even sort for 2 processors. First processor sorts even array elements and second odd array elements. I'm using global array for 2 processors, so i need synchronization(something like semaphore or lock variable) because i get bad results. How this problem is solved in MPI ? M...

Why is my TStringList not sorted?

I have a custom sorted TStringList... Items.CustomSort(@CompareWords); ... with this comparison function: function CompareWords(List: TStringList; Index1, Index2: Integer): Integer; begin Result := StrIComp(PWideChar(List[Index1]), PWideChar(List[Index2])); end; But after noticing some problems with my code, which expects the lis...

Which sorting algorithm is best suited to re-sort an almost fully sorted list?

I have list which is sorted using a specific string comparison function. Now I have to re-sort this list using a different string comparison function. This new comparsion is slightly different when comparing certain special characters, like Umlauts for example. In most cases the element has to be moved just one or two slots to get to ...

Python .sort() not working as expected

Tackling a few puzzle problems on a quiet Saturday night (wooohoo... not) and am struggling with sort(). The results aren't quite what I expect. The program iterates through every combination from 100 - 999 and checks if the product is a palindome. If it is, append to the list. I need the list sorted :D Here's my program: list = [] #lis...

Python: List Sorting with Multiple Attributes and Mixed Order

Hi! I have to sort a python list, with multiple attributes. I can do that in ascending order for ALL attributes easily with L.sort(key=operator.attrgetter(attribute)).... but the problem is, that I have use mixed configurations for ascending/descending... I have to "imitate" a bit the SQL Order By where you can do something like "nam...

About python's built in sort() method

Hi! What algorithm is the built in sort() method in python using? Is it possible to have a look at the code for that method? Thanks =) ...

Sorting on Last Name ...

I am reading data from three files and then i want to sort the records on some criteria Each file has records in the following format First Name Last Name Gender Color Date This is the code which i have ... i can sort only on the first name using collections.sort ... how do i sort on other columns ... any help would be appreciated ...

Stability in sorting algorithms.

I m very curious, why stability is or is not important in sorting algorithms? Any ideas? ...

How to sort a ComboBox.Items collection of KeyValuePair<string,string> by Value?

I'm getting a KeyValuePair from a service and some of the values are not sorted, as reproduced below. How can I resort the KeyValuePair by value so that they display in alphabetical order in the ComboBox: public NationalityComboBox() { InitializeComponent(); Items.Add(new KeyValuePair<string, string>(null, "Please choose..."))...

JavaScript: sorting collection, which is not an array

I have a collection of objects in JavaScript like this: Object collection = new Object(); collection[123] = new Item(); //another object collection[425] = new Item(); collection[2134] = new Item(); //etc. etc. //TODO: sort items I would like to sort this collection according to the properties of the Item objects in collection. Ther...

What's the fastest algorithm for sorting a linked list?

I'm curious if n log n is the best a linked list can do. Thanks ...

Sort string collection in Python using various locale settings

I want to sort list of strings with respect to user language preference. I have a multilanguage Python webapp and what is the correct way to sort strings such way? I know I can set up locale, like this: import locale locale.setlocale(locale.LC_ALL, '') But this should be done on application start (and doc says it is not thread-safe!...

LINQ sorting special characters first?

It looks like special characters are not being regarded when sorting with LINQ and I didn't expect it to. Anyway, I need to sort special characters so they appear first in a list. Any ideas? I know I can do something like: http://stackoverflow.com/questions/921107/use-linq-for-arbitrary-sorting, but how do I allow the sort to extend pass...