sorting

Extract keywords from text in .NET

I need to calculate how many times each keyword is reoccurring in a string, with sorting by highest number. What's the fastest algorithm available in .NET code for this purpose? ...

Sorting by selectbox in XSLT

I have this selectbox on a site Im currently building and what I want to do, is sort a list of items displayed on the page by the value that's being selected. The problem is that I got different kinds of data types, e.g. location and price. If I want to sort on location, no problem it sorts perfectly on alphabetic order of the location...

Pseudocode/Java Mystery Algorithm

I have an algorithm, and I want to figure it what it does. I'm sure some of you can just look at this and tell me what it does, but I've been looking at it for half an hour and I'm still not sure. It just gets messy when I try to play with it. What are your techniques for breaking down an algoritm like this? How do I analyze stuff like t...

sortting multi-dimensional arrays

I would like to be able to sort this array by the element array's size; array( [0] => array( [0] => 'B', [1] => 'C'); [1] => array( [0] => 'B'); [2] => array( [0] => 'A', [1] => 'C'); [3] => array( [0] => 'A', [1] => 'B', [2] => 'C'); [4] => array( [0] => 'C'); [5] => array( [0] => 'A'); [6]...

bash version-sorting question

In the directory "data" are these files: command-1.9a-setup command-2.0a-setup command-2.0c-setup command-2.0-setup I would like to sort the files to get this result: command-1.9a-setup command-2.0-setup command-2.0a-setup command-2.0c-setup I tried this find /data/ -name 'command-*-setup' | sort --version-sort...

Iterating over a JavaScript object in sort order based on particular key value of a child object

Hello all Short version: I'm looking for the JavaScript equivalent of Perl's for my $key ( sort { $hash{$a}{foo} cmp $hash{$b}{foo} } keys %hash ) { # do something with $key } More detail: I have a JSON object which consists of a bunch of other JSON objects which have identical properties to each other, like a hash of hashes in ...

Straight selection sort vs. exchange selection sort

What is the difference between straight selection sort vs. exchange selection sort? I got into a little debate today - my professor uses these two terminologies in his lecture notes. The selection sort that Wikipedia and any textbook or website will give you is what he is calling "exchange selection sort". I've never heard the term "exc...

How to sort an array of M numbers using N threads in java?

I have to use N(i=1..N) threads to sort an array of M numbers,each thread start to sort the array from position (N*i)%m. Could anyone help me? ...

JavaScript - Sort an array based on another array of integers

Say I have an array: [0,3,4,2,5,1] What i want to do is sort an array such as: ["one", "two", "three", "four", "five", "six"] so that the order corresponds to the first array. This would be the output: ["one", "four", "five", "three", "six", "two"] Is there an easy way to accomplish this? ...

Sort generic list based upon a different list.

What would be the fastest way to sort a list that contains a list of objects, based upon another list? An example follows: Say I have multiple lists of employees. Each individual list has a common property value, say "Department". So I have a list of employees, in one list they all have the department string value of "Sales". In ano...

Insertion sort debug help

The following C code doesn't work (it just clears the list): /* Takes linkedlist of strings */ static int insertSort (linkedlist *list) { linkedlist sorted; void *data; node *one, *two, *newnode; unsigned int comp, x; removeHeadLL (list, &data); initLL (&sorted); addHeadLL (&sorted, data); while (list->count) { rem...

Scheme - Problems with Sorting

So I'm learning Scheme in a class and my professor doesn't answer questions after 8:00, so I'm hoping you all can help me out. Basically I have a family tree type thing and I'm trying to get all the ancestors of one person, and display them as one string, sorted alphabetically. The problem is, because of the recursion, each generatio...

I need help creating a function that sorts names in a phonebook application alphabetically in C.

We are suppose to create a phonebook application that has about eight options. Add a user, display a user, sort the users, display users randomly, find users randomly, delete users. This is what I have so far. include include include //Functions void addUser(); void displayUser(); void sortUser(); ... //*****Data Structure*****...

uniq : only when different by more than 1 character OR case

Hi all :) I got a text file with LOTS of names. I want a list of all the strings(lines) that is either 1) Different in CASE (i.e audi vs AuDI) 2) Different by more than 1 character ie (mygoo VS my-goo) Any ideas ?? ...

What is a good sorting algorithm that obeys conditions?

My goal is to sort a designer.cs' InitializeComponent()'s statements for merging. I used coco-r to set up a dependency graph. This gives me certain conditions that need to be true.(If calling a method on an object make sure that the order of the methods if the same before and after the sort.) I was curious if there are any sorting alg...

Sort list of names in Python, ignoring numbers?

['7', 'Google', '100T', 'Chrome', '10', 'Python'] I'd like the result to be all numbers at the end and the rest sorted. The numbers need not be sorted. Chrome Google Python 100T 7 10 It's slightly more complicated though, because I sort a dictionary by value. def sortname(k): return get[k]['NAME'] sortedbyname = sorted(get,key=sort...

c qsort seems to remove last value in array

I am using the built in qsort to sort an array of structs. But after the call to qsort the last element in the array seems to have had its value that I am sorting by set to empty. Here is my code... int numEntries = 5; TvEntry* entries[numEntries]; //create array //Entries get added to the array here... qsort( *entries, numEntries, s...