Re: [algogeeks]

2012-02-10 Thread praveen raj
choose greedy algorithm... in in minimum spanning tree..

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-02-10 Thread Manni mbd
are you sure u want to ask BINARY SEARCH treees and not Binary trees..

On 1/29/12, Moheed Moheed Ahmad mohe...@gmail.com wrote:
 I know how to solve it programatically, can anybody pls help me to solve it
 using combinatorics.
 -Moheed

 --
 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] Re: Binary Search Tree Question

2012-02-10 Thread sid1
This function is not reversing the tree, it swapping the left and
right sub trees. for ex.

  6
  5   8
   4   7 9
 1  11
2

=

   6
 8   5
9  4
   111
  2

i hope you get my point.
Siddhant Khanna

On Feb 9, 7:38 pm, Rahul Menon menonrahul1...@gmail.com wrote:
 What does this function do?

 void function(Node **node){
         if(*node!=NULL){
                 function((*node)-Left);
                 Node *temp;
                 temp = (*node)-Left;
                 (*node)-Left= (*node)-Right;
                 (*node)-Right = temp;
                 function((*node)-Right);
         }







 }

-- 
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] Share your comments

2012-02-10 Thread Amit Garg
I was studying the algorithm behind gold and currency that is running
for ages on Earth.
So I though I would share it with algo geeks:

http://lunaticzombie.blogspot.in/2011/12/barter-to-gold-to-currency-to-barter.html
do share your comments

-- 
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] Re: Subset Generation

2012-02-10 Thread shady
answer is always +ve,

does anyone know how to code it ?

On Sat, Feb 11, 2012 at 11:37 AM, Tushar tushicom...@gmail.com wrote:

 for the given test case in the problem, answer could have been zero

 what does it mean by without even reading zero in the problm
 statement?


 On Feb 9, 11:34 pm, shady sinv...@gmail.com wrote:
  Hi All,
  Anyway to implement this in a good mannerhttp://
 www.spoj.pl/ARHN/problems/PRINCESS, solution is simple,
  check for ones and then generate numbers is an increasing number...
  so if a number n = 22(10110)
  then for k = 1, ans = 2(10)
  then for k = 2, ans = 4(100)
  then for k = 3, ans = 6(110)
 
  Shady

 --
 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] Re: Subset Generation

2012-02-10 Thread Dave
@Shady: I'd try something like this:
For each n:
Let m = the number of 1-bits in n.
If k = 1m, then output -1.
For i = 1 to m do
Replace the ith 1-bit of n (counting from the right) with the ith
bit of k.
Output the updated n.

Example: n = 27 = binary 11011, k = 5 = binary 00101:
m = 4.
Replace the first 1-bit of n with the first bit of k: n = 11011.
Replace the 2nd 1-bit of n with the 2nd bit of k: n = 11001.
Replace the 3rd 1-bit of n with the 3rd bit of k: n = 11001.
Replace the 4th 1-bit of n with the 4th bit of k: n = 01001.
Output 5.

Dave


On Feb 11, 12:30 am, shady sinv...@gmail.com wrote:
 answer is always +ve,

 does anyone know how to code it ?



 On Sat, Feb 11, 2012 at 11:37 AM, Tushar tushicom...@gmail.com wrote:
  for the given test case in the problem, answer could have been zero

  what does it mean by without even reading zero in the problm
  statement?

  On Feb 9, 11:34 pm, shady sinv...@gmail.com wrote:
   Hi All,
   Anyway to implement this in a good mannerhttp://
 www.spoj.pl/ARHN/problems/PRINCESS, solution is simple,
   check for ones and then generate numbers is an increasing number...
   so if a number n = 22(10110)
   then for k = 1, ans = 2(10)
   then for k = 2, ans = 4(100)
   then for k = 3, ans = 6(110)

   Shady

  --
  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] Re: Subset Generation

2012-02-10 Thread Dave
@Dave: Oops. The last line of the example should be
Output 9.

Dave

On Feb 11, 1:39 am, Dave dave_and_da...@juno.com wrote:
 @Shady: I'd try something like this:
 For each n:
 Let m = the number of 1-bits in n.
 If k = 1m, then output -1.
 For i = 1 to m do
     Replace the ith 1-bit of n (counting from the right) with the ith
 bit of k.
 Output the updated n.

 Example: n = 27 = binary 11011, k = 5 = binary 00101:
 m = 4.
 Replace the first 1-bit of n with the first bit of k: n = 11011.
 Replace the 2nd 1-bit of n with the 2nd bit of k: n = 11001.
 Replace the 3rd 1-bit of n with the 3rd bit of k: n = 11001.
 Replace the 4th 1-bit of n with the 4th bit of k: n = 01001.
 Output 5.

 Dave

 On Feb 11, 12:30 am, shady sinv...@gmail.com wrote:



  answer is always +ve,

  does anyone know how to code it ?

  On Sat, Feb 11, 2012 at 11:37 AM, Tushar tushicom...@gmail.com wrote:
   for the given test case in the problem, answer could have been zero

   what does it mean by without even reading zero in the problm
   statement?

   On Feb 9, 11:34 pm, shady sinv...@gmail.com wrote:
Hi All,
Anyway to implement this in a good mannerhttp://
  www.spoj.pl/ARHN/problems/PRINCESS, solution is simple,
check for ones and then generate numbers is an increasing number...
so if a number n = 22(10110)
then for k = 1, ans = 2(10)
then for k = 2, ans = 4(100)
then for k = 3, ans = 6(110)

Shady

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