Re: [algogeeks] Need help

2018-04-22 Thread Saurabh Paliwal
Hi,
An approach could be to guess the answer `A` and check if in `A` time, all
the tasks can be completed.
For checking, just iterate through the k people, the number of tasks
completed would be `A`/k[i] (integer division) for everyone.
If sigma(`A`/k[i]) >= N, `A` works. Now do a binary search to find the
minimum `A` which works. The upper bound could be N*min(k[i]) giving all
tasks to be solved by the person which takes the least amount of time.

Time complexity will be k*log(N*min(k[i])

On Sun, Apr 22, 2018 at 1:58 PM, pawan yadav 
wrote:

> Hi All,
>
> Has anybody solved the following problem?
>
> https://www.careercup.com/question?id=5196860946907136
>
> -Pawan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>



-- 
 -Saurabh Paliwal

   B-Tech. Comp. Science and Engg.

   IIT ROORKEE

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


[algogeeks] Need help

2018-04-22 Thread pawan yadav
Hi All,

Has anybody solved the following problem?

https://www.careercup.com/question?id=5196860946907136

-Pawan

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


[algogeeks] Need help on SPOJ(HASHIT)

2013-05-27 Thread Amit
Hello,
I have been trying to solve this http://www.spoj.com/problems/HASHIT/problem 
on SPOJ. I am getting Wrong Answer on submission, but my solution work fine 
on the sample.
Please tell me where I am wrong. Here http://ideone.com/lMSw94 is my code.

Thanks in advance.

Amit Tiwari
BIT Mesra

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] need help??

2012-09-23 Thread b.raj kannan
any body know about juniper networks internship written test pattern..
please help me.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need help??

2012-09-22 Thread Ratan
guys plzz help me wid the java book that i shld start ???

-- 
--
Ratan | Final Year | Information Technology | NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help??

2012-09-22 Thread Ravi Ranjan
khalid mugal - A Programmers guide to Java certification

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help??

2012-09-22 Thread Rohit Singhal
the very best book...no doubt..Khalid Mughal.

On Sat, Sep 22, 2012 at 2:10 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote:

 khalid mugal - A Programmers guide to Java certification

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Rohit Singhal
09211931609

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need Help with PHP/HTML

2012-07-16 Thread Nandita Raman
Hello,

I am working on PHP/HTML/ XML-RPC.

I have a website, where one link shows the list of files as checkboxes and
a submit button below that.

I am stuck at point where when submit button is clicked, it has to go to
another .php page and execute whatever is there in that .php file.


Form intput type= method =post = I have tried and does not seem like
its working.

I would really appreciate any thoughts/inputs/help with this!

Thanks!

-- 

Regards,
Nandita

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need Help with PHP/HTML

2012-07-16 Thread Vandana Bachani
Hi,
You need to correct ur form tag. Try:
form name=somename id=someid method=post action=theotherfile.php

Thanks,
Vandana

On Mon, Jul 16, 2012 at 12:42 PM, Nandita Raman
nandita.rama...@gmail.comwrote:

 Hello,

 I am working on PHP/HTML/ XML-RPC.

 I have a website, where one link shows the list of files as checkboxes and
 a submit button below that.

 I am stuck at point where when submit button is clicked, it has to go to
 another .php page and execute whatever is there in that .php file.


 Form intput type= method =post = I have tried and does not seem
 like its working.

 I would really appreciate any thoughts/inputs/help with this!

 Thanks!

 --

 Regards,
 Nandita

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Vandana Bachani
Graduate Student, MSCE
Computer Science  Engineering Department
Texas AM University, College Station

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need Help with PHP/HTML

2012-07-16 Thread Piyush
connect ur form with the file you want to get redirected to by:

form method=POST action=NAME_OF_FILE.php
 input type=submit/
/form

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help

2012-04-13 Thread Rishabh Jain
http://www.codechef.com/problems/VOTERS


Here is my solution
Dont know y i m getting Runtime error..plz check..

#includecstdio
#includealgorithm
using namespace std;
int main()
{
int a,b,c,x[50001],i;
int s[11],count;
s[11]=0;
count=0;
//freopen(fun.txt,r,stdin);
scanf(%d%d%d,a,b,c);
for(i=0;ia;i++)
{
scanf(%d,x[i]);
s[x[i]]++;
}
for(i=0;ib;i++)
{
scanf(%d,x[i]);
s[x[i]]++;
}
for(i=0;ic;i++)
{
scanf(%d,x[i]);
s[x[i]]++;
}
for(i=0;i10;i++)
{
if(s[i]1)
count++;
}
printf(%d\n,count);
for(i=0;i10;i++)
{
if(s[i]1)
printf(%d\n,i);
}
return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2012-04-13 Thread Kuldeep Gupta
#includecstdio
using namespace std;
int a,b,c,x[51],i;
int s[101],count;
int main()
{


   scanf(%d%d%d,a,b,c);
   for(i=0;ia;i++)
   {
   scanf(%d,x[i]);
   s[x[i]]++;
   }
   for(i=0;ib;i++)
   {
   scanf(%d,x[i]);
   s[x[i]]++;
   }
   for(i=0;ic;i++)
   {
   scanf(%d,x[i]);
   s[x[i]]++;
   }
   for(i=0;i100;i++)
   {
   if(s[i]1)
   count++;
   }
   printf(%d\n,count);
   for(i=0;i100;i++)
   {
   if(s[i]1)
   printf(%d\n,i);
   }
   return 0;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-04-01 Thread Sagar Pareek
It was telling that error after doing some modifications...
Yeah i think bharat u r saying correct...
I will try it...
Thanks for reply...

On Sat, Mar 31, 2012 at 11:45 AM, bharat b bagana.bharatku...@gmail.comwrote:

 u should get an error: argument of type ‘void* (TraCISagar::)(void*)’ does
 not match ‘void* (*)(void*)’ ...
 The function which is threaded should be either static or global in
 pthread implementation ...


 On Tue, Mar 27, 2012 at 7:20 PM, Sagar Pareek sagarpar...@gmail.comwrote:

 Thanks for reply
 but tell me two thing , is it true or not?
 is NULL is not equal to (void*)0 ??
 AND
 int a=20;
 int b=(int)a ;  // Whats wrong in here??

 Similarly for
 void * TraCISagar::sender(void* a);

 then while calling in pthread as
  pthread_create(thread1,NULL,(void*)sender,NULL)
 instead of
  pthread_create(thread1,NULL,sender,NULL);


 by the way i already implemented NULL instead of (void*)0
 and
 pthread_create(thread1,NULL,sender,NULL);

 But not getting why this problem is occurring?


 On Tue, Mar 27, 2012 at 8:37 AM, SAMM somnath.nit...@gmail.com wrote:

 Yaa Senthil is right , I overlooked it . In 3rd argument also it is
 expecting an address while u r passing the pointer .

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 **KIND REGARDS --
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 **Regards
 *
 * bagana.bharatku...@gmail.com

 Bharat B | M.Tech II  | C.S.E | IITM
 *
 *
 *Ph: +91 8056127652*


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**KIND REGARDS --
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-03-31 Thread bharat b
u should get an error: argument of type ‘void* (TraCISagar::)(void*)’ does
not match ‘void* (*)(void*)’ ...
The function which is threaded should be either static or global in pthread
implementation ...

On Tue, Mar 27, 2012 at 7:20 PM, Sagar Pareek sagarpar...@gmail.com wrote:

 Thanks for reply
 but tell me two thing , is it true or not?
 is NULL is not equal to (void*)0 ??
 AND
 int a=20;
 int b=(int)a ;  // Whats wrong in here??

 Similarly for
 void * TraCISagar::sender(void* a);

 then while calling in pthread as
  pthread_create(thread1,NULL,(void*)sender,NULL)
 instead of
  pthread_create(thread1,NULL,sender,NULL);


 by the way i already implemented NULL instead of (void*)0
 and
 pthread_create(thread1,NULL,sender,NULL);

 But not getting why this problem is occurring?


 On Tue, Mar 27, 2012 at 8:37 AM, SAMM somnath.nit...@gmail.com wrote:

 Yaa Senthil is right , I overlooked it . In 3rd argument also it is
 expecting an address while u r passing the pointer .

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 **KIND REGARDS --
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 

**Regards
*
* bagana.bharatku...@gmail.com

Bharat B | M.Tech II  | C.S.E | IITM
*
*
*Ph: +91 8056127652*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-03-27 Thread Sagar Pareek
Thanks for reply
but tell me two thing , is it true or not?
is NULL is not equal to (void*)0 ??
AND
int a=20;
int b=(int)a ;  // Whats wrong in here??

Similarly for
void * TraCISagar::sender(void* a);

then while calling in pthread as
 pthread_create(thread1,NULL,(void*)sender,NULL)
instead of
 pthread_create(thread1,NULL,sender,NULL);


by the way i already implemented NULL instead of (void*)0
and
pthread_create(thread1,NULL,sender,NULL);

But not getting why this problem is occurring?

On Tue, Mar 27, 2012 at 8:37 AM, SAMM somnath.nit...@gmail.com wrote:

 Yaa Senthil is right , I overlooked it . In 3rd argument also it is
 expecting an address while u r passing the pointer .

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**KIND REGARDS --
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help regarding threads

2012-03-26 Thread Sagar Pareek
Hello all,
I need help regarding thread implementation in C++

Here is my sample code...

*class TraCISagar : public BasicModule1 {
public:
.
.
void activity();
void* sender(void*);
.
.
};

void* TraCISagar::sender(void* a)
{
.
.
.
}

void TraCISagar::activity()
{
  pthread_t thread1;
.
.
pthread_create(thread1,NULL,(void*)sender,(void*)0);   //problem coming
here
.
.
pthread_join(thread1,NULL);
}

int main()
{
.
.
.
.
}*

And error is invalid use of member (did you forget the ‘’ ?)
Do anyone of you know how to solve it?


-- 
**KIND REGARDS --
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-03-26 Thread SAMM
I think is error is in the 4th argument u r passing in this line *
pthread_create(thread1,NULL,(void*)sender,(void*)0);*

The 4th argument is expecting the address of the arguments , but the
address he is getting is 0 , which is not granted by OS . Tht address is
used by OS I guess .
Instead* (void*)0*  give it a shot with *NULL *. It should work.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-03-26 Thread Senthil Nathan
The problem is with the third argument in

*pthread_create(thread1,NULL,(void*)sender,(void*)0);*
*
*
It should just be sender or sender.

*pthread_create(thread1,NULL,sender,(void*)0);*

Thanks,
Senthil.

On Mon, Mar 26, 2012 at 5:25 PM, Sagar Pareek sagarpar...@gmail.com wrote:

 Hello all,
 I need help regarding thread implementation in C++

 Here is my sample code...

 *class TraCISagar : public BasicModule1 {
 public:
 .
 .
 void activity();
 void* sender(void*);
 .
 .
 };

 void* TraCISagar::sender(void* a)
 {
 .
 .
 .
 }

 void TraCISagar::activity()
 {
   pthread_t thread1;
 .
 .
 pthread_create(thread1,NULL,(void*)sender,(void*)0);   //problem coming
 here
 .
 .
 pthread_join(thread1,NULL);
 }

 int main()
 {
 .
 .
 .
 .
 }*

 And error is invalid use of member (did you forget the ‘’ ?)
 Do anyone of you know how to solve it?


 --
 **KIND REGARDS --
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding threads

2012-03-26 Thread SAMM
Yaa Senthil is right , I overlooked it . In 3rd argument also it is
expecting an address while u r passing the pointer .

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help

2011-09-12 Thread payal gupta
+1 techcoder,plzzz mail me 2..thanks in advance
Regards,
Payal Gupta


On Mon, Sep 12, 2011 at 11:01 AM, sukran dhawan sukrandha...@gmail.comwrote:

 +1 to tech coder

 On Mon, Sep 12, 2011 at 10:50 AM, tech coder techcoderonw...@gmail.comwrote:

 if somebody has the preparation material  and videos provided by
 Careercup.com. Then please send me.
 thanks.

 --
 tech codYou received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need help

2011-09-11 Thread tech coder
if somebody has the preparation material  and videos provided by
Careercup.com. Then please send me.
thanks.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help

2011-09-11 Thread sukran dhawan
+1 to tech coder

On Mon, Sep 12, 2011 at 10:50 AM, tech coder techcoderonw...@gmail.comwrote:

 if somebody has the preparation material  and videos provided by
 Careercup.com. Then please send me.
 thanks.

 --
 tech codYou received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need help

2011-08-01 Thread coder dumca
hi frnds
can any body tell me how a student can appear for amazon or microsoft , if
these comanies are not coming to the campus.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help

2011-08-01 Thread Rajeev Kumar
go to this link and upload ur resume...they will call if they feel it is
good
http://www.india.amazon.com/Careers/

http://www.india.amazon.com/Careers/

On Mon, Aug 1, 2011 at 11:58 PM, coder dumca coder.du...@gmail.com wrote:

 hi frnds
 can any body tell me how a student can appear for amazon or microsoft , if
 these comanies are not coming to the campus.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help

2011-06-15 Thread shashankreddy509
can any one tell the best compiler for c and c++...


Thanks,
G. Shashank Reddy

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/g2ZE6Sm9p-MJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2011-06-15 Thread D.N.Vishwakarma@IITR
In windows you can choose codeblocks or best is use linux gnu compiler

On Wed, Jun 15, 2011 at 8:50 PM, shashankreddy509 
shashankreddy...@gmail.com wrote:

 can any one tell the best compiler for c and c++...


 Thanks,
 G. Shashank Reddy

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/g2ZE6Sm9p-MJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**With Regards
Deoki Nandan Vishwakarma
IITR MCA
*
*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2011-06-15 Thread 李峰
intel icc compiler

On Wed, Jun 15, 2011 at 08:20:39AM -0700, shashankreddy509 wrote:
  can any one tell the best compiler for c and c++...
  
  
  Thanks,
  G. Shashank Reddy
  
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To view this discussion on the web visit https://groups.google.com/d/msg/
  algogeeks/-/g2ZE6Sm9p-MJ.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at 
  http://groups.google.com/group/algogeeks?
  hl=en.

-- 
TAOCP
大地母亲在忽悠着你.
http://cn.linkedin.com/pub/feng-li/29/95b/640
http://gentoo-taocp.blogspot.com
http://groups.google.com/group/szlug

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2011-06-15 Thread shashankreddy509
i need compiler for windows 7...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/Y9OZdeYwmggJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread Navneet Gupta
I would recommend you to read complete Java Reference book by Herbert
Schildt, it will take you nicely through the basics of creating window
based applications. First read the chapters on Applets and AWT and
then you should be able to easily and naturally graduate to using
Swing.


On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote:
 hi,
 I am trying to create a Desktop application in JAVA and somebody referred
 JAVA swing for designing such apps.
 i need help in creating one. If Anybody has any knowledge or is aware of
 links or pdfs then please reply.


 Thanks


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
--Navneet

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
@naveen Thanks for the prompt reply
I am already aware of Applets and AWT and have started getting acquainted to
Swing
but the problem lies where to start from. Its like I want a small example or
few starting steps.
Complete Reference is the book that i refer.


On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com wrote:

 I would recommend you to read complete Java Reference book by Herbert
 Schildt, it will take you nicely through the basics of creating window
 based applications. First read the chapters on Applets and AWT and
 then you should be able to easily and naturally graduate to using
 Swing.


 On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote:
  hi,
  I am trying to create a Desktop application in JAVA and somebody referred
  JAVA swing for designing such apps.
  i need help in creating one. If Anybody has any knowledge or is aware of
  links or pdfs then please reply.
 
 
  Thanks
 
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 --Navneet

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread Navneet Gupta
As soon as i type Java Swing PDFs in google, i get lots of results.
See if anyone of them can help you.

No tutorial i am having as such specifically for Swing.

On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote:
 @naveen Thanks for the prompt reply
 I am already aware of Applets and AWT and have started getting acquainted to
 Swing
 but the problem lies where to start from. Its like I want a small example or
 few starting steps.
 Complete Reference is the book that i refer.

 On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com wrote:

 I would recommend you to read complete Java Reference book by Herbert
 Schildt, it will take you nicely through the basics of creating window
 based applications. First read the chapters on Applets and AWT and
 then you should be able to easily and naturally graduate to using
 Swing.


 On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com wrote:
  hi,
  I am trying to create a Desktop application in JAVA and somebody
  referred
  JAVA swing for designing such apps.
  i need help in creating one. If Anybody has any knowledge or is aware of
  links or pdfs then please reply.
 
 
  Thanks
 
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 --Navneet

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
--Navneet

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
i Did that before asking for help on the group.
anyways thanks :)
Swing isnt necessary, someone referred so i am trying to learn it.
Any info regarding desktop or phone apps. will be appreciated.

On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.com wrote:

 As soon as i type Java Swing PDFs in google, i get lots of results.
 See if anyone of them can help you.

 No tutorial i am having as such specifically for Swing.

 On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote:
  @naveen Thanks for the prompt reply
  I am already aware of Applets and AWT and have started getting acquainted
 to
  Swing
  but the problem lies where to start from. Its like I want a small example
 or
  few starting steps.
  Complete Reference is the book that i refer.
 
  On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com
 wrote:
 
  I would recommend you to read complete Java Reference book by Herbert
  Schildt, it will take you nicely through the basics of creating window
  based applications. First read the chapters on Applets and AWT and
  then you should be able to easily and naturally graduate to using
  Swing.
 
 
  On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com
 wrote:
   hi,
   I am trying to create a Desktop application in JAVA and somebody
   referred
   JAVA swing for designing such apps.
   i need help in creating one. If Anybody has any knowledge or is aware
 of
   links or pdfs then please reply.
  
  
   Thanks
  
  
   --
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
  
 
 
 
  --
  --Navneet
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 --Navneet

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread karan sachan
Hi Snehi...Follow following links to kick-start your Swing!!

http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
http://www.dreamincode.net/forums/topic/206319-first-swing-application/

We may further help if you can tell us more about ur App which ur planning
to create!!

On Thu, Jun 9, 2011 at 2:06 PM, snehi jain snehijai...@gmail.com wrote:

 i Did that before asking for help on the group.
 anyways thanks :)
 Swing isnt necessary, someone referred so i am trying to learn it.
 Any info regarding desktop or phone apps. will be appreciated.


 On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.comwrote:

 As soon as i type Java Swing PDFs in google, i get lots of results.
 See if anyone of them can help you.

 No tutorial i am having as such specifically for Swing.

 On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com wrote:
  @naveen Thanks for the prompt reply
  I am already aware of Applets and AWT and have started getting
 acquainted to
  Swing
  but the problem lies where to start from. Its like I want a small
 example or
  few starting steps.
  Complete Reference is the book that i refer.
 
  On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com
 wrote:
 
  I would recommend you to read complete Java Reference book by Herbert
  Schildt, it will take you nicely through the basics of creating window
  based applications. First read the chapters on Applets and AWT and
  then you should be able to easily and naturally graduate to using
  Swing.
 
 
  On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com
 wrote:
   hi,
   I am trying to create a Desktop application in JAVA and somebody
   referred
   JAVA swing for designing such apps.
   i need help in creating one. If Anybody has any knowledge or is aware
 of
   links or pdfs then please reply.
  
  
   Thanks
  
  
   --
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
  
 
 
 
  --
  --Navneet
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 --Navneet

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 

Thanks  Regards,
Karan Sachan | System Engineer
Infosys Technologies Ltd.| Bangalore
Mobile: +91 9663373478

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help in Desktop applications

2011-06-09 Thread snehi jain
hey Karan... thanks a lot
the links are helpful :)
its an app. that can help in building one's vocab.
its basically a thought right now. Will ask more when things start taking
desired shape a little bit.

On Thu, Jun 9, 2011 at 4:59 PM, karan sachan karansac...@gmail.com wrote:

 Hi Snehi...Follow following links to kick-start your Swing!!


 http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
 http://www.herongyang.com/Swing/Introduction-First-Swing-Program-SwingHello.html
 http://www.dreamincode.net/forums/topic/206319-first-swing-application/

 We may further help if you can tell us more about ur App which ur planning
 to create!!

 On Thu, Jun 9, 2011 at 2:06 PM, snehi jain snehijai...@gmail.com wrote:

 i Did that before asking for help on the group.
 anyways thanks :)
 Swing isnt necessary, someone referred so i am trying to learn it.
 Any info regarding desktop or phone apps. will be appreciated.


 On Thu, Jun 9, 2011 at 2:00 PM, Navneet Gupta navneetn...@gmail.comwrote:

 As soon as i type Java Swing PDFs in google, i get lots of results.
 See if anyone of them can help you.

 No tutorial i am having as such specifically for Swing.

 On Thu, Jun 9, 2011 at 1:53 PM, snehi jain snehijai...@gmail.com
 wrote:
  @naveen Thanks for the prompt reply
  I am already aware of Applets and AWT and have started getting
 acquainted to
  Swing
  but the problem lies where to start from. Its like I want a small
 example or
  few starting steps.
  Complete Reference is the book that i refer.
 
  On Thu, Jun 9, 2011 at 1:48 PM, Navneet Gupta navneetn...@gmail.com
 wrote:
 
  I would recommend you to read complete Java Reference book by Herbert
  Schildt, it will take you nicely through the basics of creating window
  based applications. First read the chapters on Applets and AWT and
  then you should be able to easily and naturally graduate to using
  Swing.
 
 
  On Thu, Jun 9, 2011 at 1:39 PM, snehi jain snehijai...@gmail.com
 wrote:
   hi,
   I am trying to create a Desktop application in JAVA and somebody
   referred
   JAVA swing for designing such apps.
   i need help in creating one. If Anybody has any knowledge or is
 aware of
   links or pdfs then please reply.
  
  
   Thanks
  
  
   --
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
  
 
 
 
  --
  --Navneet
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 --Navneet

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 Thanks  Regards,
 Karan Sachan | System Engineer
 Infosys Technologies Ltd.| Bangalore
 Mobile: +91 9663373478

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help on fenwick trees

2011-04-29 Thread naga vinod kumar
Hi Guys ,
   Can any one give link for  tutorial or videos about
segment trees. I am unable to understand the basic idea  behind it .
Regards,
vinod

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help on Divide and Conquer Algorithm

2011-04-04 Thread Sweety
Question :Let A[1..n] be an array of integers. Design an efficient
divide and conquer algorithm to determine if A contains a majority
element, i.e an element appears more than n/2 times in A. What is the
time complexity of your algorithm?

Answer:
a[1..n] is an array
int majorityElement(int a[], int first, int last)
{
 If (first = = last)
{
 return a[first]; // Array has one element and its count = 1
and it is major element
 }
mid= (first+last)/2;

   (majorL,countL)= majorityElement(a,first,mid);
   (majorR,countR)= majorityElement(a,mid
+1,last);
n = total elements in an array;
  If(majorL==majorR)
return(countL+countR);
 else
 {
   If(countLcountR)
return(majorL,countL);
  elseif(countL countR)
return(majorR,countR);
  else
   return(majorL,majorR);
  }
 if(countLn/2)
temp1=majorL;
  if(countRn/2)
 temp2=majorR;

   If(temp1 = = temp2)
  return temp1;
  elseif(countLcountR)
 return temp1;
 else (countRcountL)
return temp2;
else
  return -1;
}

int main()
{
  int a[8] = {2,3,2,2,4,2,2,2};
  int first =1;
  int last=8;   //change the value of last when the array
increases or decreases in size
  int x = majorityElement(a,first,last);
  if(x= = -1)
printf(“No Majority Element”)
  else
  Majority element = x;
 }

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help regarding the SPOJ problem...

2011-03-18 Thread shubham
You have N marbles and K slots. You have to follow the below mentioned
rules :

   1. You can put in a marble or take out a marble from slot numbered
1 at any time.
   2. You can put in a marble or take out a marble from slot numbered
i only if there exists a marble at the slot i - 1.
   3. The game stops when a marble reaches the slot numbered K for the
first time.

Your task is to finish the game in minimum number of valid moves.

for further clarification one can visit:

http://www.spoj.pl/problems/MOVMRBL/

I am not able to calculate manually the steps for some (N,K) pair
(except the cases where K is less than or equal to N*(N-1)/2).
e.g how to proceed with just 3 marbles and 10 slots...

any idea in this direction will be appreciated...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help regarding the SPOJ problem...

2011-03-18 Thread Balaji Ramani
Hi,

I hope this is correct. Please correct if I am wrong.

Short answer:

Let a = (k-n)/(n-1)
Let b = (k-n)%(n-1)

steps = (n-1)(a)(a+1)/2 + b

Put  = steps + n
Remove = steps

Explanation:

Example with n = 3  k =10:

Start by putting balls in 1,2,3
1 2 3 x x x x x x
Now move balls from 1-3 to 3-5 using (n-1) steps
1 x 3 4 x x x x x REMOVE 2, PUT 4
x x 3 4 5 x x x x REMOVE 1, PUT 5

Moving balls from 3-5 to 5-7 using steps 1 and 2.

1) move first n-1 balls to 1 to n -1 slots. This takes ( reached_so_far - n
) steps
x x 3 4 5 x x x x
REMOVE 4, PUT 2
x 2 3 x 5 x x x x
REMOVE 3, PUT 1
1 2 x x 5 x x x x

2) move balls in 1 to n-1 slots to (reached_so_far + 1) to (reached_so_far +
n -1) slots. This takes (n-1) steps
1 2 x x 5 x x x x
REMOVE 2, PUT 6
1 x x x 5 6 x x x
REMOVE 1, PUT 7
x x x x 5 6 7 x x

Similarly we can move from 5-7 to 7-9 in ( 4 + 2 = 6 steps )
Now we can directly complete with one more step.

Summary:
Move from 1-3 to 3-5 in 2 steps
Move from 3-5 to 5-7 in 4 steps
Move from 5-7 to 7-9 in 6 steps
Move 1 ball to 10 in 1 step

PUT = 13(steps) + 3 (initial)
REMOVE = 13(steps)

Thanks,
Balaji.

On Fri, Mar 18, 2011 at 7:06 PM, shubham shubh2...@gmail.com wrote:

 You have N marbles and K slots. You have to follow the below mentioned
 rules :

   1. You can put in a marble or take out a marble from slot numbered
 1 at any time.
   2. You can put in a marble or take out a marble from slot numbered
 i only if there exists a marble at the slot i - 1.
   3. The game stops when a marble reaches the slot numbered K for the
 first time.

 Your task is to finish the game in minimum number of valid moves.

 for further clarification one can visit:

 http://www.spoj.pl/problems/MOVMRBL/

 I am not able to calculate manually the steps for some (N,K) pair
 (except the cases where K is less than or equal to N*(N-1)/2).
 e.g how to proceed with just 3 marbles and 10 slots...

 any idea in this direction will be appreciated...

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need help with a classic algorithm

2011-02-26 Thread MarchMadness
You are given n coins, at least one of which is bad. All the good
coins weigh the same, and
all the bad coins weigh the same. The bad coins are lighter than the
good coins.
Find the exact number of bad coins by making O(logn)^2 weighings on a
balance. Each
weighing tells you whether the total weight of the coins you put on
the left side of the balance
is smaller than, equal to, or larger than the total weight of the
coins you put on the right
side.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] need help solving this ACM ICPC prelims problem

2010-10-18 Thread soundar
Problem D: Numbered Grid

A grid of size N rows and M columns is filled with numbers, one in
each cell. You start at the centre of the cell at the top-left corner
(1,1) and your destination is the centre of the cell at the bottom-
right corner(N,M). In each step, you are only allowed to move to the
centre of the cell to the right or to the centre of the cell to the
bottom. There are many paths you can take to reach your destination
from your start - however, every path can be uniquely broken down into
a series of straight line-segments joined at right-angles. Each
straight line-segment in your path is termed a 'leg' of your path.
Your task is to choose a subset of the cells along your path in such a
way that the sum of the numbers in the chosen cells is maximized. Your
choice of cells must be such that exactly one chosen cell is present
on each leg of the path. Note that cells at the intersection of two
legs belong to both legs. What is the maximum possible sum you can
form?
Input Format:

The first line contains one integer T, the number of testcases. The
first line of each test case contains two space-separated integers N
and M. Each of the next N lines contains M space separated integers,
denoting cell values. The jth integer in the ith line denotes the
value of the cell (i, j).

Constraints:
1 = T = 10
1 = N, M = 100
Numbers in each cell will be between -1 and 1 inclusive.

Output Format:

For each testcase output a single line containing the maximum sum you
can form.
Sample Input:

3
2 2
-1 -2
5 -1
3 4
-1 2 -3 -4
-2 -3 5 -2
-1 -1 -2 3
2 2
3 1
5 3
Sample Output:

5
10
6
Explanation:
In the first test case, you can first move down and then move right.
Your path now has 2 legs and you can choose only the cell containing
5. This is valid as it satisfies the condition that you must choose
exactly one cell in each leg (because 5 is a part of both legs).
In the second test case, one best path is to walk right, choose 2, go
right again and then down to choose 5, go further down and then right
to pick up the final 3 (There are also other ways to pick-up the same
numbers).
In the third test case, the best path is either (down, right) or
(right, down). Note that since you can pick-up only one number in each
leg you cannot select the '5' in the lower left corner (If you decide
to pick-up 5, then you cannot pick up any other number because '5' is
shared by both legs. We can do better by selecting both 3s).

Time limit: 2 seconds
Memory: 64 MB

ACM International Collegiate Programming Contest, 2010, Asia-
Amritapuri Site

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] need help solving this ACM ICPC prelims problem

2010-10-18 Thread praba karan
its a dp prob...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help for this problem

2010-10-14 Thread Amit Chandak
I am trying to solve this problem, got some idea but am not
clear...please give your input...
http://www.codechef.com/problems/MONEY

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need help

2010-07-06 Thread crazysaikat
Hey anyone doing topcoder srm 375, please help me out in medium
question, question is..

Rabbits often feel lonely, so one group of rabbits decided to gather
together and play a game.  The game is played on a horizontal row of N
cells (N = 2), numbered 0 to N - 1 from left to right. Each cell is
colored white, black or red. You are given a string field of length N,
where the i-th character is the color of cell i ('W' for white, 'B'
for black and 'R' for red).  There are r rabbits playing the game. The
rabbits choose their starting cells randomly such that no two rabbits
are on the same cell. Each subset of r distinct cells has the same
probability of being chosen as their starting cells. The size of the
field is the number of cells it contains (which is initially N). The
following is repeated while the size of the field is greater than 2:
Each rabbit steps onto a neighboring cell. Since each cell potentially
has up to two neighboring cells, the following rules are used to
determine which cell the rabbit will choose:
If a rabbit is on cell 0, she must step onto cell 1.
If a rabbit is on cell size - 1 or size - 2, she must step onto the
left neighboring cell.
All other rabbits choose which neighboring cell to step onto according
to the color of the cell they are currently on:
White: She must step onto the left neighboring cell.
Black: She must step onto the right neighboring cell.
Red: If this is her first move, she must step onto the left
neighboring cell. Otherwise, she must return to the cell she was on
immediately before she was on the current cell.
After all rabbits finished their steps, for each cell that contains
more than one rabbit, all rabbits on that cell will be removed from
the field.
The rightmost cell will disappear (causing the size of the field to
decrease by 1). By the rules above, this cell will always be empty.
When the game ends, 0, 1 or 2 rabbits will remain on the field. Return
the expected number of rabbits left on the field when the game ends.

Samples :

WRBRW
4
Returns: 0.8
The initial positions of the rabbits are cells { 0, 1, 2, 3 }, { 0, 1,
2, 4 }, { 0, 1, 3, 4 }, { 0, 2, 3, 4 }, or { 1, 2, 3, 4 }.  For
example, if { 0, 1, 2, 4 } is chosen, they will step as follows and 2
rabbits will remain on the field:
1)


WWB
2
Returns: 1.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2010-07-06 Thread Jitendra Kushwaha
can you specify the question name or link of question on topcoder


-- 
Regards
Jitendra Kushwaha
MNNIT, Allahabad

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Need help

2010-07-06 Thread Priyanka Chatterjee
Contest in running and you are posting the 550 points problem? Its unfair.
Ask after it gets over.

On 6 July 2010 17:30, crazysaikat crazysai...@gmail.com wrote:

 Hey anyone doing topcoder srm 375, please help me out in medium
 question, question is..

 Rabbits often feel lonely, so one group of rabbits decided to gather
 together and play a game.  The game is played on a horizontal row of N
 cells (N = 2), numbered 0 to N - 1 from left to right. Each cell is
 colored white, black or red. You are given a string field of length N,
 where the i-th character is the color of cell i ('W' for white, 'B'
 for black and 'R' for red).  There are r rabbits playing the game. The
 rabbits choose their starting cells randomly such that no two rabbits
 are on the same cell. Each subset of r distinct cells has the same
 probability of being chosen as their starting cells. The size of the
 field is the number of cells it contains (which is initially N). The
 following is repeated while the size of the field is greater than 2:
 Each rabbit steps onto a neighboring cell. Since each cell potentially
 has up to two neighboring cells, the following rules are used to
 determine which cell the rabbit will choose:
 If a rabbit is on cell 0, she must step onto cell 1.
 If a rabbit is on cell size - 1 or size - 2, she must step onto the
 left neighboring cell.
 All other rabbits choose which neighboring cell to step onto according
 to the color of the cell they are currently on:
 White: She must step onto the left neighboring cell.
 Black: She must step onto the right neighboring cell.
 Red: If this is her first move, she must step onto the left
 neighboring cell. Otherwise, she must return to the cell she was on
 immediately before she was on the current cell.
 After all rabbits finished their steps, for each cell that contains
 more than one rabbit, all rabbits on that cell will be removed from
 the field.
 The rightmost cell will disappear (causing the size of the field to
 decrease by 1). By the rules above, this cell will always be empty.
 When the game ends, 0, 1 or 2 rabbits will remain on the field. Return
 the expected number of rabbits left on the field when the game ends.

 Samples :

 WRBRW
 4
 Returns: 0.8
 The initial positions of the rabbits are cells { 0, 1, 2, 3 }, { 0, 1,
 2, 4 }, { 0, 1, 3, 4 }, { 0, 2, 3, 4 }, or { 1, 2, 3, 4 }.  For
 example, if { 0, 1, 2, 4 } is chosen, they will step as follows and 2
 rabbits will remain on the field:
 1)


 WWB
 2
 Returns: 1.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thanks  Regards,
Priyanka Chatterjee
Final Year Undergraduate Student,
Computer Science  Engineering,
National Institute Of Technology,Durgapur
India
http://priyanka-nit.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Need Help - Constrained linear least square optimization C code

2008-01-30 Thread [EMAIL PROTECTED]

Hi
I need to find x that will minimize Ax-b=0, under the inequality
constraints Cxd.
Actually the constraints in my problem are only upper and lower bounds
to x values.
x is 4x1 vector, A is about 100x4 (and b is of course 100x1(.
What is the appropriate algorithm?
Is there any C / C++ code available?

I succeeded solving the non-constrained problem with SVD, but some
times it give non-legal solution.

Thanks a lot in advance
Ariel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help very desperately !

2007-05-27 Thread mirchi

i attempting to solve a problem where a triangle contains many
white triangles and black triangles inside it.
 it is required to find the largest white triangle.

the whole question can be found at :
http://acm.uva.es/p/v5/585.html

my code is pasted below :
can anyone please test my code and tell where it fails !

#includestdio.h
#includestdlib.h
#define COMPLETE 1
#define NOTCOMPLETE 0
#define UP 2
#define DOWN 3
#define R 4
#define L 5
#define U 6
#define D 7
int max(int x,int y,int z);
int func(int x,int y,int a ,int b,int p,int q,int bin,int dir,int
bsize);
char input[200][200];
int dp[200][200];
int nol,n;
int main()
{
 int count=0;
 int i,j,k;
 int x,y,z;
 int bin;
 int lmax,gmax;
 int out;
 for(count=1;;count++){
 scanf(%d,nol);
 if (nol==0)
 exit(1);
 lmax=0;
 gmax=0;
 n=2*nol-1;
 for(i=0;inol;i++)
 {
   for(j=0;jn;j++)
   {
   dp[i][j]=NOTCOMPLETE;
   }
 }
 for(i=0;inol;i++)
 {
  getchar();
  for(j=0;jn-i;j++)
  {
 scanf(%c,input[i][j]);
  }

 }
 for(i=0,k=0;inol;i++,k++)
 {
  for(j=k,bin=DOWN;j(n-k);j++)
  {
if(input[i][j]=='-')
{
   if(gmax==0)
   gmax=1;
   if(bin==DOWN)
   {
x=func(i,j,i,j+2,i+1,j+1,bin,R,2);
y=func(i,j-2,i,j,i+1,j-1,bin,L,2);
z=func(i-1,j-1,i-1,j+1,i,j,bin,U,2);
   }
   if(bin==UP)
   {
x=func(i-1,j+1,i,j,i,j+2,bin,R,2);
y=func(i-1,j-1,i,j-2,i,j,bin,L,2);
z=func(i,j,i+1,j-1,i+1,j+1,bin,D,2);
   }
   lmax=max(x,y,z);
   if(lmaxgmax)
   gmax=lmax;
}
if(bin==DOWN)
bin=UP;
else bin=DOWN;
  }
 }
 out = gmax*2 - 1;
 if(out!=1)
 {
   for(i=out-2;i=1;i-=2)
   {
  out+=i;
   }
 }
 if(gmax==0)
 printf(Triangle #%d\nThe largest triangle area is %d.\n,count,0);
 else
 printf(Triangle #%d\nThe largest triangle area is %d.\n,count,out);
}
}
 int func(int x,int y,int a ,int b,int p,int q,int bin,int dir,int
bsize)
 {
 int i,j,k;
 int m,l,h;
 int ret;
 int lmax;
 if(yx||y=(n-x)||ba||b=(n-a)||qp||q=(n-p))
 return 0;
 else if(x0||xnol||a0||anol||p0||pnol)
 return 0;
 else if(dp[x][y]==COMPLETEdp[a][b]==COMPLETEdp[p]
[q]==COMPLETE)
 return 0;
 else
 {
 dp[x][y]=COMPLETE;
 dp[a][b]=COMPLETE;
 dp[p][q]=COMPLETE;
 if(bin==DOWN)
 {
  if(dir==R)
  {
for(i=p,j=q;i=a;i--,j++)
{
   if(i==p)
   {
if(input[i][j]!='-')
return 0;
   }
   else
   {
if(!(input[i][j]=='-'input[i]
[j-1]=='-'))
return 0;
   }
}
  }
  if(dir==L)
  {
for(i=p,j=q;i=x;i--,j--)
{
   if(i==p)
   {
if(input[i][j]!='-')
return 0;
   }
   else
   {
if(!(input[i][j]=='-'input[i][j
+1]=='-'))
return 0;
   }
}
  }
  if(dir==U)
  {
for(i=x,j=y;j=b;j++)
{
if(input[i][j]!='-')
return 0;
}
  }
  ret=bsize;
  m=func(x,y,a,b+2,p+1,q+1,bin,R,bsize+1);
  l=func(x,y-2,a,b,p+1,q-1,bin,L,bsize+1);
  h=func(x-1,y-1,a-1,b+1,p,q,bin,U,bsize
+1);
  lmax=max(m,l,h);
  if(lmax0)
  ret=lmax;
  return ret;
 }
 if(bin==UP)
 {
  if(dir==R)
  {
for(i=p,j=q;i=x;i--,j--)
 

[algogeeks] need help for graph problem ...

2007-05-01 Thread mukesh tiwari
hello friends i m trying to solve problem
http://online-judge.uva.es/p/v5/523.html

in this problem i  using floyd's algorithm i m able to figure out total cost
but i m not able to figure out the path . may be the reason that i  did not
understand  the algorithm fully and i  use it as a black box but now i have
to go inside blackbox so plz help me to figure out the path...
here is my code ...

#includeiostream
using namespace std;
#define inf 100
int pathcost[1000][1000],pre[1000][1000];
int takeinput()
{
int j,k=0,m;
char c;
while(cin.get(c)   c!='\n')
{
if((c='0'  c='9') || (c=='-'))
{
cin.unget();
cinpathcost[0][k];
if(pathcost[0][k]==-1)
pathcost[0][k]=inf;
k++;
}
}
return(k);
}



int main()
   {
int m1,citytax[1000],w,i,j,k,t1,t2;
char c;

scanf(%d,m1);
getchar();//one for \n and anthor for blank line
getchar();
while(m1--)
 {
w=takeinput();
//printf(w=%d\n,w);
for( i=1;iw;i++)
  for( j=0;jw;j++)
{
cinpathcost[i][j];
if(pathcost[i][j]==-1)
pathcost[i][j]=inf;
}

for(i=0;iw;i++)
   cincitytax[i];

 getchar();

for(i=0;iw;i++)
  for(j=0;jw;j++)
pre[i][j]=i;

for(k=0;kw;k++)
 {
   for(i=0;iw;i++)
{
  for(j=0;jw;j++)
 {

if(pathcost[i][j]pathcost[i][k]+pathcost[k][j]+citytax[k])
{

pathcost[i][j]=pathcost[i][k]+pathcost[k][j]+citytax[k];
pre[i][j]=pre[k][j];
}
 }
}
}

while(cin.get(c)  c!='\n')
 {
cin.unget();
cint1t2;
printf(From %d to %d :\n,t1,t2);
printf(Total cost : %d\n,pathcost[t1-1][t2-1]);
getchar();
 }
printf(\n);

}
   }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help

2007-02-20 Thread ramtin

Hi,

could anybody help me to solve this problem

http://acm.zju.edu.cn/show_problem.php?pid=1002


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help of physics

2007-02-18 Thread mukesh tiwari
hi everybody   i m trying to solve this problem but i can't sovle it ...plz
suggest me algorithm to solve it .
link http://students.iitk.ac.in/programmingclub/iopc/problems/
or problem itself is

 Two electron are confined in a 1D infinite potential well. Each start from
opposite ends with different velocities towards each other. Whenever they
meet they pass through each other and lets say a mesons is transferred from
the electron we have marked A to electron B. Following classical mechanics
and assuming that intersections does not changes the electron velocities (
velocities get reversed on reaching the wall of the potential well ) you
have to find the no. of mesons that get accumulated in B after a certain
time t. You are given the length of the potential well and speeds of each
electron.


 *Input:*

First line of input will consist of a single integer T = no. of test cases;

Each test case will consist of 4 32-bit integers u,v,l,t in a single line.

 Where u= velocity of electron A

 v= velocity of electron B

 l=length of the 1D potential well

 t=time to consider


 *Output:*

For each test case you have to print a single integer giving the number of
intersections face to face or overtakes in a single line.


 *Sample Input:*

2

10 10 20 2

2 2 4 2


 *Sample Output:*

1

1


 **

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] (need help) How to solve this random number generatioin problem?

2007-01-30 Thread Jialin

Question:


Given a program which can generate one of {1, 2, 3, 4, 5} randomly.
How can we get another generator which can generate one of
{1,2,3,4,5,6,7} randomly?

Thank you!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups-beta.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Need Help on Hopcroft-Karp Algorithm

2006-08-21 Thread phoenixinter

Hi guys
I'm recently trying to study the Hopcroft-Karp Algorithm
that can compute the maximum matching of a bipartite
graph in O(sqrt(n)*m) complexity.

However I find it not so easy to understand.
Can anybody help me explaining how the algorithm works
or give me a working implementation of HK algorithm?

Many thanks and best regards,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help...

2006-08-17 Thread Iman

hello to all you guys out there
i am a newbie to ACM
and i after i going to solve my first problem today
in http://acm.uva.es/p/v1/100.html
i write a program and i think it works corectly
but the Judge say me wrong answer wrong answer.
i would be grateful if you helping me
tanx in advance
---
#include iostream.h

void main()
{
int a,b,counter,max,index,temp,i;
while (cinab)
{
index  = a;
max = 0;

for(i=a;i=b;i++)
{
counter= 0;
temp = i;
while(temp!=1)
{
counter++;
if((temp%2)==1)
temp= 3 * temp + 1;
else
{
if((temp%2)==0)
temp= temp/2 ;
}

}
counter++;

if(counter = max)
{
max=counter;
index = i;
}

}
couta b maxendl;
}
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Need help with determining most efficient algorithm

2006-05-07 Thread someusername

Hi all. I have this problem with analysis of algorithms, I thought
maybe I could get some help here... It's not defined *that* strictly,
so I guess I shouldn't be looking for an exact solution. This is how it
goes:

--
You have an algorithm A that solves a given problem in N/2 steps of
complexity O(N^2) each, for an input set of size N. (exact kind of
complexity is not stated)
Suppose you come up with another algorithm B for the same problem, a
divide and conquer one. This algorithm divides the input of size N in
two pairs of size N/2 each. To achieve this subdivision it takes an
amount of data division operations D(N) = O(N*logN) and an amount of
data combination operations C(N) = O(N*logN)

The problem is to determine which of the two algorithms is more
efficient for this problem; A or B?
--

Reasonably, I tried to find upper bounds for the number of operations
needed in both cases and see which one comes up with a tighter bound.
A: T(N) = (N/2)*f(N), where f(N) = O(N^2)
Thus T(N)  (N/2)*(c1*N^2) = c2*N^3, where c1,c2 are constant.

B: T(N) = 2*T(N/2) = 2*(D(N/2)+C(N/2)), therefore
T(N)  2*c3*(N/2)*log(N/2) = c4*N*(logN-log2), where c? are constant

Is this enough to deem B as the more efficient one? Or am I
missing/doing wrong something here? Is there a pitfall somewhere?
and BTW, doesn't the recurrence T(N) = 2T(N/2) + constant yield
linear complexity? How do I come up with N*log(N) ?

Thanks in advance for any input.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help help n help!!!

2006-03-07 Thread gcet

hi guys need help..please

1. each student in a group of n students is scheduled to work one
shift, where each shift is a single congiguous interval of time. there
can be multiple shifts going on at once. devise an effiecient algorithm
to choose a smallest subset of these n students to form a committee so
that for ever student not on the committee, that students's shift
overlaps(at least partially) the shift of some student who is on the
committee.

2.
given a sequence of n distinct numbers a1,a2,.,an , a pair (ai,aj)
is known as significant inversion if ij and ai2aj. give O(n lg n)
algorithm to count the number of significant inversions in the given
sequence.

3. let a machine known as, equivalence tester, can determine whether
two bank card correspond to the same account by taking two cards at a
time as input and outputting whether they are equivalent. give an
algorithm which invokes equivalence tester at most O(nlgn) to determine
whether there is a set of more than n/2 equivalent cards in the given n
bank cards.

i appreciate your time...

thank you
please reply


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---