PLEASE,HELP ME!!!!!!!!!!!!!!!!!! I HAVE 2 PROGRAMM!!!!!!!!ONE OF THEM TLE#19,ANOTHER TLE#20
Edited by author 17.03.2007 22:05
Edited by author 17.03.2007 22:05
Edited by author 17.03.2007 22:49
HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Edited by author 19.03.2007 18:44
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your program is O(n^2). But you can write simple quick sort(O(n*log(n))) and got AC!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SORRY!IM BEGINNER,AND I SHALL VERY PLEASED TO YOU IF YOU SAY ME WHAT IT MEANS O(n*log(n))) OR O(n^2). THANK!!!!
Edited by author 17.03.2007 23:49
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I think I found book about quick sort
Edited by author 18.03.2007 00:54
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
It so hard????
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
No :)
Qsort is standart sorting algo
you should not understand how it's work deeply just
use it when you need(copypost:) or use included in C++
by the way this problem can be solved in O(n)
if you post your mail I can send you several variants
P.S.
O() is complexity of algo
shortly to say
for example
for i:=1 to n do ... O(n)
for i:=1 to n do
for j:=1 to n do ... O(n^2)
but it's very stupid definition:)
Edited by author 18.03.2007 02:37
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Why O(n), I think it's O(2*n)!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Why O(n), I think it's O(2*n)!!!
:)
O(2*n)= O(3*n)=O(100000000000000000*n) = O(n)
constant is not uses with n in O
so with small n sometimes O(N^2) solutions work faster then
O(n) because of constant
my O(n) is only 1 cycle for input for i:=1 to n
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MY mail:serchch@mail.ru!THANK YOU VERY much!YOU HELP me second time!!!!THANK YOU!!!!!!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IS QSORT FUNCTION USE IN <ALGORITHM>?
Edited by author 19.03.2007 17:50
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
YES.
int a[100];
sort(a,a+100);
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Edited by author 19.03.2007 18:43
Edited by author 19.03.2007 18:43
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
My algo is the same :)
[DELETED]
Edited by author 19.03.2007 18:34
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SORRY!CAN YOU SAY WHAT MEANS MALLOC?THANK!!!!
Edited by author 19.03.2007 18:24
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
char *t;
t = (char*)malloc(sizeof(char)*10);
equal to
char *t = new char[10];
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
THANK!!!NOW I UNDERSTAND!
Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
:)