• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

FFS Microsoft

QuickSort is not always the most efficient - it depends on distribution of data and its possible to find cases that increases its runtime badly.
 
Just look how they swap values in their sort:

byte item = items;
items = items[j];
items[j] = item;

They use temporary variable to do that, no doubt this requires little thinking :rollin:
 
"know better, but I am not the best programmer out there" - come come atw, we know you know that's not the case!


"They use temporary variable to do that" - ok, i'll bite, show me the atw way without a temp var...
 
AtW said:
Just look how they swap values in their sort:

byte item = items;
items = items[j];
items[j] = item;

They use temporary variable to do that, no doubt this requires little thinking :rollin:


Just out of interest - how did you do it ?
 
AtW said:
QuickSort is not always the most efficient - it depends on distribution of data and its possible to find cases that increases its runtime badly.

what do you know that isn't basic Knuth my little russian puppy.
 
scotspine said:
"They use temporary variable to do that" - ok, i'll bite, show me the atw way without a temp var...

Check out #1 result in SKA
smile.gif
 
AtW said:
Check out #1 result in SKA
smile.gif

So, which method did you use, and why are you sure it's faster than using an intermediate variable (when the compiler does a lot of optimising).

Using the intermediate var is obvious and makes for easy-to-understand, maintainable code. Do you like to obfuscate your code to show how clever you are?
 

Advertisers

Back
Top