Results 1 to 25 of 102
Thread: array
Hybrid View
-
14th May 2008 22:40 #1We are drowning in information, but starving for knowledge and time!
-
14th May 2008 23:43 #2
( 1) :
- 0 , -
- 1 , -
b[i] = a[i] - i ( ):
a[1,2,4,5,6,7,8] -> b[0,0,1,1,1,1,1]
, b[i] 0 1. O(log n) .
O(log n) " ".Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
14th May 2008 23:52 #3
icaci, . . (n), a . , .
We are drowning in information, but starving for knowledge and time!
-
14th May 2008 23:56 #4
-
15th May 2008 00:02 #5
-
15th May 2008 00:55 #6
@aphex, b . , Pesho(R), . C , 0:
Code:int missing(int a[], int n) { int low = 0, high = n-1; do { int mid = (low+high) / 2; if (a[mid] > mid+1) high = mid; else low = mid; } while (high-low > 1); return(high+1); }Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
15th May 2008 01:38 #7
, . ..
.. 1 n . .
, , . , .Last edited by aphex; 15th May 2008 at 01:46.
We are drowning in information, but starving for knowledge and time!
-
15th May 2008 08:25 #8, ?

? 2 , - , - - , , a(i)=i, ( , , ) . , . - - - , .
, , ., ,
-
15th May 2008 09:58 #9
. , icaci. n, . :
Code:static int missing(int a[]) { int low = 0, high = a.length; do { int mid = (low+high) / 2; if (a[mid] > mid+1) high = mid; else low = mid; } while (high-low > 1); return(high+1); } }
. ,
, .
" . - array, . , [i][k] k- i- . , O(n) array ."
, array, . . O(n^2).
:@thedivaka,a . . icaci,Pesho, anrieff KaspirtovLast edited by aphex; 15th May 2008 at 10:07.
We are drowning in information, but starving for knowledge and time!
-
15th May 2008 10:32 #10
-
15th May 2008 13:09 #11
-
15th May 2008 08:53 #12
, ((1)) .
len(a)*(len(a)+1)/2 - sum(a),
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
15th May 2008 10:44 #13
@aphex, C ( C++ ). "", .
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
15th May 2008 11:03 #14
, java, .
, ( ). , .
:
{ {0,0,1}, = 1
{0,0,0}, = 0
{0,1,0}, = 2
{1,0,0}, = 4 .
{1,0,1},
{1,1,0},
{1,1,1}}
, copy/paste Java.We are drowning in information, but starving for knowledge and time!
-
15th May 2008 11:20 #15
-
15th May 2008 11:25 #16
.
, - .
, 2, . . , . N-1 M , 1 N ( ), 2
N ( , , 0 1) .{0,0,1}, = 1
{0,0,0}, = 0
{0,1,0}, = 2
{1,0,0}, = 4
{1,0,1},
{1,1,0},
{1,1,1}
- ( , ) ?
-
15th May 2008 11:53 #17
, , .
Quicksort - (n^2), . -. , O(n^2). , , .
:
http://en.wikipedia.org/wiki/Sorting_algorithmWe are drowning in information, but starving for knowledge and time!
-
15th May 2008 12:09 #18
, ( )
? - 20 , 20 .
O(N^2) O(N*M)
- ,
- 10 20 - .
, ."" , -.
-
15th May 2008 12:01 #19
"" , -. -, ((N) (N logN) + binsearch)
, . .
"640K ught to be enough for anybody" - Bill Gates, 1981
::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel
-
15th May 2008 13:05 #20
Anrieff: " , , n*(n-1)/2 " O(n), .
Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others
-
19th May 2008 16:03 #21
" ". swap- ? - - .
. ( Quick Sort), , . Merge sort . - . .
-
19th May 2008 16:15 #22
. :
(, ) 2 000 000 . :
------
QSort: 749 ms
QSort: 337 ms
------
QSort: 280 ms
QSort: 323 ms
--- ---
QSort: 274 ms
QSort: 265 msWe are drowning in information, but starving for knowledge and time!
-
19th May 2008 16:26 #23
-
19th May 2008 16:33 #24
Last edited by aphex; 19th May 2008 at 16:44.
We are drowning in information, but starving for knowledge and time!
-
19th May 2008 16:58 #25




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in