Afişează mesaje
|
Pagini: 1 [2] 3 4 ... 57
|
32
|
Comunitate - feedback, proiecte si distractie / Blog / Răspuns: Problem: Resource hog
|
: Ianuarie 25, 2016, 08:30:32
|
Good job Lucian. That's the step I was waiting for!
C++ has
— Built-in Function: int __builtin_clz (unsigned int x) Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined.
as a builtin function. Some processors also have it as a built in function so the algorithm now has O(1) time per query/update.
|
|
|
44
|
Comunitate - feedback, proiecte si distractie / Blog / Răspuns: Probability puzzle: Cars
|
: Noiembrie 14, 2014, 08:14:56
|
Alex, the two problems are equivalent.
If A is the array of numbers in the min = a[ i] problem, then reverse(A) is the set of speeds in the car problem (if cars are going from left to right and A[0] is the last car).
On your example A = N .. 1 - n updates, reverse A = 1 .. N - n clusters
BTW 2 sqrt(n) is the average length of the LONGEST increasing subsequence, while here it's not the longest one.
|
|
|
|