hello.
This is the problem I ran into long time ago.
I thought I may ask your for your ideas.
assume I have very small set of numbers (integers), 4 or 8 elements, that need to be sorted, fast.
what would be the best approach/algorithm?
my approach was to use the max/min functions (10 functions to sort 4 numbers, no branches, iirc).
/...
I want to create a TreeMap in Java with a custom sort order. The sorted keys which are string need to be sorted according to the second character. The values are also string.
Sample map:
Za,FOO
Ab,Bar
...
In .NET the BinarySearch algorithm (in Lists, Arrays, etc.) appears to fail if the items you are trying to search inherit from an IComparable instead of implementing it directly:
List<B> foo = new List<B>(); // B inherits from A, which implements IComparable<A>
foo.Add(new B());
foo.BinarySearch(new B()); // InvalidOperationException,...
I have some data like this :
1, 111, 2, 333, 45, 67, 322, 4445
NSArray *array = [[myData allKeys]sortedArrayUsingSelector: @selector(compare:)];
If I run this code, it sorted like this:
1, 111, 2,322, 333, 4445, 45, 67,
but I actually want this:
1, 2, 45, 67, 111, 322, 333, 4445
How can I implement it? thz u.
...
Hi all
I have a problem with a C application; i have on a .txt file some float numbers and I have to read them and sort in descending way. When i do the fscanf command and then the printf, i get on the screen strange numbers (memory location I suppose). How can i solve the problem?
Thanks in advance
Edited
The application is composed by...
Hello. My task was to create pseudodatabase in c++. There are 3 tables given, that store name(char*), age(int), and sex (bool). Write a program allowing to :
- add new data to the tables
- show all records
- sort tables with criteria :
- name increasing/decreasing
- age increasing/decreasing
- sex
Using function templa...
Two quick questions (I hope...) with the following code. The script below checks if a number is prime, and if not, returns all the factors for that number, otherwise it just returns that the number prime. Pay no attention to the zs. stuff in the script, for that is client specific and has no bearing on script functionality.
The scri...
Hello,
I have been using Report Builder 2.0 for a little time now and I can't seem to get Interactive sorting to work on a matrix header.
Here is a first image of the report design:
ReportDesign
The final report should look something like this: [FinalReport]
The TextBoxProperties window of [Importanta] looks something like this [TextBoxP...
I have this jQuery code:
$(".right_box_holder").sortable({
update : function () {
var order = $('.right_box_holder').sortable('serialize');
$.get("right_menu_functions.php?change_sortorder&"+order);
}
});
and this HTML code:
<div class='right_box_holder'>
<div class='right_box' id='...
Hi !
I'm currently using NSMutableArrays in my developments to store some data taken from an HTTP Servlet.
Everything is fine since now I have to sort what is in my array.
This is what I do :
NSMutableArray *array = [[NSMutableArray arrayWithObjects:nil] retain];
[array addObject:[NSArray arrayWithObjects: "Label 1", 1, nil]];
[array...
I expected the code below to return the objects in imageSet as a sorted array. Instead, there's no difference in the ordering before and after.
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"imageID" ascending:YES];
NSSet *imageSet = collection.images;
for (CBImage *image in imageSet) {
NSLog(@"imageID in Se...
Hi
i've a problem with JSON in python.
in fact if i try to execute this code, python gives me a sorted JSON string!!
values = {'profile' : 'testprofile',
'format': 'RSA_RC4_Sealed',
'enc_key' : base64.b64encode(chiave_da_inviare),
'request' : base64.b64encode(data)
}
values_json = json.dumps(va...
What is the fundamental difference between quicksort and tuned quicksort? What is the improvement given to quicksort? How does Java decide to use this instead of merge sort?
...
I have an array of unique integers (e.g. val[i]), in arbitrary order, and I would like to populate another array (ord[i]) with the the sorted indexes of the integers. In other words, val[ord[i]] is in sorted order for increasing i.
Right now, I just fill in ord with 0, ..., N, then sort it based on the value array, but I am wondering if...
Is there an alphanumeric sort for R?
Say I had a character vector like so:
> seq.names <- c('abc21', 'abc2', 'abc1', 'abc01', 'abc4', 'abc201', '1b', '1a')
I'd like to sort it aphanumerically, so I get back this:
c('1a', '1b', 'abc1', 'abc01', 'abc2', 'abc4', 'abc21', 'abc201')
Does this exist somewhere, or should I start coding? ...
Hey, I need to sort an array list of class house by a float field in a certain range. This is my code for the selection sort:
Basically sortPrice copies the stuff in this list into a new one selecting only the values in that range, then it does a selection sort in that array list. The arraylist (x) in sortPrice is unsorted an needs to be...
I've been pounding my head on the wall trying to figure out how to sort this in JavaScript (I have to work with it in this format unfortunately).
I need to sort it based on Small, Medium, Large, XL, XXL (Small ranking the highest) in each variationValues size field. The problem is that I need to sort the variationCosts and variationInve...
Hi ppl,
I wanted to know the different standards of sorting. To be more specific take the sample set:
(Please note there's capitals, small letters, special characters, null values and numbers here)
A
a
3F
Zx
-
1Ad
NULL
How would the Oracle Database sort this by default?
How would LINQ sort this by default?
How would db2 sort this...
So I have a custom class Foo that has a number of members:
@interface Foo : NSObject {
NSString *title;
BOOL taken;
NSDate *dateCreated;
}
And in another class I have an NSMutableArray containing a list of these objects. I would very much like to sort this array based on the dateCreated property; I understand I could...
Hi,
I have a following XML code:
<Group>
<GElement code="x">
<Group>
<GElement code="x">
<fname>a</fname>
<lname>b</lname>
</GElement>
<GElement code ="f">
<fname>fa</fname>
</GElement>
</Group>
</GElement>
<GElem...