Re: [algogeeks] Valid permutation of the brackets

2010-06-04 Thread Jitendra Kushwaha
@senthilnathan : You are right. the growth of number is exponetial

nth Catalan number is approx Cn ~ (4^n) / ( sqrt(pi) * ( n^(3/2) ) ) :
http://en.wikipedia.org/wiki/Catalan_number
so the pruned exponential solution is the best one. We cant find algo any
less than exponential.

On Thu, Jun 3, 2010 at 10:03 PM, Senthilnathan Maadasamy 
senthilnathan.maadas...@gmail.com wrote:

 @Jitendra: Catalan number grows at least exponentially:
 http://mathworld.wolfram.com/CatalanNumber.html


  --
 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.




-- 
Regards
Jitendra Kushwaha
Undergradute Student
Computer Science  Eng.
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] Re: Median of BST

2010-06-04 Thread Antony Vincent Pandian.S.
I think kaushik's solution of inorder traversal  with hare and tortoise
technique should do the trick.

On Fri, May 21, 2010 at 3:48 PM, Koolvord Starbust kolvo...@gmail.comwrote:

 Sorry, but.. why don't you..

 a) compute the height of each subtree. Recusrively, takes O(n).
 b) start from the root. if its left subtree is bigger than the right
 one, than
 solution is on the left, since a symmetric traversal would put the
 root after more than half the elements, sorting them.
 so, recurse to the left, o.w. adjust k and recurse to the right.

 --
 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.




-- 
Luv,
S.Antony Vincent Pandian

-- 
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] Removing extra parentheses in an infix string

2010-06-04 Thread Algoose Chase
Hi ,

To add to your logic, I hope we must also be checking at the precedence of
the first operator that appears after the closing parenthesis ')' before we
can decided if the parenthesis can be removed or not .


On Thu, Jun 3, 2010 at 11:37 PM, Antony Vincent Pandian.S. 
sant...@gmail.com wrote:

 If the base logic follows the below rule, it should work.

 If any operator within parenthesis is of less precedence to the
 operator before the opening parenthesis, the parenthesis can not be
 removed.

 For cases of equal precedence of operators  before parenthesis and
 within parenthesis, transitivity condition should be checked. If
 transitive, parenthesis can be removed else should be retained. Eg:
 parenthesis cannot be removed for division operator while can be
 removed for multiplicative or addition or subtraction operator.

 On 6/3/10, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
  So there is a prob algoose A*(B*C) and a*(b*c+d)
  i hope you understood
 
  --
  --
  Rohit Saraf
  Second Year Undergraduate,
  Dept. of Computer Science and Engineering
  IIT Bombay
  http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14
 
  --
  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.
 
 

 --
 Sent from my mobile device

 Luv,
 S.Antony Vincent Pandian

 --
 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.



-- 
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] Valid permutation of the brackets

2010-06-04 Thread Rohit Saraf
@jitendra: How can you say that no polynomial algo can be found. I think you
are wrong.
A simple memoized formulation will make this polynomial because of the
optimal substructure..
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Removing extra parentheses in an infix string

2010-06-04 Thread Antony Vincent Pandian.S.
Yup... That also makes sense

If the precedence of the operator after ) is greater than the precedence of
any of the operators within (), the parenthesis should not be removed..

Thats a nice valid point...

On Fri, Jun 4, 2010 at 11:03 AM, Algoose Chase harishp...@gmail.com wrote:

 Hi ,

 To add to your logic, I hope we must also be checking at the precedence of
 the first operator that appears after the closing parenthesis ')' before we
 can decided if the parenthesis can be removed or not .



 On Thu, Jun 3, 2010 at 11:37 PM, Antony Vincent Pandian.S. 
 sant...@gmail.com wrote:

 If the base logic follows the below rule, it should work.

 If any operator within parenthesis is of less precedence to the
 operator before the opening parenthesis, the parenthesis can not be
 removed.

 For cases of equal precedence of operators  before parenthesis and
 within parenthesis, transitivity condition should be checked. If
 transitive, parenthesis can be removed else should be retained. Eg:
 parenthesis cannot be removed for division operator while can be
 removed for multiplicative or addition or subtraction operator.

 On 6/3/10, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:
  So there is a prob algoose A*(B*C) and a*(b*c+d)
  i hope you understood
 
  --
  --
  Rohit Saraf
  Second Year Undergraduate,
  Dept. of Computer Science and Engineering
  IIT Bombay
  http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14
 
  --
  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.
 
 

 --
 Sent from my mobile device

 Luv,
 S.Antony Vincent Pandian

 --
 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.


  --
 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.




-- 
Luv,
S.Antony Vincent Pandian

-- 
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] c++ and sql

2010-06-04 Thread ankur aggarwal
Write a C/C++ console application that connects to a MySQL server and prints
the number of aborted connects using information provided by MySQL's global
variables.

-- 
With Regards

Ankur Aggarwal

-- 
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] Valid permutation of the brackets

2010-06-04 Thread jaladhi dave
Believe it won't be simple, since its not following a language like
hierarchy. try to evolve set of solution for 4 from 3 and you will notice
that its not a straight function.

On Fri, Jun 4, 2010 at 1:40 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:

 @jitendra: How can you say that no polynomial algo can be found. I think
 you are wrong.
 A simple memoized formulation will make this polynomial because of the
 optimal substructure..
 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14



  --
 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.


-- 
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] Valid permutation of the brackets

2010-06-04 Thread saurabh gupta
@Rohit: you have to visit all valid solutions at least once, (as you are
printing it)
so the lower bound is Cn (nth catalan number)

On Fri, Jun 4, 2010 at 1:40 PM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:

 @jitendra: How can you say that no polynomial algo can be found. I think
 you are wrong.
 A simple memoized formulation will make this polynomial because of the
 optimal substructure..
 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14



  --
 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.




-- 
Man goes to doctor. Says he's depressed. Says life seems harsh and cruel.
Says he feels all alone in a threatening world where what lies ahead is
vague and uncertain. Doctor says Treatment is simple. Great clown
Pagliacci is in town tonight. Go and see him. That should pick you up. Man
bursts into tears. Says But, doctor...I am Pagliacci.

-- 
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] Valid permutation of the brackets

2010-06-04 Thread Jitendra Kushwaha
@rohit: Here we have to print not only number of possible valid bracket but
also how they look (eg  :  ()()()  )

 If we need to print only number of brackets then then using the recurrence
relation of catalan number we can find it easily.

According to your point, can you suggest a memoization which can handle the
problem of  printing of bracket arrangement also.
Any such algo can make the solution polynomial.


-- 
Regards
Jitendra Kushwaha
Undergradute Student
Computer Science  Eng.
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.



[algogeeks] Quick short stack space reduction

2010-06-04 Thread MOHIT ....
in quick short each time list is divided into two part ..suppose shorter one
and longer one . it is said that shorting smaller sublist first reduces
stack space . why so ?
  thnx

-- 
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] Valid permutation of the brackets

2010-06-04 Thread Rohit Saraf
Oh i am talking only about printing the total number of solutions...
If you backtrack... Obviously it would not be polynomial

-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Quick short stack space reduction

2010-06-04 Thread Rohit Saraf
if you short the larger one first, then the smaller one will be in the
stack for a long time. Which is wasting stack space.
Now stop shorting and start sorting ! :)

--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Recursion help!

2010-06-04 Thread Raj N
int Max(int a[],int n)
{
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
}

Hi, the above is a code to find the max in an array recursively. I
find very difficult in understanding the flow of recursive programs.
Can someone help me out in explaining the flow of the program with
stack sections if possible.
Thanks!!

-- 
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] Recursion help!

2010-06-04 Thread Prashant Kulkarni
int Max(int a[],int n)
{
   int max;
   if(n==1) ---( 1 )
   return a[0];
   else
   max=Max(a,n-1);
---( 2 )
   if(maxa[n-1])
   return max;
---( 3 )
}
   else
   return a[n-1];
---( 4 )
}

Statement (1) will executed when there is only single present in the  array

Statement (2) otherwise else part will executed
in this section we calling same function with array index n,n-1,..,0
(position of the elements)

Statement (3) checking whether this present element is larger than previous
one ie here we are comparing ( n )th and
(n-1) th element;  if  (n) th is greater then it will return its value

Statement (4)
here if  (n-1) th is greater so  it will return its value


-- Prashant Kulkarni




On Fri, Jun 4, 2010 at 7:13 PM, Raj N rajn...@gmail.com wrote:

 int Max(int a[],int n)
 {
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
 }

 Hi, the above is a code to find the max in an array recursively. I
 find very difficult in understanding the flow of recursive programs.
 Can someone help me out in explaining the flow of the program with
 stack sections if possible.
 Thanks!!

 --
 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.



-- 
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] Print the string in reverse order (not revstr

2010-06-04 Thread Raj N
If I've a string like It is a fine morning, the algorithm has to print
morning fine a is It and not gninrom enif a si tI
The algo has to do this in linear time. Can someone help me out in this

-- 
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] Print the string in reverse order (not revstr)

2010-06-04 Thread Raj N
If I've a string like It is a fine morning, the algorithm has to print
morning fine a is It and not gninrom enif a si tI
The algo has to do this in linear time. Can someone help me out in this

-- 
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] Number of sequences of n binary digits that don't contain two 1's in a row

2010-06-04 Thread Raj N
Hi,
I came across this question to find the number of sequences of n
binary digits that don't contain 2 1's in a row. I wanted to know what
exactly this means. Is it like if n=3 then compute all binary numbers
having 3 digits which don't have consecutive 1's 110, 011, 111 ??
If not help me understanding it.
Thanks!!

-- 
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] Recursion help!

2010-06-04 Thread Raj N
@Prashant: Are you saying that after the base case has been reached, only
then statements 3,4 will be executed for all the recursive calls?

On Fri, Jun 4, 2010 at 7:52 PM, Prashant Kulkarni prashant.r.k...@gmail.com
 wrote:


 int Max(int a[],int n)
 {
int max;
if(n==1) ---( 1
 )
return a[0];
else
max=Max(a,n-1);
 ---( 2 )

if(maxa[n-1])
return max;
 ---( 3 )
 }
else
return a[n-1];
 ---( 4 )
 }

 Statement (1) will executed when there is only single present in the  array

 Statement (2) otherwise else part will executed
 in this section we calling same function with array index n,n-1,..,0
 (position of the elements)

 Statement (3) checking whether this present element is larger than previous
 one ie here we are comparing ( n )th and
 (n-1) th element;  if  (n) th is greater then it will return its value

 Statement (4)
 here if  (n-1) th is greater so  it will return its value


 -- Prashant Kulkarni





 On Fri, Jun 4, 2010 at 7:13 PM, Raj N rajn...@gmail.com wrote:

 int Max(int a[],int n)
 {
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
 }

 Hi, the above is a code to find the max in an array recursively. I
 find very difficult in understanding the flow of recursive programs.
 Can someone help me out in explaining the flow of the program with
 stack sections if possible.
 Thanks!!

 --
 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.


  --
 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.


-- 
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] Recursion help!

2010-06-04 Thread b. roffmann
loop recurs with array index n,n-1,..,0 as stated in this thread.

will return Max value from array, for (n-1) upon each integer of
iteration n, upon condition present element is larger than previous
element, otherwise, it will return the previous value.

the algorithm seems to provide a series of values of a maximum
compared between an array value and it's previous value.

On 6/4/10, Prashant Kulkarni prashant.r.k...@gmail.com wrote:
 int Max(int a[],int n)
 {
int max;
if(n==1) ---( 1 )
return a[0];
else
max=Max(a,n-1);
 ---( 2 )
if(maxa[n-1])
return max;
 ---( 3 )
 }
else
return a[n-1];
 ---( 4 )
 }

 Statement (1) will executed when there is only single present in the  array

 Statement (2) otherwise else part will executed
 in this section we calling same function with array index n,n-1,..,0
 (position of the elements)

 Statement (3) checking whether this present element is larger than previous
 one ie here we are comparing ( n )th and
 (n-1) th element;  if  (n) th is greater then it will return its value

 Statement (4)
 here if  (n-1) th is greater so  it will return its value


 -- Prashant Kulkarni




 On Fri, Jun 4, 2010 at 7:13 PM, Raj N rajn...@gmail.com wrote:

 int Max(int a[],int n)
 {
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
 }

 Hi, the above is a code to find the max in an array recursively. I
 find very difficult in understanding the flow of recursive programs.
 Can someone help me out in explaining the flow of the program with
 stack sections if possible.
 Thanks!!

 --
 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.



 --
 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.



-- 
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] Recursion help!

2010-06-04 Thread satwik krishna
i think the best way to trace is to draw a picture of the stack and put the
values and acc understand the flow

On Fri, Jun 4, 2010 at 7:22 AM, Prashant Kulkarni prashant.r.k...@gmail.com
 wrote:


 int Max(int a[],int n)
 {
int max;
if(n==1) ---( 1
 )
return a[0];
else
max=Max(a,n-1);
 ---( 2 )

if(maxa[n-1])
return max;
 ---( 3 )
 }
else
return a[n-1];
 ---( 4 )
 }

 Statement (1) will executed when there is only single present in the  array

 Statement (2) otherwise else part will executed
 in this section we calling same function with array index n,n-1,..,0
 (position of the elements)

 Statement (3) checking whether this present element is larger than previous
 one ie here we are comparing ( n )th and
 (n-1) th element;  if  (n) th is greater then it will return its value

 Statement (4)
 here if  (n-1) th is greater so  it will return its value


 -- Prashant Kulkarni





 On Fri, Jun 4, 2010 at 7:13 PM, Raj N rajn...@gmail.com wrote:

 int Max(int a[],int n)
 {
int max;
if(n==1)
return a[0];
else
max=Max(a,n-1);
if(maxa[n-1])
return max;
else
return a[n-1];
 }

 Hi, the above is a code to find the max in an array recursively. I
 find very difficult in understanding the flow of recursive programs.
 Can someone help me out in explaining the flow of the program with
 stack sections if possible.
 Thanks!!

 --
 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.


  --
 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.


-- 
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] Quick short stack space reduction

2010-06-04 Thread divya jain
if u sort the larger one first one then smaller one will be on stack for a
long time on the other hand if u sort smaller one first then larger one will
be in stack for long time. so more space is wasted is 2nd case so we shd
sort larger first. correct me if i am wrong plzzz

On 4 June 2010 18:08, Rohit Saraf rohit.kumar.sa...@gmail.com wrote:

 if you short the larger one first, then the smaller one will be in the
 stack for a long time. Which is wasting stack space.
 Now stop shorting and start sorting ! :)

 --
 Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14http://www.cse.iitb.ac.in/%7Erohitfeb14



  --
 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.


-- 
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] circle

2010-06-04 Thread sharad kumar
@divya:make use of bresenham circle drawing algortihm

On Fri, Jun 4, 2010 at 8:42 PM, divya sweetdivya@gmail.com wrote:

 . Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without
 making use of any floating point computations at all. [ This one had
 me stuck for quite some time and I first gave a solution that did have
 floating point computations ].

 --
 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.




-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
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] Quick short stack space reduction

2010-06-04 Thread sharad kumar
@divya,in second case longer one will be in stack for shorter time(not
longer)bcoz it will take less time to sort small sequence so stack space for
shorter one will be freed earlier,otherwise that space has to wait for the
longer time

-- 
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]

2010-06-04 Thread sharad kumar
Implement an algorithm to take an array and return same array with only
unique elements in it.(in o(n) time).

-- 
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] Print the string in reverse order (not revstr

2010-06-04 Thread Shobhit Bhatnagar
Reverse the string first and then reverse individual tokens.

So, first we can reverse the whole string as

It is a fine morning gets converted to gninrom enif a si tI and then
reverse each token in the string so that end result would be the desired
result.

On Fri, Jun 4, 2010 at 8:01 PM, Raj N rajn...@gmail.com wrote:

 If I've a string like It is a fine morning, the algorithm has to print
 morning fine a is It and not gninrom enif a si tI
 The algo has to do this in linear time. Can someone help me out in this

 --
 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 and Regards
Shobhit Bhatnagar
DUMCA | 2006-09

-- 
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] Number of sequences of n binary digits that don't contain two 1's in a row

2010-06-04 Thread sharad kumar
@rajn.can it be subsequence doesnt have one's too.hence 000,001,010,100 is
required answer.

On Sat, Jun 5, 2010 at 12:13 AM, Raj N rajn...@gmail.com wrote:

 Hi,
 I came across this question to find the number of sequences of n
 binary digits that don't contain 2 1's in a row. I wanted to know what
 exactly this means. Is it like if n=3 then compute all binary numbers
 having 3 digits which don't have consecutive 1's 110, 011, 111 ??
 If not help me understanding it.
 Thanks!!

 --
 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.




-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
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]

2010-06-04 Thread sharad kumar
@sharad :does it hav to be inplace solution.
ps:btw are u from MIT AERO DEPT?

On Sat, Jun 5, 2010 at 8:30 AM, sharad kumar sharad20073...@gmail.comwrote:

 Implement an algorithm to take an array and return same array with only
 unique elements in it.(in o(n) time).

 --
 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.




-- 
yezhu malai vaasa venkataramana Govinda Govinda

-- 
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]

2010-06-04 Thread Rohit Saraf
Make a hashmap... Any problem doing that?


-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Re: partion of array

2010-06-04 Thread Rohit Saraf
What precisely did you not understand??

-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Print the string in reverse order (not revstr)

2010-06-04 Thread Rohit Saraf
Have you posted the same question twice or i am feeling sleepy?

-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] Removing extra parentheses in an infix string

2010-06-04 Thread Rohit Saraf
Exactly that's what you need to do.

-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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] CFP: Optical SuperComputing Workshop 2010

2010-06-04 Thread optical supercomputing

3rd International Workshop on Optical SuperComputing in Bertinoro
(OSC10)

November 17-19, Bertinoro, Italy

http://www.cs.bgu.ac.il/~dolev/OSC10

SCOPE:

OSC, the International Workshop on Optical SuperComputing, is an
annual forum for research presentations on all facets of optical
computing for solving hard computation tasks. Optical computing
devices have the potential to be the very next computing
infrastructure. Optical computing presents an alternative to the
frequency limitations, cross-talk phenomena and soft-errors of
electronic devices. The natural parallelism of optical computing
devices, coupled with the advance in fiber optics and optical switches
make optical computing commercially viable. Research contributions to
the theory, design, specification, analysis, implementation, or
application of optical supercomputers are solicited.

Topics of interest include, but are not limited to:
• Designs or demonstrations of optical computing devices and systems
• Algorithmics and complexity issues of optical computing
• Computation representation by photons and holograms
• Neural and brain inspired architectures
• Electro-optic devices for interacting with optical computing devices
• Practical implementations
• Analysis of existing devices and case studies
• Optical photonics and laser switching technologies
• Optical and photonic memories
• Optical signal processing subsystems
• Optical networks for high-performance computing
• Optical interconnections
• Quantum optical systems
• Applications and algorithms for optical devices
• Alpha particles, X-Rays and nano-technologies for optical computing


Dates:

Submission deadline: June 3, 2010
Acceptance notification August 10, 2010
Camera-ready copy due September 03, 2010

Steering and Organization Committee:

H. John Caulfield Fisk University
Shlomi Dolev Ben-Gurion University
Yeshaiahu Fainman UCSD
Tobias Haist Stuttgart Universitat
Mihai Oltean Babes-Bolyai University


Program Committee:

Hossin A. Abdeldayem, Nasa, USA
George Barbastathis, MIT, USA
Antonella Bogoni, CNIT, Italy
John H. Caulfield, Fisk University, USA
Shlomi Dolev, Ben-Gurion University, Israel
Yeshaiahu Fainman, University of California, USA
Dietmar Fey, University of Erlangen-Nürnberg, Germany
Debabrata Goswami, Indian Institute of Technology Kanpur, India
Tobias Haist, Stuttgart Universitat, Germany
Zhanghua Han, University of Alberta, Canada
Jürgen Jahns, FernUniversität in Hagen, Germany
Efstratios Kehayas, National Technical University of Athens, Greece
Shimon Levit, Weizmann Institute, Israel
Alastair McAulay, Lehigh University, USA
Kouichi Nitta, Kobe University, Japan
Mihai Oltean, Babes-Bolyai University, Romania
Wolfgang Osten, Universität Stuttgart, Germany
Haldun Ozaktas, Bilkent University, Turkey
Joseph Rosen, Ben-Gurion University, Israel
Sukhdev Roy, Dayalbagh Educational Institute, India
Natan T. Shaked, Duke University, USA
Joseph Shamir, Technion Institute, Israel
Dan Tamir, Texas State University, USA
Kristof Vandoorne, Ghent University, Belgium
Damien Woods, Caltech, USA
Zeev Zalevsky, Bar-Ilan University, Israel
Xinliang Zhang, Huazhong University of Science and Technology, China



How to submit:

Authors are invited to submit their extended abstracts electronically.
A detailed description of the electronic submission procedure will
appear on the workshop web-page, as of June 1, 2009. Authors unable to
submit electronically should contact the program chair, Shlomi Dolev
by email, do...@cs.bgu.ac.il or by phone, +972-8-6428119 to receive
instructions.

Workshop presentations will have two formats: Regular presentations of
at least 25 minutes accompanied by papers of up to 15 pages in the
proceedings. Additional material may be added in a clearly marked
Appendix to be read at the discretion of the Program Committee
Members. This form is intended for contributions reporting on original
research, submitted exclusively to this workshop. Brief announcements
of at least 10 minutes accompanied by two page abstracts in the
proceedings. This format is a forum for brief communications, which
may be published in other workshops. Longer versions expanding the
brief announcements will be collected in a web site. The workshop
proceedings will be published by LNCS Springer Verlag. We are also
seeking a special issue with a journal.


SUBMISSIONS FORMAT:

The cover page should include (1) title, (2) authors and affiliation,
(3) postal and e-mail address of the contact
author, (4)indication of the format(s) to which the paper is
submitted, and (5) a brief
abstract describing the work.

It is recommended that each submission begin
with a succinct statement of the problem, summary of the main results,
and a
brief explanation of their significance, all suitable for a
non-specialist. Technical development of the work, directed to the
specialist, should follow. A submission
for the regular presentation format should be no longer than 4,500
words
(10 pages on letter-size paper using