Re: [algogeeks] Re: storing URL's

2012-05-17 Thread Prakash D
We can still improve this trie idea..

say we have urls like
www.google.com
www.goodbye.com
www.google.com/transliterate
www.goodstrain.com/good

we can subdivide everything under www.goo
I mean we can store each character as a node in a trie and call it
like a URL dictionary


On Wed, May 16, 2012 at 5:43 PM, omega9 tvssarma.ome...@gmail.com wrote:


 On May 16, 10:33 am, atul anand atul.87fri...@gmail.com wrote:
 @amit :

 here is the reason :-

 each url sayhttp://www.geeksforgeeks.org

 you will hash following 
 urlshttp://www.geeksforgeeks.orghttp://www.geeksforgeeks.org/archiveshttp://www.geeksforgeeks.org/archives/19248http://www.geeksforgeeks.org/archives/http://www.geeksforgeeks.org/archives/19221http://www.geeksforgeeks.org/archives/19290http://www.geeksforgeeks.org/archives/1876http://www.geeksforgeeks.org/archives/1763

 http://www.geeksforgeeks.org; is the redundant part in each url . it
 would unnecessary m/m to save all URLs.

 ok now say file have 20 million urls . .now what would you do.??


 I think the trie suggestion was good. Have each domain (with the
 protocol part) as a node and then have the subsequent directory
 locations as a hierarchy under it.

 --
 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] Sorting in O(n)

2012-05-04 Thread Prakash D
The range 1 to n^2 is already sorted

On Sat, May 5, 2012 at 12:17 AM, Algobiz deepak.arulkan...@gmail.com wrote:
 How to sort n numbers in the range of 1 to n^2 in O(n).. Any ideas?

 --
 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/-/PGgMdaIbGIsJ.
 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] Amazon Interview Question

2012-04-27 Thread Prakash D
@bharat: +1

On Thu, Apr 26, 2012 at 1:06 PM, bharat b bagana.bharatku...@gmail.com wrote:
 create an array of linked lists.. each index in the array represents the
 node number and the linked list of that represents edges of that node.

-- 
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] ITRIX'12 OPC

2012-03-18 Thread Prakash D
+1

On Fri, Mar 16, 2012 at 11:35 PM, shady sinv...@gmail.com wrote:
 i wanted to try the questions now, but can't submit, can you provide the
 problems, and testdata ?


 On Mon, Mar 12, 2012 at 10:41 PM, Kashyap Krishnakumar
 kashyap...@gmail.com wrote:

 Hi,
     The online programming contest of ITRIX, the national level technical
 symposium of the Department of Information Sciences and Technology, College
 of Engineering Guindy is up and running. Prizes worth 15k to be won.

 Contest page: www.spoj.pl/ITRIX12/

 Participate and enjoy the contest. Have fun coding.

 --
 Kashyap.K,
 III year, B.E CSE,
 College of Engineering Guindy,
 Anna University,
 Chennai.

 --
 If you've never failed, you've never lived!

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

-- 
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: Pbm with rand() function

2012-02-27 Thread Prakash D
i've another doubt. what to do when I need to generate a random long long?

On Mon, Feb 27, 2012 at 9:07 PM, Don dondod...@gmail.com wrote:
 For instance, if RANDMAX= 32768, then

 x = rand() % 2;

 is twice as likely to result in the value 10,000 as the value 15,000.
 This is because there are two output values from rand() which result
 in x=1 (1 and 3), but only one output value from rand()
 resulting in x=15000 (15000).

 For any case where the statistical quality of the pseudo-random stream
 is important, such as simulation, using the built-in rand() function
 is not a good idea. Use a pseudo-random algorithm with much longer
 period and better properties, such as Mersenne Twister.

 But if you are using rand, it is usually recommended to use the high
 order bits rather than the low order bits. Many implementations of
 rand() have cycles in the low bits which are much shorter than the
 period of the generator. He is one way to generate unbiased values of
 quality as good as the generator can provide:

 // Return pseudo-random integer in the range 0..n-1
 int randRange(int n)
 {
  int result, div = RANDMAX / n;
  do {
    result = rand() / div;
  } while(result = n);
  return result;
 }

 Don

 On Feb 26, 10:10 am, karthikeya s karthikeya.a...@gmail.com wrote:
 RAND() func  returns value between 1 to INTMAX, as we know. But when
 smone tries to find out value between 1 to N he takes remainder of o/p
 of RAND() with N and adds one..but isn't it wrong coz RAND() will
 generate numbers with equal probability between 1 and INTMAX but
 taking remainder can alter the prob. of generating numbers.
 e.g.

 INTMAX=50
 N=30
 RAND(50) gives numbers 1 to 30, then prob. will remain same but if it
 gives numbers 31 to 50, they'll be mapped to the numbers 1 to 20,
 which means probability of getting numbers 1 to 20 is more than the
 probability for 21 to 30.

 --
 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] Re: Pbm with rand() function

2012-02-27 Thread Prakash D
with equal probability

On Tue, Feb 28, 2012 at 5:28 AM, Prakash D cegprak...@gmail.com wrote:
 i've another doubt. what to do when I need to generate a random long long?

 On Mon, Feb 27, 2012 at 9:07 PM, Don dondod...@gmail.com wrote:
 For instance, if RANDMAX= 32768, then

 x = rand() % 2;

 is twice as likely to result in the value 10,000 as the value 15,000.
 This is because there are two output values from rand() which result
 in x=1 (1 and 3), but only one output value from rand()
 resulting in x=15000 (15000).

 For any case where the statistical quality of the pseudo-random stream
 is important, such as simulation, using the built-in rand() function
 is not a good idea. Use a pseudo-random algorithm with much longer
 period and better properties, such as Mersenne Twister.

 But if you are using rand, it is usually recommended to use the high
 order bits rather than the low order bits. Many implementations of
 rand() have cycles in the low bits which are much shorter than the
 period of the generator. He is one way to generate unbiased values of
 quality as good as the generator can provide:

 // Return pseudo-random integer in the range 0..n-1
 int randRange(int n)
 {
  int result, div = RANDMAX / n;
  do {
    result = rand() / div;
  } while(result = n);
  return result;
 }

 Don

 On Feb 26, 10:10 am, karthikeya s karthikeya.a...@gmail.com wrote:
 RAND() func  returns value between 1 to INTMAX, as we know. But when
 smone tries to find out value between 1 to N he takes remainder of o/p
 of RAND() with N and adds one..but isn't it wrong coz RAND() will
 generate numbers with equal probability between 1 and INTMAX but
 taking remainder can alter the prob. of generating numbers.
 e.g.

 INTMAX=50
 N=30
 RAND(50) gives numbers 1 to 30, then prob. will remain same but if it
 gives numbers 31 to 50, they'll be mapped to the numbers 1 to 20,
 which means probability of getting numbers 1 to 20 is more than the
 probability for 21 to 30.

 --
 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] Kurukshetra Online Debugging Prelims today

2012-01-26 Thread Prakash D
1) Your algorithm must be efficient
2) Your I/O should be fast enough. Use scanf, printf instead of
cin,cout in C++. Use BufferedReader instead of Scanner in case of
Java.
3) Ask such doubts in the space provided in the contest.

On Thu, Jan 26, 2012 at 11:17 PM, prakash y yprakash@gmail.com wrote:
 Please don't mind if it's not related to this group. But please help me,
 because I do not want to be disqualified next time.

-- 
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] Amazon Interview Question

2012-01-19 Thread Prakash D
ignore my last comment.. misunderstood

On Thu, Jan 19, 2012 at 1:04 PM, Prakash D cegprak...@gmail.com wrote:

 why can't u simply place it as 1 2 3 4 5 6 7 1 2 3 4 5 6 7?


 On Thu, Jan 19, 2012 at 2:05 AM, NEERAJ KODDHAN neerajdc...@gmail.comwrote:

 int[] a = new int[2*n];
 put(a, n);

 static void put(int[] a,int i){
  if(i0){
  for(int j=0;ja.length-i-1;j++){
 if(a[j]==0  a[j+i+1]==0){
  a[j]=i;
 a[j+i+1]=i;
 put(a, i-1);
  a[j]=0;
 a[j+i+1]=0;
 }
  }
 }else if(i==0){
 for (int k : a) {
  System.out.print(k + );
 }
 System.out.println();
  }
 }


 On Wed, Jan 18, 2012 at 10:04 PM, Coding Geek codinggee...@gmail.comwrote:

 Place N number from 1 to N, in 2N positions in such a way so that there
 are

 Exactly “n” number of cells between two placed locations of number “n”.
 Write a program to display numbers placed in this way.

 Example:-

 (1) One of the possible placement for 7 numbers in 14 positions is :
 5 7 2 3 6 2 5 3 4 7 1 6 1 4



 --

 To Iterate is Human, To Recurse is Divine

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




-- 
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] Amazon Interview Question

2012-01-19 Thread Prakash D
why can't u simply place it as 1 2 3 4 5 6 7 1 2 3 4 5 6 7?

On Thu, Jan 19, 2012 at 2:05 AM, NEERAJ KODDHAN neerajdc...@gmail.comwrote:

 int[] a = new int[2*n];
 put(a, n);

 static void put(int[] a,int i){
  if(i0){
  for(int j=0;ja.length-i-1;j++){
 if(a[j]==0  a[j+i+1]==0){
  a[j]=i;
 a[j+i+1]=i;
 put(a, i-1);
  a[j]=0;
 a[j+i+1]=0;
 }
  }
 }else if(i==0){
 for (int k : a) {
  System.out.print(k + );
 }
 System.out.println();
  }
 }


 On Wed, Jan 18, 2012 at 10:04 PM, Coding Geek codinggee...@gmail.comwrote:

 Place N number from 1 to N, in 2N positions in such a way so that there
 are

 Exactly “n” number of cells between two placed locations of number “n”.
 Write a program to display numbers placed in this way.

 Example:-

 (1) One of the possible placement for 7 numbers in 14 positions is :
 5 7 2 3 6 2 5 3 4 7 1 6 1 4



 --

 To Iterate is Human, To Recurse is Divine

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


-- 
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] finding all combination

2012-01-03 Thread Prakash D
0-1 knapsack!

On Tue, Jan 3, 2012 at 5:14 PM, saurabh singh saurab...@gmail.com wrote:

 Most probably noThis is the subset sum problem which is proven NP
 complete...Even if a better solution than n^2 exists it won't work for all
 cases
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD





 On Tue, Jan 3, 2012 at 4:56 PM, atul anand atul.87fri...@gmail.comwrote:

 }
 output : {1,1,2}, {2,2}, {3,1}, {1,2,1}{4}...etc which make the sum as 4


  --
 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] Re: Find Largest number in log(n)

2011-12-12 Thread Prakash D
only the number of comparisons is log(n)

On Mon, Dec 12, 2011 at 11:04 PM, Ankur Garg ankurga...@gmail.com wrote:

 Agree with dave..Its still O(n)


 On Mon, Dec 12, 2011 at 10:57 PM, Dave dave_and_da...@juno.com wrote:

 @Sagar: Don is correct. n/2+n/4+n/8+... ~= n. But even the first
 round, involving n/2 comparisons, is O(n).

 Dave

 On Dec 12, 11:23 am, sagar pareek sagarpar...@gmail.com wrote:
  Yes Mr. DoN
 
  First round of Tournament sort results in log(n) time for finding
 largest
  no.
 
  n/2+n/4+n/8   results n/(2^i)   where ^ = power
 
 
 
 
 
  On Mon, Dec 12, 2011 at 8:16 AM, Don dondod...@gmail.com wrote:
   No. To find the largest number in an unsorted array requires looking
   at each number, which is order n by definition.
   Don
 
   On Dec 12, 10:02 am, sagar pareek sagarpar...@gmail.com wrote:
Hi every one.
 
Can we find largest number from an unsorted array in log(n) ?
 
--
**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
  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.


-- 
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: How random numbers are generated?

2011-12-06 Thread Prakash D
how those generators will generate?  any idea?

On Tue, Dec 6, 2011 at 2:14 AM, Don dondod...@gmail.com wrote:

 The rand function is implementation defined, so it doesn't work the
 same for every compiler. Most of them use a pseudo-random generating
 function such as linear congruential generators, lagged Fibonacci
 generators, and linear feedback shift registers. Poor generators are
 very common and have bad statistical properties and often produce
 obvious patterns, particularly in the low-order bits. Better
 generators have larger state and therefore can have longer periods.
 Generators such as the Mersenne Twister, or George Marsaglia's
 multiply with carry.
 Don

 On Dec 5, 9:58 am, Prakash cegprak...@gmail.com wrote:
  Anyone please explain how rand() function is defined and how it
  works?

 --
 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] Print all path of the tree that sums up to the given value

2011-10-31 Thread Prakash D
any constraints for path?

On Mon, Oct 31, 2011 at 11:19 AM, Ankuj Gupta ankuj2...@gmail.com wrote:

 Print all path of the tree that sums up to the given value. The path
 may start from any node.

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

2011-10-30 Thread Prakash D
@Piyush kapoor: i don't get it.. could u plz explain a lil more?

On Mon, Oct 24, 2011 at 8:19 PM, praveen raj praveen0...@gmail.com wrote:

 for 3 set .. set value stored in array a[3] and p is the sum

 for( i=0;i=a[0];i++)
 {
for(j=0;j=a[1];j++)
  {
   for(k=a[2];k=0;k--)
 {
   if((i+j+k)p)  // improve running time
 break;

 if((i+j+k)==p)
  coutijk;
 }
  }
 }

 With regards,

 Praveen Raj
 DCE-IT 3rd yr
 735993
 praveen0...@gmail.com




 On Mon, Oct 24, 2011 at 3:00 AM, Piyush Kapoor pkjee2...@gmail.comwrote:

 Suppose u choose ith element from the Kth set,then
 dp[K][Sum]=sum(from i=0 to number of elements in the Kth set)
 dp[K-1][Sum-(ith element of Kth set)]

 On Sun, Oct 23, 2011 at 3:31 PM, cegprakash cegprak...@gmail.com wrote:

 hi i recently came across this problem..

 there are K sets
 each sets can contain n numbers from 0 to n
 we've to choose exactly one number from each set
 the sum of all the elements that we chose should be equal to P.
 we have to find how many such possibilities are there to choose so..

 for example

 assume there are 3 sets containing 1,2,3 elements in them
 so the first set contains 0 and 1
 second set contains 0,1 and 2
 third set contains 0,1,2 and 3

 assume P=2

 in this case there are 5 possibilities

 (0,0,2), (0,1,1), (0,2,0), (1,0,1), (1,1,0)

 i'm struggling for a DP solution!! help me out

 --
 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,*
 *Piyush Kapoor,*
 *2nd year,CSE
 IT-BHU*

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


-- 
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] Dp solution for this problem?

2011-10-30 Thread Prakash D
if all possible diagonal movements are allowed i guess we must check all
the possibilities

On Mon, Oct 31, 2011 at 12:52 AM, mohit verma mohit89m...@gmail.com wrote:

 Given a matrix you have to find the shortest path from one point to
 another within the matrix. The cost of path is all the matrix entries on
 the way. You can move in any direction (up, down, left, right, diagonally)

 e.g.

 5 9 10 1
 3 7 4 4
 8 2 1 9

 So shortest path from (0,0) to (2,2) is (0,0)--(1,1)---(2,2). Path cost -
 5+3+2+1=11

 I dont think some DP solution exist for this problem.Can it be?


 --
 Mohit

 --
 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] Plz Explain the working

2011-10-03 Thread Prakash D
+1

On Mon, Oct 3, 2011 at 6:40 PM, ~*~VICKY~*~ venkat.jun...@gmail.com wrote:

 @Shauib: cool soln. Thank you.


 On Mon, Oct 3, 2011 at 6:14 PM, Shuaib aries.shu...@gmail.com wrote:

 Chk is a macro that gets replaced with an if statement. The else part gets
 attached to the most recent if which is the one from the macro. And since
 the condition in macro fails, the else clause is executed.

 --
 Shuaib
 http://twitter.com/ShuaibKhan
 http://www.bytehood.com/

 On 03-Oct-2011, at 4:47 PM, ~*~VICKY~*~ venkat.jun...@gmail.com
 wrote:

 #includestdio.h
 #define chk(cond) if(!(cond))\
 fprintf(stderr,chk failed: %s,file %s, line %d \n, #cond,\
 __FILE__,__LINE__),abort()
 main()
 {
 int i = 0;
 if(i==0)
 chk(i  100);
 else
 printf(hello);
 printf( world);
 }

 output: hello world

 can anyone clearly explain how this works.


 --
 Cheers,

   Vicky

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




 --
 Cheers,

   Vicky

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

2011-10-01 Thread Prakash D
if the string is like abcdef
then they will be numbered like 012345 and now we represent them in base 5
numbering and also in sorted order
the next permutation is
012354
012435
012453
012534
012543
013245
and so on..



On Sat, Oct 1, 2011 at 4:11 PM, rahul sharma rahul23111...@gmail.comwrote:

 guys plz xplain logic behind the string permutation.n if we have
 duplicates that should program display the duplicates or notnyone plz
 tell the logic/code for this.

 --
 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] Re: THANX ALGOGEEKS !!!!!!

2011-09-22 Thread Prakash D
congrats brother!!

On Thu, Sep 22, 2011 at 6:42 PM, saurabh sah.saurab...@gmail.com wrote:

 thanx to all

 I have shared my interview experience at
 http://msidcinterview.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 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] string problem

2011-09-20 Thread Prakash D
no.. each ans[s] is stored before returning.. so there is no recalculation
of any substring

On Sun, Sep 18, 2011 at 4:12 AM, Marcelo Amorim Menegali 
mmeneg...@gmail.com wrote:

  *ans[s]=find(s+1,len-1);*
 if(s[0]'3's[1]'7')
 *ans[s] = ans[s]+find(s+2,len-2);*



-- 
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] is it possible??

2011-09-19 Thread Prakash D
in c/c++
without main function how to write a compilable code?
for example printing a string

On Tue, Sep 20, 2011 at 12:15 AM, hary rathor harry.rat...@gmail.comwrote:

 use #pragma  in c .
 static block in java .

 by the way which lang you are talking about ?

 --
 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] why the output 16

2011-08-21 Thread Prakash D
FUNC2(8)

== 8==0? 1: 8 * FUNC1(8-1)
== 8==0? 1: 8*( 8-1* 8-1-1)

==  8 * (8-8-2)
== -16

but why 16??

On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.comwrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

 --
 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] why the output 16

2011-08-21 Thread Prakash D
got it

8==0? 1: 8*( 8 -1* 8-1-1)

== 8*( 8 - {1* 8-1-1})

== 8 * (8-6)
== 16

but why???

On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 == 8==0? 1: 8*( 8-1* 8-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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] why the output 16

2011-08-21 Thread Prakash D
:P.. no comments when i saw

On Sun, Aug 21, 2011 at 4:07 PM, sagar pareek sagarpar...@gmail.com wrote:

 @prakash
 before posting u should check what others already posted  :D  :D

 On Sun, Aug 21, 2011 at 4:03 PM, Prakash D cegprak...@gmail.com wrote:

 FUNC2(8)

 == 8==0? 1: 8 * FUNC1(8-1)
 == 8==0? 1: 8*( 8-1* 8-1-1)

 ==  8 * (8-8-2)
 == -16

 but why 16??

 On Sat, Aug 20, 2011 at 7:02 PM, SuDhir mIsHra sudhir08.mis...@gmail.com
  wrote:

 #includestdio.h
 #define FUNC1(i) (i*(i-1))
 #define FUNC2(i) (i==0?1:i*FUNC1(i-1))
 main()
 {
 int i=8;


 printf(\n%d,FUNC2(i));
 }

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




 --
 **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] convert a vector containing octal representation of a number to decimal number

2011-08-21 Thread Prakash D
A[i]3*i

why is it needed to convert from base 8 to base 10??

On Sun, Aug 21, 2011 at 4:07 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Hi your intention was logical OR or BITWISE OR ?

 u did Logical.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 3:30 AM, sarvesh saran aquarian.thun...@gmail.com
  wrote:

 Hi Nitin,

 thanks that makes sense. I will try that out.

 I have another question. Is there a  really fast way of converting a
 hexadecimal string say 02F9A to its decimal representation in C++?

 thanks,
 Sarvesh

 thanks,
 Sarvesh


 On Sun, Aug 21, 2011 at 3:41 PM, Nitin Nizhawan nitin.nizha...@gmail.com
  wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do. Given the number is with in the range of integer.


 On Sun, Aug 21, 2011 at 3:40 PM, Nitin Nizhawan 
 nitin.nizha...@gmail.com wrote:

 int num = 0;
 for(int i=0;iA.size();i++){
num=num||(A[i]3*i);
 }
 printf(%d,num);

 I think this will do.


 On Sun, Aug 21, 2011 at 2:25 PM, sarvesh saran 
 aquarian.thun...@gmail.com wrote:

 Hi,

 I have a vectorint A or an array (for C guys) that contains the octal
 representation of a number.

 So the array can be something like: [1,5,7] or [7,7,5,6,3,4,2] etc

 i.e no number in the array can be = 8.

 Now given this array, I need to convert it its decimal representation.

 The naive way to do it would be to scan array from left to right, take
 each digit, multiply by 8 pow (x) where x is from 0 to ...n and compute 
 sum.

 i.e something like:

 int oct = 1;
 int num = 0;

  for(array length){
 num+= oct * A[i];
 oct = oct * 8;
 }

 is there a faster way to do this? maybe using some STL container or 
 algorithm. ?

 thanks,
 sarvesh


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


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


-- 
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: shortest swapping rows

2011-08-18 Thread Prakash D
hey, thanks..
but if it needs many iteration, then we've to check each time whether the
array is sorted.. is there any better way for swapping

On Thu, Aug 18, 2011 at 5:02 AM, Brijesh Upadhyay 
brijeshupadhyay...@gmail.com wrote:

 IT is the question..
 You are given an N x N matrix with 0 and 1 values. You can swap any two
 adjacent rows of the matrix.

 Your goal is to have all the 1 values in the matrix below or on the main
 diagonal. That is, for each X where 1 ≤ X ≤ N, there must be no 1 values in
 row X

 that are to the right of column X.

 Return the minimum number of row swaps you need to achieve the goal.

 Input

 The first line of input gives the number of cases, T. T test cases follow.
 The first line of each test case has one integer, N. Each of the next N
 lines contains N characters. Each character is either 0 or 1.

 Output

 For each test case, output

 Case #X: K
 where X is the test case number, starting from 1, and K is the minimum
 number of row swaps needed to have all the 1 values in the matrix below or
 on the main

 diagonal.

 You are guaranteed that there is a solution for each test case.

 Limits

 1 ≤ T ≤ 60

 1 ≤ N ≤ 8

 Input


 3
 2
 10
 11
 3
 001
 100
 010
 4
 1110
 1100
 1100
 1000
 Output
 Case #1: 0
 Case #2: 2
 Case #3: 4

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

 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] SPOJ 9199. Circular Track

2011-08-17 Thread Prakash D
any1??

On Sun, Aug 7, 2011 at 7:16 PM, Prakash D cegprak...@gmail.com wrote:

 yeah, i also need to know the approach for this kind of problems asked in
 many places


 On Sun, Aug 7, 2011 at 3:58 PM, arvind kumar arvindk...@gmail.com wrote:

 Hi
 Can any1 pls help me in solving this?
 Two persons are running on a circular track either in the same
 direction or in the opposite direction, indefinitely. The speed of
 both of them is given to you. Speed will be positive in clockwise
 direction, and negative in anticlockwise direction. Print the number
 of distinct points, at which they will meet on the circle.

 --
 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] shop keeper and the buyer

2011-08-14 Thread Prakash D
no one to help ??

On Sat, Aug 13, 2011 at 10:48 PM, Prakash D cegprak...@gmail.com wrote:

 k lets assume that there are 10 kinds of item in the shop
 price[]={10,20,30,40,50,60,70,80,90,100}
 quantity[]={5,5,5,5,5,5,5,5,5,5}

 say no.of items having some free discounts : 5

 say p,q,r denotes  buying q nos. of p we will get one r for free.. let them
 be

 5 4 1
 2 5 1
 8 2 10
 9 1 10
 1 5 10

 explain for this case.. how will u proceed?



 On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani 
 virmanisadi...@gmail.comwrote:

 if k is fixed, sort the items according to their price, buy k cheapest
 items  start taking the most expensive item fr free




-- 
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: shop keeper and the buyer

2011-08-14 Thread Prakash D
@rashmi: there is no confusion for the third item.. so simply u buy all the
third item without any offer

On Mon, Aug 15, 2011 at 12:52 AM, ritu ritugarg.c...@gmail.com wrote:

 solution is as following if problem is buy all the n items for
 minimum price if there are offers so that item j is free if customer
 buys K numbers of item i

 1. create two parallel arrays cost[] (cost[i] = item[i] * K ) and
 free[](free[i] = j )
 2. sort cost[]
 3. now for highest priced item ,check if it freely avilable with any
 lower cost item
 4. add this lower priced item with quantity K to the set
 5. else add single quantity of higher priced item to set.
 6. remove these item from array and similarly repeat for other items

 On Aug 11, 6:19 pm, cegprakash cegprak...@gmail.com wrote:
  there are n number of items available in the shop
  price[] {size n} gives the cost of each item
  and there are quantity[] {size n} means that there are quantity[i]
  number of i'th item
 
  the shop keeper provides some free items
  if you buy k nos of item i, you will get 1 item j for free (i may be
  equal to j)
 
  also there can be such offers for many items
 
  what you have to do is to buy all the items in shop with minimum
  expenditure.
  .
 
  source: own problem (i don't have the solution)

 --
 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] shop keeper and the buyer

2011-08-13 Thread Prakash D
anyone?

On Fri, Aug 12, 2011 at 3:49 AM, cegprakash cegprak...@gmail.com wrote:

 there are n number of items available in the shop
 price[] {size n} gives the cost of each item
 and there are quantity[] {size n} means that there are quantity[i]
 number of i'th item

 the shop keeper provides some free items
 if you buy k nos of item i, you will get 1 item j for free (i may be
 equal to j)

 also there can be such offers for many items

 what you have to do is to buy all the items in shop with minimum
 expenditure.
 .

 source: own problem (i don't have the solution)

 --
 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] what is mean by %2.3d in scanf

2011-08-13 Thread Prakash D
i dont think we can set precision during scanf

On Sat, Aug 13, 2011 at 9:49 PM, Anika Jain anika.jai...@gmail.com wrote:

 @gaurav: nyc one ;) how u made this one well?

 On Sat, Aug 13, 2011 at 6:14 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:

 lol


 On Sat, Aug 13, 2011 at 6:12 PM, Gaurav Menghani 
 gaurav.mengh...@gmail.com wrote:

 http://lmgtfy.com/?q=scanf+float+precision+format

 On Sat, Aug 13, 2011 at 5:42 PM, SuDhir mIsHra
 sudhir08.mis...@gmail.com wrote:
  e g: scanf(%2.4d,a);
 
  --
  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.
 



 --
 Gaurav Menghani

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


  --
 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] shop keeper and the buyer

2011-08-13 Thread Prakash D
k lets assume that there are 10 kinds of item in the shop
price[]={10,20,30,40,50,60,70,80,90,100}
quantity[]={5,5,5,5,5,5,5,5,5,5}

say no.of items having some free discounts : 5

say p,q,r denotes  buying q nos. of p we will get one r for free.. let them
be

5 4 1
2 5 1
8 2 10
9 1 10
1 5 10

explain for this case.. how will u proceed?


On Sat, Aug 13, 2011 at 7:25 PM, Aditya Virmani virmanisadi...@gmail.comwrote:

 if k is fixed, sort the items according to their price, buy k cheapest
 items  start taking the most expensive item fr free

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

2011-08-11 Thread Prakash D
@sagar nice one :D

what u specified above is the scenario in gcc and dev c++ right?

On Fri, Aug 12, 2011 at 1:55 AM, sagar pareek sagarpar...@gmail.com wrote:

 : :))


 On Fri, Aug 12, 2011 at 1:54 AM, aditi garg aditi.garg.6...@gmail.comwrote:

 @sagar.: Now i get it:)
 Thanks a ton :)

 On Fri, Aug 12, 2011 at 1:51 AM, sagar pareek sagarpar...@gmail.comwrote:

 @additi
 in gcc whenever compiler loads first two x's then before multiplying it
 increments x twice for each pre increment
 like if we have
 x=3;
 c=++x*x++;
 here
 it will be done as
 c=4*4
 which is same as
 c=x++*++x;

 is it clear?

 On Fri, Aug 12, 2011 at 1:38 AM, Avenged nitee...@gmail.com wrote:

 Like he said earlier , its a compiler implementation.

 On Aug 12, 12:55 am, aditi garg aditi.garg.6...@gmail.com wrote:
  @sagar: why doesnt it take place sequentially like 4*5*6*7??
  why do the frst two increments take place like dat??
 
 
 
 
 
 
 
 
 
  On Fri, Aug 12, 2011 at 1:19 AM, sagar pareek sagarpar...@gmail.com
 wrote:
   told u before
   in turbo c it increments all values of x
   x=3;
   c=7*7*7*7;
   c=2401
 
   On Fri, Aug 12, 2011 at 1:16 AM, Puneet Chawla 
 puneetchawla...@gmail.comwrote:
 
   In turbo it is showing o/p 2401 again still confused...
 
   On Fri, Aug 12, 2011 at 1:14 AM, sagar pareek 
 sagarpar...@gmail.comwrote:
 
   ok if we have the scenario like u stated then it will be done in
 gcc as
   :-
   x=3;
   c=5*5*(++x)*(++x);
   c=25*6*(++x);
   c=150*7;
   c=1050;
 
   On Fri, Aug 12, 2011 at 1:10 AM, aditi garg 
 aditi.garg.6...@gmail.comwrote:
 
   @sagar: bt i dint understand how is it done
   what if we had something like (++x)*(++x)*(++x)*(++x) thn how wud
 it be
   evaluated in gcc?
   and since it is giving diff ans on diff compilers that is wat i
 mean by
   being undefined...
 
   On Fri, Aug 12, 2011 at 1:05 AM, Puneet Chawla 
   puneetchawla...@gmail.com wrote:
 
   @Aditi i thnk sagar parteek is right ...in turbo compiler it's
   incrementing and finally max of all values and multiply the
 value means pre
   increment-evaluate-postincrement
 
   On Fri, Aug 12, 2011 at 1:02 AM, sagar pareek 
 sagarpar...@gmail.comwrote:
 
   well its always depends on compiler to compiler
   in turbo c it will first increment all x
   results in
   c=6*6*6
   c=216
 
   but in gcc it will be as explained by me above
 
   On Fri, Aug 12, 2011 at 12:56 AM, aditi garg 
   aditi.garg.6...@gmail.com wrote:
 
   i think it wud be undefined...the value is getting modified
 more than
   once and hence violating the sequence points rule...plz corect
 me if im
   wrong...
 
   On Fri, Aug 12, 2011 at 12:48 AM, Puneet Chawla 
   puneetchawla...@gmail.com wrote:
 
   In turbo compiler it's o/p is 216 and in dev it's 150..
   Help me out..
 
   On Fri, Aug 12, 2011 at 12:45 AM, sagar pareek 
   sagarpar...@gmail.com wrote:
 
   after expansion of macro
   it will be c=(++x)*(++x)*(++x);
 
   now it be solved as
c= 5*5*(++x);
   c=25*6;
   c=150
 
   On Fri, Aug 12, 2011 at 12:38 AM, Puneet Chawla 
   puneetchawla...@gmail.com wrote:
 
   #define cube(x) (x)*(x)*(x)
   main()
   {
   int x=3,c;
   c=cube(++x);
   printf(%d,c);
 
   return 0;
   }
 
   will anyone please tell me why o/p is 150.?
 
   --
   With regards
 
   Puneet Chawla
 
--
   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
   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.
 
   --
   With regards
 
   Puneet Chawla
   Computer Engineering Student
   NIT Kurukshetra
 
--
   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.
 
   --
   Aditi Garg
   Undergraduate Student
   Electronics  Communication Divison
   NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
   Sector 3, Dwarka
   New Delhi
 
--
   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
   

Re: [algogeeks] Re: Probability

2011-08-11 Thread Prakash D
total possible outcomes= 6*6*6*6

possibility of sum gives 2 in both pair -- 1*1*1*1 =1
possibility of sum gives 3 in both pair -- 2*1*2*1 =4
{because the possibilities are (1,2)(1,2), (1,2)(2,1), (2,1)(1,2),
(2,1)(2,1)}
possibility of 4 -- 9 { 2,2  1,3 and 3,1}
possibility of 5 -- 16  {1,4 2,3 3,2 4,1}
possibility of 6 -- 25{1,5 2,4 3,3 4,2 5,1}
possibility of 7 -- 36{1,6 2,5 3,4 4,3 5,2 6,1}
possibility of 8 -- 25{2,6 3,5 4,4 5,3 6,2}
9--  16
10 -- 9
11 -- 4
12 -- 1

so probability required = (1+4+9+16+25+36+25+16+9+4+1)/(6*6*6*6)
=146/1296
=73/648

On Fri, Aug 12, 2011 at 1:19 AM, Hurricane ashman...@gmail.com wrote:

 Let f(x)= no. of ways of getting a sum x when pair of dice is thrown.

 S()=sum .

 tot=S( f(i) )  2=i=12

 So the solution is :   S( f(i)*(tot-f(i)) )/(6^4).


 Is daT fine.. ?

 --
 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] Re: Probability

2011-08-11 Thread Prakash D
sorry that was for equal case : for unequal case 1-(73/648)= 575/648

On Fri, Aug 12, 2011 at 2:28 AM, Prakash D cegprak...@gmail.com wrote:

 total possible outcomes= 6*6*6*6

 possibility of sum gives 2 in both pair -- 1*1*1*1 =1
 possibility of sum gives 3 in both pair -- 2*1*2*1 =4
 {because the possibilities are (1,2)(1,2), (1,2)(2,1), (2,1)(1,2),
 (2,1)(2,1)}
 possibility of 4 -- 9 { 2,2  1,3 and 3,1}
 possibility of 5 -- 16  {1,4 2,3 3,2 4,1}
 possibility of 6 -- 25{1,5 2,4 3,3 4,2 5,1}
 possibility of 7 -- 36{1,6 2,5 3,4 4,3 5,2 6,1}
 possibility of 8 -- 25{2,6 3,5 4,4 5,3 6,2}
 9--  16
 10 -- 9
 11 -- 4
 12 -- 1

 so probability required = (1+4+9+16+25+36+25+16+9+4+1)/(6*6*6*6)
 =146/1296
 =73/648


-- 
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] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-11 Thread Prakash D
whats the solution for 3?

On Tue, Aug 9, 2011 at 6:13 PM, Akash Mukherjee akash...@gmail.com wrote:

 @srinivas if any of the characters (i,n,d,a) appear den it is no longer
 readso gujr


 On Tue, Aug 9, 2011 at 6:04 PM, Srinivas Varanasi 
 srinivas4...@gmail.comwrote:

 Can any one explain question number 8?


 On Tue, Aug 9, 2011 at 12:19 PM, Akash Mukherjee akash...@gmail.comwrote:

 @prashant

 devcpp gives an error cannot convert `char (*)[5]' to `char*' in
 initialization

 ne ideas??

 On Mon, Aug 8, 2011 at 12:58 PM, Prashant Kulkarni 
 prashant.r.k...@gmail.com wrote:

 @Mohit

 Output Will be:

 55some chunk value

 Reason: When 'p' is assigning, we are assigning next memory location of
 'ch'. similar we are assigning same memory location to 'q' as well but 
 while
 printing, we are printing the last memory location content of 'ch' (i.e
 p-1) and for 'q' we are printing its starting location so we will some
 garbage value.

 -- Prashant Kulkarni




 On Mon, Aug 8, 2011 at 11:28 AM, Mohit Goel 
 mohitgoel291...@gmail.comwrote:



 can anyone one explain output of question 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
 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.




 --
 srinivas


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


-- 
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] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-11 Thread Prakash D
for 3 i think only b is the true statement

On Fri, Aug 12, 2011 at 3:20 AM, Prakash D cegprak...@gmail.com wrote:

 whats the solution for 3?


 On Tue, Aug 9, 2011 at 6:13 PM, Akash Mukherjee akash...@gmail.comwrote:

 @srinivas if any of the characters (i,n,d,a) appear den it is no longer
 readso gujr


 On Tue, Aug 9, 2011 at 6:04 PM, Srinivas Varanasi srinivas4...@gmail.com
  wrote:

 Can any one explain question number 8?


 On Tue, Aug 9, 2011 at 12:19 PM, Akash Mukherjee akash...@gmail.comwrote:

 @prashant

 devcpp gives an error cannot convert `char (*)[5]' to `char*' in
 initialization

 ne ideas??

 On Mon, Aug 8, 2011 at 12:58 PM, Prashant Kulkarni 
 prashant.r.k...@gmail.com wrote:

 @Mohit

 Output Will be:

 55some chunk value

 Reason: When 'p' is assigning, we are assigning next memory location of
 'ch'. similar we are assigning same memory location to 'q' as well but 
 while
 printing, we are printing the last memory location content of 'ch' (i.e
 p-1) and for 'q' we are printing its starting location so we will some
 garbage value.

 -- Prashant Kulkarni




 On Mon, Aug 8, 2011 at 11:28 AM, Mohit Goel mohitgoel291...@gmail.com
  wrote:



 can anyone one explain output of question 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
 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.




 --
 srinivas


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




-- 
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] how o/p is coming

2011-08-11 Thread Prakash D
@anuj kumar: try this

#includestdio.h
#includestring.h
int main()
   {
   int a=10,b=20;
   char x=1,y=0;
   printf(%d\n,a,b,x,y);
   printf(%d\n,(a,b,x,y));

   if(a,b,x,y)
   {
  printf(EXAM);
   }
   getchar();
   }

this will print 10 and 0
because if the outer bracket is not there, only the first element is
considered it ignores the rest. if there is a bracket it just pushes into
the stack left to right and the last element is considered..

within if, there is no outer brackets but it tries to convert to bool and
statement will execute like if((bool)(a,b,x,y))
so the if condition fails

correct me if i'm wrong

On Thu, Aug 11, 2011 at 5:18 PM, sukran dhawan sukrandha...@gmail.comwrote:

 the output should be blank. because comma is a operator in c which
 associates from left to right. so each of a ,b,x,y is evaluated and y is the
 last one to be evaluated and its value(0) is returned as the value of the
 expression.so the if condition returns false.
 i dont understand how u got that output !


 On Thu, Aug 11, 2011 at 4:29 PM, Prem Krishna Chettri 
 hprem...@gmail.comwrote:

 Yep,

   Ideally, if() statement evaluates the last push stack value from the
 stack and apparently here the last value evaluates to be 0 resulting the
 failure of the if condition.

 Please verify the compilation. :)

 Prem


 On Thu, Aug 11, 2011 at 4:21 PM, hary rathor harry.rat...@gmail.comwrote:

 print nothing , your output is wrong

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


  --
 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] Write a program to find the empirical formulae from physical formulae

2011-08-10 Thread Prakash D
i think the given formula's solution should be

c1  h33 o20 n10
check the question..


On Wed, Aug 10, 2011 at 9:49 PM, vikas mehta...@gmail.com wrote:

 Write a program to find the empirical formulae from physical formulae
 ex: ch3((oh)2(nh3)2)5
 has empirical formulae
 c1 h43 o2 n10

 --
 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] goldman sachs paper

2011-08-10 Thread Prakash D
+1.. it'll be helpful

On Thu, Aug 11, 2011 at 12:12 AM, Prashant Gupta
prashantatn...@gmail.comwrote:

 +1 to deepika.


 On Thu, Aug 11, 2011 at 12:10 AM, deepikaanand swinyanand...@gmail.comwrote:

 can anyone please post the questions asked in goldman sachs this year

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




 --
 Prashant Gupta
 B.Tech Final Year
 Computer Science and Engineering
 NIT Trichy
 Phone : +91 9894462744


  --
 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] Re: max product!

2011-08-09 Thread Prakash D
so you should use absolute values in second part

On Tue, Aug 9, 2011 at 2:20 AM, Dave dave_and_da...@juno.com wrote:

 @Prakash: Yeah, but doesn't the max take care of that?

 Dave

 On Aug 8, 3:07 pm, Prakash D cegprak...@gmail.com wrote:
  yeah.. but the smaller numbers must be negative in first part and largest
  numbers should be of same signs in second part
 
 
 
  On Mon, Aug 8, 2011 at 6:24 PM, Dave dave_and_da...@juno.com wrote:
   max(product of two smallest numbers and largest number, product of
   three largest numbers).

 --
 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] Re: max product!

2011-08-09 Thread Prakash D
yeah, yours is enough :) tried with various combinations.. thanks

On Tue, Aug 9, 2011 at 2:20 AM, Dave dave_and_da...@juno.com wrote:

 @Prakash: Yeah, but doesn't the max take care of that?

 Dave

 On Aug 8, 3:07 pm, Prakash D cegprak...@gmail.com wrote:
  yeah.. but the smaller numbers must be negative in first part and largest
  numbers should be of same signs in second part
 
 
 
  On Mon, Aug 8, 2011 at 6:24 PM, Dave dave_and_da...@juno.com wrote:
   max(product of two smallest numbers and largest number, product of
   three largest numbers).

 --
 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] solve this!

2011-08-09 Thread Prakash D
12C6* 6c3 * 6C2

On Tue, Aug 9, 2011 at 2:10 PM, programming love 
love.for.programm...@gmail.com wrote:

 members

-- 
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] solve this!

2011-08-09 Thread Prakash D
the solution will be 12C6* 6c3 * 6C2

because if you choose 6 people for the left side, then there is no option
for the right side(i.e. we can select only the remaining 6 people for right
side)

also this 12C6 will provide all possible combinations for choosing 6 members
for left or right and there is no need to add these both since this 12C6
include all those possibilities. Correct me if i am wrong


On Tue, Aug 9, 2011 at 5:21 PM, sagar pareek sagarpar...@gmail.com wrote:

 yeah
 sorry  one 2 will be used for either side then auto left and right will be
 fixed.
 thanks for correction


 On Tue, Aug 9, 2011 at 4:39 PM, programming love 
 love.for.programm...@gmail.com wrote:

 got it!
 @sagar there shudn be 2's anywhere in the expression.
 The different combinations formed on the left hand side by choosing 6 out
 of 12 will ensure different combinations of other 6 people on the right. So
 2*12C6 is not required.
 Example:
 P1,P3,P5,P7,P9, P11
 on left will leave
 P2, P4, P6, P8, P10 and P12 on right.
 If 2*12C6 is done, this combination is counted again.

 Please correct me if i'm wrong.

 --
 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
 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] Re: max product!

2011-08-09 Thread Prakash D
cool.. i was lazy to look at your code :P

On Tue, Aug 9, 2011 at 9:32 PM, WgpShashank shashank7andr...@gmail.comwrote:

 @CEG thats what i explained in given link dude isn't it :)

 @punnu  some others we need to find 3 Maxs  2 Mins in 5 passes over array
 we can do it in single pass it self as explained in link time complexity
 will remain O(N)  single pass over over array .Do notify if still anything
 wrong direct through mail ?



 Thanks
 Shashank Mani
 Computer Science
 Birla Institute of Technology,Mesra

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

 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] solve this!

2011-08-09 Thread Prakash D
yeah !! it should be the solution :)

On Tue, Aug 9, 2011 at 9:31 PM, programming love 
love.for.programm...@gmail.com wrote:

 @prakash: Even i thought in the same way. But permutations are not being
 considered in

  12C6* 6c3 * 6C2

 The ques asks for arrangements. Should we multiply by 6! * 6! (1 6! for
 each side)??

 is the answer
 12C6* 6c3 * 6C2 * 6! * 6!??

 On Tue, Aug 9, 2011 at 9:22 PM, Prakash D cegprak...@gmail.com wrote:

 the solution will be 12C6* 6c3 * 6C2

 because if you choose 6 people for the left side, then there is no option
 for the right side(i.e. we can select only the remaining 6 people for right
 side)

 also this 12C6 will provide all possible combinations for choosing 6
 members for left or right and there is no need to add these both since this
 12C6 include all those possibilities. Correct me if i am wrong


 On Tue, Aug 9, 2011 at 5:21 PM, sagar pareek sagarpar...@gmail.comwrote:

 yeah
 sorry  one 2 will be used for either side then auto left and right will
 be fixed.
 thanks for correction


 On Tue, Aug 9, 2011 at 4:39 PM, programming love 
 love.for.programm...@gmail.com wrote:

 got it!
 @sagar there shudn be 2's anywhere in the expression.
 The different combinations formed on the left hand side by choosing 6
 out of 12 will ensure different combinations of other 6 people on the 
 right.
 So 2*12C6 is not required.
 Example:
 P1,P3,P5,P7,P9, P11
 on left will leave
 P2, P4, P6, P8, P10 and P12 on right.
 If 2*12C6 is done, this combination is counted again.

 Please correct me if i'm wrong.
  --
 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
 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.


  --
 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] Probability question.. help

2011-08-09 Thread Prakash D
is there any constraint for anyone to dance?

-- 
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] o/p

2011-08-09 Thread Prakash D
@rajkumar: thanks

#include stdio.h

#define max(a,b) ((ab)?a:b)
int main()
{
 int m,n;
 m=3+max(2,3);
 n=2*max(3,2);
 printf(%d,%d,m,n);

getchar();
return 0;
}

this gives the correct output as 6,6



On Mon, Aug 8, 2011 at 7:12 PM, Dipankar Patro dip10c...@gmail.com wrote:

 relational operators give 0/1 output;
 (ab) - will be either 0 or 1.
 similarly (a==b) will either be 0 or 1


 On 8 August 2011 18:39, Anil Arya anilarya...@gmail.com wrote:

 in expression (ab)?a:b---(ab) returns 1 if true  and  0 if
 (false) .



 On Mon, Aug 8, 2011 at 6:08 PM, dilip makwana dilipmakwa...@gmail.comwrote:

 Since test condition will always evaluate to non-zero value (which is
 considered true in c/c++) hence always first option get selected 


 On 8 August 2011 17:44, Shachindra A C sachindr...@gmail.com wrote:

 oops...I'm sorry.. the statement would evaluate to 3 + *0* ? 2 : 3 ==
 *3* ? 2 : 3 == m = 2.


 On Mon, Aug 8, 2011 at 5:43 PM, Shachindra A C 
 sachindr...@gmail.comwrote:

 @raj,
  the preprocessed file would contain m=3+(23)?2:3 AFAIK.

  So, the statement would evaluate to 3 + 1 ? 2 : 3 == 4 ? 2 :
 3 == m = 2.

  Likewise for n.


  On Mon, Aug 8, 2011 at 5:21 PM, raj kumar megamonste...@gmail.comwrote:

 3+23?2:3
 so 53 hence 2 is returned bcoz of higher precedence of + over ?
 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.




 --
 Regards,
 Shachindra A C




 --
 Regards,
 Shachindra A C

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




 --
 *Dilip Makwana*
 VJTI
 BTech Computers Engineering
 2009-2013

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




 --
 Anil Kumar Arya
 B.Tech  III year
 computer science  engineering
 M.N.N.I.T 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

  --
 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] Re: Probability Puzzle

2011-08-09 Thread Prakash D
@dave: thank you.. nice explanation :)

On Wed, Aug 10, 2011 at 3:24 AM, Dave dave_and_da...@juno.com wrote:

 @Ritu: We are flipping one coin five times. Are you saying that you
 don't learn anything about the coin by flipping it? Would you learn
 something if any one of the five flips turned up tails? After a tails,
 would you say that the probability of a subsequent head is still 3/5?

 Dave

 On Aug 9, 11:19 am, ritu ritugarg.c...@gmail.com wrote:
  The statement You randomly pulled one coin from the bag and tossed
  tells that all the  events of tossing the coin are independent hence
  ans is 3/5
 
  On Aug 7, 10:34 pm, Algo Lover algolear...@gmail.com wrote:
 
 
 
   A bag contains 5 coins. Four of them are fair and one has heads on
   both sides. You randomly pulled one coin from the bag and tossed it 5
   times, heads turned up all five times. What is the probability that
   you toss next time, heads turns up. (All this time you don't know you
   were tossing a fair coin or not).

 --
 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] Probability question.. help

2011-08-09 Thread Prakash D
is there anything like there should be atleast one man and one women should
dance together?


On Wed, Aug 10, 2011 at 2:26 AM, Shuaib Khan aries.shu...@gmail.com wrote:



 On Wed, Aug 10, 2011 at 1:45 AM, Brijesh Upadhyay 
 brijeshupadhyay...@gmail.com wrote:

 No thers is not.. someone has asked me this., dont know anything else
 about the question  :|


 Seems like you got half of the question there.


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

 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.




 --
 Shuaib
 http://www.bytehood.com
 http://twitter.com/ShuaibKhan

  --
 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] Re: max product!

2011-08-08 Thread Prakash D
simple soln = max( product of lowest two negative numbers and highest
positive number, product of highest three negative numbers, product of
highest three positive numbers)


On Mon, Aug 8, 2011 at 4:50 PM, Aditya Virmani virmanisadi...@gmail.comwrote:

 what if we can maintain three arrays:
 large_positives[3]: containing three largest positive numbers.,
 large_negatives[2]: negative numbers with largest magnitude,
 small_negatives[3]: negative numbers with least magnitudes.
 Now thr may be following cases:
 1) No. of postive numbers 3  no. of negative numbers=2, thn max product
 cud be, product of numbers in large_positives or product of largest positive
 number with numbers in large_negatives.
 2) No. of positive numbers is 0(i.e all negatives), max product wud be
 product of numbers in small_negatives.
 3)No. of positives is 1(though not required explicitly), product of numbers
 in large_negatives with positive number.
 4) No. of positives is 2: max product wud be max of, product of two
 positive numbers with small_negative or product of small_negatives.
 Time complexity: O(n)
 Space complexity: O(1)
 I hope all the cases are covered, if not, please correct me


 On Mon, Aug 8, 2011 at 4:40 PM, Aditya Virmani 
 virmanisadi...@gmail.comwrote:

 what if the input is all negative?

 On Mon, Aug 8, 2011 at 12:57 PM, WgpShashank 
 shashank7andr...@gmail.comwrote:

 hey guys I think we can do it in O(N) Check out

 http://shashank7s.blogspot.com/2011/07/find-three-numbers-in-array-which-forms.html

  let me know missed something ?

 Thanks
 Shashank
 CSE,BIT Mesra

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

 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.



Re: [algogeeks] help--code

2011-08-08 Thread Prakash D
@gaurav: are u sure?

On Mon, Aug 8, 2011 at 3:40 PM, Amir pkpat...@gmail.com wrote:

 Both Will take same time.

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

 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] o/p

2011-08-08 Thread Prakash D
how 2,3 any idea??

On Mon, Aug 8, 2011 at 5:09 PM, raj kumar megamonste...@gmail.com wrote:

 I think you forgot to give a space between macro and it's expansion that's
 why
 max(a,b)(ab)?a:b
 is getting expanded to null
 and the above result

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

2011-08-08 Thread Prakash D
for 5th one loop will terminate only when n=0 which is not possible i think


On Mon, Aug 8, 2011 at 10:58 PM, D!leep Gupta dileep.smil...@gmail.comwrote:

 yup 1st ans is b.


 On Sat, Aug 6, 2011 at 10:12 PM, sukran dhawan sukrandha...@gmail.comwrote:

 i think 1st one is b.not sure. can anybody correct 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.




 --
 Dileep Kumar
 Computer Science  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] Re: max product!

2011-08-08 Thread Prakash D
yeah.. but the smaller numbers must be negative in first part and largest
numbers should be of same signs in second part


On Mon, Aug 8, 2011 at 6:24 PM, Dave dave_and_da...@juno.com wrote:

 max(product of two smallest numbers and largest number, product of
 three largest numbers).


-- 
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] max product!

2011-08-07 Thread Prakash D
that won't work.. there may be two negative bigger numbers whose product
will bcom +ve

On Sun, Aug 7, 2011 at 6:49 PM, Puneet Ginoria punnu.gino...@gmail.comwrote:

 find the first three largest nos. and 3 smallest number(negatives).. then
 easily you can fig. out the solution..

 O(6n) solution i guess which is O(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
 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] max product!

2011-08-07 Thread Prakash D
nice 1

On Sun, Aug 7, 2011 at 7:10 PM, shady sinv...@gmail.com wrote:

 simple manipulation
 ans = max( (smallest negative number 1 * smallest negative number 2 *
 largest positive number 1), (largest positive number 1, largest positive
 number 2, largest positive number 3) )


 On Sun, Aug 7, 2011 at 7:04 PM, Prakash D cegprak...@gmail.com wrote:

 that won't work.. there may be two negative bigger numbers whose product
 will bcom +ve


 On Sun, Aug 7, 2011 at 6:49 PM, Puneet Ginoria 
 punnu.gino...@gmail.comwrote:

 find the first three largest nos. and 3 smallest number(negatives).. then
 easily you can fig. out the solution..

 O(6n) solution i guess which is O(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
 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.


-- 
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] SPOJ 9199. Circular Track

2011-08-07 Thread Prakash D
yeah, i also need to know the approach for this kind of problems asked in
many places

On Sun, Aug 7, 2011 at 3:58 PM, arvind kumar arvindk...@gmail.com wrote:

 Hi
 Can any1 pls help me in solving this?
 Two persons are running on a circular track either in the same
 direction or in the opposite direction, indefinitely. The speed of
 both of them is given to you. Speed will be positive in clockwise
 direction, and negative in anticlockwise direction. Print the number
 of distinct points, at which they will meet on the circle.

 --
 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] Re: MS test

2011-08-07 Thread Prakash D
@siddharam: for the second one, the series is like this

the first character will print once.
second one twice
third one four times and so on

1,2,4,8,...

On Sun, Aug 7, 2011 at 4:53 PM, Dave dave_and_da...@juno.com wrote:

 6.5 = 2^2 + 2^1 + 2^-1
 Binary representation = 110.1 = 1.101 * 2^2.

 0.1 = 2^-3 + 2^-4 + 2^-7 + 2^-8 + 2^-11 + 2^-12 + ...
 Binary representation = 0.001100110011... = 1.10010011... * 2^-3.

 Dave

 On Aug 7, 1:18 am, ankit sambyal ankitsamb...@gmail.com wrote:
  @programming love : 0.1 can't be represented accurately in binary. If u
 try
  to convert it into binary, it will not terminate. Try it !!  But 6.5 can
 be
  converted.

 --
 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] Re: MS test

2011-08-07 Thread Prakash D
any idea for 5th one?

On Sun, Aug 7, 2011 at 7:50 PM, Prakash D cegprak...@gmail.com wrote:

 @siddharam: for the second one, the series is like this

 the first character will print once.
 second one twice
 third one four times and so on

 1,2,4,8,...

 On Sun, Aug 7, 2011 at 4:53 PM, Dave dave_and_da...@juno.com wrote:

 6.5 = 2^2 + 2^1 + 2^-1
 Binary representation = 110.1 = 1.101 * 2^2.

 0.1 = 2^-3 + 2^-4 + 2^-7 + 2^-8 + 2^-11 + 2^-12 + ...
 Binary representation = 0.001100110011... = 1.10010011... * 2^-3.

 Dave

 On Aug 7, 1:18 am, ankit sambyal ankitsamb...@gmail.com wrote:
  @programming love : 0.1 can't be represented accurately in binary. If u
 try
  to convert it into binary, it will not terminate. Try it !!  But 6.5 can
 be
  converted.

 --
 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] Re: probablity

2011-08-07 Thread Prakash D
The solution is 5/6 for sure


the possible outcomes after a blue is chosen are

blue   1 1 0
black  0 1 2

and

blue   2 0 0
black  0 1 2

prob of choosing a blue from 1st possibility = 1/3+1/6

prob of choosing a blue from 2nd possibility= 1/3

so totally there are 5/6 possibilities



On Sun, Aug 7, 2011 at 3:05 PM, Kunal Yadav kunalyada...@gmail.com wrote:

 Agree with puneet completely. After first blue pen, only possible outcomes
 are blue or black and hence 1/2.


 On Sat, Aug 6, 2011 at 12:28 AM, Puneet Goyal puneetgoya...@gmail.comwrote:


 @shiv : you are considering the case when you need to know the probability
 of both pens being blue, but in the question you already know that 1st one
 is blue so you dont need to care about it, and also the 3rd packet getting
 eliminated coz of it increases the probability to 1/2

 --
 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
 Kunal Yadav
 (http://algoritmus.in/)

  --
 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] Sum from array

2011-08-07 Thread Prakash D
is there a faster algo than O(n^2)?

On Sun, Aug 7, 2011 at 4:14 PM, raj kumar megamonste...@gmail.com wrote:

 similar to make change dp problem

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

2011-08-07 Thread Prakash D
counting sort with hashing

On Sun, Aug 7, 2011 at 10:23 AM, rahul rai raikra...@gmail.com wrote:

 Thats True , Even insertion and merge sorts are too ..

 !!!


 Rahul


 On Sun, Aug 7, 2011 at 10:20 AM, Gaurav Menghani 
 gaurav.mengh...@gmail.com wrote:

 The Postman's sort is a variant of bucket sort that takes advantage
 of a hierarchical structure of elements, typically described by a set
 of attributes.

 It is just a variant of Bucket Sort.

 On Sun, Aug 7, 2011 at 12:42 AM, rahul rai raikra...@gmail.com wrote:
  http://www.rrsd.com/software_development/postmans_sort/cuj/cuj.htm
 
  On 8/5/11, Gaurav Menghani gaurav.mengh...@gmail.com wrote:
  I agree with Dilip. It depends upon what type of input you have at
 hand.
 
  - Suppose you have an array having a million elements, where the
  elements are in the range 1-3, counting sort would be perfect.
  - However, if the range is from -10^18 to +10^18, counting sort, which
  requires O(R) memory, where R is the range of the elements, would be
  laughable. Here quick-sort or merge-sort would be better.
 
  Again, quick-sort is good for randomized inputs, such that the pivot
  lies roughly in the middle of every sub-array. For certain inputs, the
  performance of quick-sort degrades to O(N^2). For this reason, the
  default implementation of sort function in STL, uses 'Intro-Sort' [0]
  which is a combination of quick-sort and heap-sort (switches between
  the two depending upon the input)
 
  [0] http://en.wikipedia.org/wiki/Introsort
 
  On Fri, Aug 5, 2011 at 6:54 AM, dilip makwana dilipmakwa...@gmail.com
 
  wrote:
  But beware all linear sort algo have some prior constraints (such as
 range
  of input is predefined or such ...)
  So choose one properly 
 
  On 4 August 2011 23:12, Samba Ganapavarapu sambasiv...@gmail.com
 wrote:
 
  Merget Sort sorts  O(n log n) time,
  Counting sort, Radix sort sorts in O (n) time...
 
 
  On Thu, Aug 4, 2011 at 1:40 PM, Rohit jalan jalanha...@gmail.com
 wrote:
 
  Merge Sort
 
  On Thu, Aug 4, 2011 at 11:09 PM, parag khanna 
 khanna.para...@gmail.com
  wrote:
 
  Which is fastest sorting method?
 
  --
  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 :
  ROHIT JALAN
  B.E. Graduate,
  Computer Science Department,
  RVCE, Bangalore
 
  --
  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.
 
 
 
  --
  Dilip Makwana
  VJTI
  BTech Computers Engineering
  2009-2013
 
  --
  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.
 
 
 
 
  --
  Gaurav Menghani
 
  --
  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.
 
 
 
 
  --
  Rahul
 
  --
  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.
 
 



 --
 Gaurav Menghani

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

Re: [algogeeks] Re: probablity

2011-08-07 Thread Prakash D
@shady: i'll explain it clearly

the possible outcomes after a blue is chosen are

   blue  black
packet1   1  0
packet2   1  1
packet3   0  2

and

blue black
packet1   2  0
packet2   0  1
packet3   0  2


prob of choosing a blue from 1st possibility = 1/3*1 +  1/3*1/2  + 1/3*0 =
1/2

prob of choosing a blue from 2nd possibility= 1/3* 1 + 1/3*0 + 1/3* 0 = 1/3

so totally there are 5/6 possibilities

On Mon, Aug 8, 2011 at 12:05 AM, shady sinv...@gmail.com wrote:

 no it is 1/2


 On Sun, Aug 7, 2011 at 9:14 PM, Prakash D cegprak...@gmail.com wrote:

 The solution is 5/6 for sure


 the possible outcomes after a blue is chosen are

 blue   1 1 0
 black  0 1 2

 and

  blue   2 0 0
 black  0 1 2

 prob of choosing a blue from 1st possibility = 1/3+1/6

 prob of choosing a blue from 2nd possibility= 1/3

 so totally there are 5/6 possibilities



 On Sun, Aug 7, 2011 at 3:05 PM, Kunal Yadav kunalyada...@gmail.comwrote:

 Agree with puneet completely. After first blue pen, only possible
 outcomes are blue or black and hence 1/2.


 On Sat, Aug 6, 2011 at 12:28 AM, Puneet Goyal 
 puneetgoya...@gmail.comwrote:


 @shiv : you are considering the case when you need to know the
 probability of both pens being blue, but in the question you already know
 that 1st one is blue so you dont need to care about it, and also the 3rd
 packet getting eliminated coz of it increases the probability to 1/2

 --
 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
 Kunal Yadav
 (http://algoritmus.in/)

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


  --
 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] Re: probablity

2011-08-07 Thread Prakash D
@ all: am sorry.. i din't saw the word same packet.. so the prob of
choosing a blue from 2nd possibility is 0 and so totally there are 1/2
possibilities

-- 
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: Probability Puzzle

2011-08-07 Thread Prakash D
no fight.. lets mention both the answers :D

On Mon, Aug 8, 2011 at 1:19 AM, Shuaib Khan aries.shu...@gmail.com wrote:



 On Mon, Aug 8, 2011 at 12:47 AM, aseem garg ase.as...@gmail.com wrote:

 Think it like this. I have tossed a coin 5 times and it showed heads all
 the times. What is the probabilty of it shoing a HEADS now?
 Aseem


 Well you are thinking about it the wrong way. Question asks that what is
 the probability that heads will show up the first five times, plus a sixth
 time. Not just the sixth time. The first five times head showing up is part
 of the question.






 On Mon, Aug 8, 2011 at 1:12 AM, Shuaib Khan aries.shu...@gmail.comwrote:



 On Mon, Aug 8, 2011 at 12:40 AM, Puneet Gautam 
 puneet.nsi...@gmail.comwrote:

 Sixth toss is independent of previous tosses and dependent only on
 coin selection...!

 1/5 + 4/5(1/2)= 3/5

 is the correct answer

 we want to calc. probability of getting heads the sixth time only
 even if it would have been 100 th time...3/5 would be the answer
 only..


 It is not independent. Re read the question. The first five times, it HAS
 to be heads.


 On 8/8/11, Prakash D cegprak...@gmail.com wrote:
  1.) coin is fair
  2.) coin is unfair
 
  P(head) for unfair coin= 1/5 * 1= 1/5
  P(head) for fair coin= 4/5* 1/2 = 2/5
 
 
  the probability at any instant that the tossed coin is a head is 3/5
 
  17/80 is the probability to get head at all the six times.
 
  the soln. for this problem will be 3/5
 
  On Mon, Aug 8, 2011 at 12:45 AM, aseem garg ase.as...@gmail.com
 wrote:
 
  If the coin is unbiased then probability of heads: 1/2 irrespective
 of
  whether it is first time or nth time. So answer should be 3/5.
  Aseem
 
 
 
  On Mon, Aug 8, 2011 at 12:39 AM, saurabh chhabra
  saurabh131...@gmail.comwrote:
 
  Even u dont get why u people are gettin 17/80...the probability that
  it will be a head 6th time will be same as the frst time...so it
 shud
  be 3/5...
 
  On Aug 7, 11:05 pm, Kunal Yadav kunalyada...@gmail.com wrote:
   @algo: We can get head in two cases:-
  
   1.) coin is biases
   2.) coin is not biased
  
   P(head) for biased= 1/5 *1*1*1*1*1*1= 1/5
   P(head) for unbiased= 4/5*(1/2)^6
   hence combined probability is what nitish has already mentioned.
 Hope
  you
   get the point.
  
  
  
  
  
  
  
  
  
   On Sun, Aug 7, 2011 at 11:29 PM, Algo Lover 
 algolear...@gmail.com
  wrote:
Can anyone explain the approach how to solve this .
I think all tosses are independent so it should be 3/5. why is
 this
  in-
correct
  
On Aug 7, 10:55 pm, saurabh chhabra saurabh131...@gmail.com
 wrote:
 sry...its wrong
  
 On Aug 7, 10:34 pm, Algo Lover algolear...@gmail.com wrote:
  
  A bag contains 5 coins. Four of them are fair and one has
 heads
  on
  both sides. You randomly pulled one coin from the bag and
 tossed
  it 5
  times, heads turned up all five times. What is the
 probability
  that
  you toss next time, heads turns up. (All this time you don't
 know
  you
  were tossing a fair coin or not).
  
--
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
   Kunal Yadav
   (http://algoritmus.in/)
 
  --
  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.
 
 
  --
  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.




 --
 Shuaib
 http://www.bytehood.com
 http://twitter.com

Re: [algogeeks] Amazon Question

2011-08-03 Thread Prakash D
someone post all the questions asked by amazon pls.. it'll be useful

On Wed, Aug 3, 2011 at 3:43 PM, Arun Vishwanathan aaron.nar...@gmail.comwrote:

 it cud also be 0011


 On Wed, Aug 3, 2011 at 6:54 AM, payel roy smithpa...@gmail.com wrote:

 It is contiguous ...the answer will be 0110.


 On 2 August 2011 20:59, ankit sambyal ankitsamb...@gmail.com wrote:

 @payel : Is it sub-sequence or sub-array ??  A sub-sequence may not be
 continuous but a sub-array must be continuous. eg : What wud be the answer
 for-  100110 ??

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






  --
 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] Max subarray of no 2 adjacent elements

2011-08-03 Thread Prakash D
yeah.. it's 15!

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

 i think the answer should be 15


 On Mon, Aug 1, 2011 at 12:46 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:

 let the array be A={ 3,5,7,10} then it should give output as 13 (3+10)

 In short, we need to find the possible maximum sum such that no 2 elements
 in the subarray has 2 elements adjacent. there is no bound on the size of
 subarray.
 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

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


-- 
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: Re: [algogeeks] aptitude

2011-08-03 Thread Prakash D
I dont get this part of your proof.. :(.

Y-X is a fraction so it's not valid assumption.

On Wed, Aug 3, 2011 at 9:57 PM, D!leep Gupta dileep.smil...@gmail.comwrote:

 Y-X is a fraction so it's not valid assumption.

-- 
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: Amazon Aptitude questions

2011-08-03 Thread Prakash D
assume there are 6 1's and 6 0's

if two are selected together randomly
the possible outcomes are 00, 11, 01, 10

00- 30 possibilities
11 - 30 possibilities

10 - 36 possibilities
01 - 36 possibilities


probability of 10  or 01 =  (36+36)/(30+30+36+36)

=18/31

 is it one of the options?


On Wed, Aug 3, 2011 at 10:28 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 there is no error in first question ... u thik so.. correct me if wrong ...


 On Wed, Aug 3, 2011 at 10:26 PM, Kamakshii Aggarwal kamakshi...@gmail.com
  wrote:

 i think dere is nothing wrong in ques 1.is there any error?


 On Wed, Aug 3, 2011 at 9:46 PM, cegprakash cegprak...@gmail.com wrote:

 2 is pretty easy..

 3: both

 5: 6/12 * 6/11  = 3/11

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




 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

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




 --
 JaiDev Yadav
 (National Yoga Champion)
 Computer Engg. Dept.
 National Institute of Technology
 Kurukshetra,Haryana

  --
 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] Re: Amazon Aptitude questions

2011-08-03 Thread Prakash D
18/33?

On Wed, Aug 3, 2011 at 10:42 PM, muthu raj muthura...@gmail.com wrote:

 5)
 Sample space=24C2= 276
 N(S) = 12 C 2 + 12 C 2 =132

 Probability= 132/276= 11/23


 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*



 On Wed, Aug 3, 2011 at 10:36 PM, Prakash D cegprak...@gmail.com wrote:

 assume there are 6 1's and 6 0's

 if two are selected together randomly%
 the possible outcomes are 00, 11, 01, 10

 00- 30 possibilities
 11 - 30 possibilities

 10 - 36 possibilities
 01 - 36 possibilities


 probability of 10  or 01 =  (36+36)/(30+30+36+36)

 =18/31

  is it one of the options?


 On Wed, Aug 3, 2011 at 10:28 PM, JAIDEV YADAV jaid...@gmail.com wrote:

 there is no error in first question ... u thik so.. correct me if wrong
 ...


 On Wed, Aug 3, 2011 at 10:26 PM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 i think dere is nothing wrong in ques 1.is there any error?


 On Wed, Aug 3, 2011 at 9:46 PM, cegprakash cegprak...@gmail.comwrote:

 2 is pretty easy..

 3: both

 5: 6/12 * 6/11  = 3/11

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




 --
 Regards,
 Kamakshi
 kamakshi...@gmail.com

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




 --
 JaiDev Yadav
 (National Yoga Champion)
 Computer Engg. Dept.
 National Institute of Technology
 Kurukshetra,Haryana

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


  --
 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] Re: Amazon Aptitude questions

2011-08-03 Thread Prakash D
i din't look at the word pair :P.. sorry

-- 
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: MS [Written Question]

2011-08-03 Thread Prakash D
@Gene: nice one :D

On Wed, Aug 3, 2011 at 11:02 PM, sagar pareek sagarpar...@gmail.com wrote:

 same questions...not a single diff were asked in NIT allahabad on 17 july
 this yr...


 On Wed, Aug 3, 2011 at 8:21 PM, Vengadanathan fantastic.n...@gmail.comwrote:

 It may not work for all , the parameter input is double what happens
 if the user gives a number greater the range of int datatype , in the
 return statement during type casting overflow in int occurs and wrong
 value is returned .
 check this
 http://www.ideone.com/oZbCf
 i have given the input as 2147483649 which is one greater the range of
 int .. check the output ...

 On Aug 3, 6:26 pm, Ashish Sachdeva ashish.asachd...@gmail.com wrote:
  @poised:
  i think this:
 
  double round(double num)
  { return (int)(num+0.5)
 
  }
 
  works for all...http://www.ideone.com/WfEIw
 
  On Aug 3, 5:45 pm, Gene gene.ress...@gmail.com wrote:
 
 
 
 
 
 
 
   Your solution to 1 works fine. I hope you get the job. But it needs
   O(N) additional storage for the stack. You can also do with constant
   additional storage.
 
   #include stdio.h
   int main(void)
   {
   #define N (sizeof a / sizeof a[0])
 int a[] = {7, 9, 4, 8, 2};
 int result[N], i, product;
 for (i = 0, product = 1; i  N; product *= a[i++])
   result[i] = product;
 for (i = N - 1, product = 1; i = 0; product *= a[i--])
   result[i] *= product;
 for (i = 0; i  N; i++)  printf(%d , result[i]);
 printf(\n);
 return 0;
 
   }
 
   On Aug 3, 7:08 am, Poised~ dip10c...@gmail.com wrote:
 
I am not looking for answer. Just sharing these Section 2 questions:
 
1. Given an array arr[] of n integers, construct a Product Array
 prod[] (of
same size) such that prod[i] is equal to the product of all the
 elements of
arr[] except arr[i]. Solve it without division operator. Give an
 efficient
code.
(if you are interested, here is my solution:http://ideone.com/EaTUF
 ,
developed at the test time itself).

 --
 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
 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] Re: Amazon Aptitude questions

2011-08-03 Thread Prakash D
no.. it's really easy to find it out

there are 12 black and 12 white pieces.

let black =1  and white =0

the possible results are 11, 00, 10, 01


number of ways of 11 solutions=  12 * 11 =  132
number of ways of 00 solutions = 12 * 11 = 132
number of ways of 10 solutions = 12 * 12 = 144
number of ways of 01 solutions = 12 * 12 = 144


we need the prob of 10 + prob 01 ==  (144+144)/(132+ 132 + 144 + 144)

=288/552 =  36/69 = 12/23

I think 11/23 is wrong

-- 
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: Algorithm complexity

2011-08-03 Thread Prakash D
lol.. nice one :D

On Thu, Aug 4, 2011 at 12:30 AM, Don dondod...@gmail.com wrote:

n = log(log(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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Max subarray of no 2 adjacent elements

2011-08-01 Thread Prakash D
i can write a O(n^2) soln. but i hope there could be a better way

On Mon, Aug 1, 2011 at 12:46 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:

 let the array be A={ 3,5,7,10} then it should give output as 13 (3+10)

 In short, we need to find the possible maximum sum such that no 2 elements
 in the subarray has 2 elements adjacent. there is no bound on the size of
 subarray.
 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread Prakash D
you cannot choose 7 and 10 since they are adjacent

On Mon, Aug 1, 2011 at 1:17 PM, Prakash D cegprak...@gmail.com wrote:

 i can write a O(n^2) soln. but i hope there could be a better way


 On Mon, Aug 1, 2011 at 12:46 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:

 let the array be A={ 3,5,7,10} then it should give output as 13 (3+10)

 In short, we need to find the possible maximum sum such that no 2 elements
 in the subarray has 2 elements adjacent. there is no bound on the size of
 subarray.
 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread Prakash D
I just thought of an O(n) dp solution

let a[]=5,2,1,7,9,11

traverse from i=0 to n-1

we define arr[i]= a[i]+max(arr[i-2],arr[i-3));


first arr[0]= 5 + max( a[-2], a[-3]) = 5

arr[1]= 2

arr[2]=1 + 5

arr[3]= 7 + max(5,2) = 7+ 5 = 12

then arr[4]= 9 + max(2,6) = 15

then arr[5]= 11 + max(6,12) = 11+12 = 23


now soln= max( arr[n-1], arr[n-2]) = 23


hope i'm correct ..


regards,

D.Prakash,
IT, IIIrd year, CEG.





On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:

 @Prakash
 can you post your solution please


 On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:

 @Kartik

 we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we will
 have 5+7+11
 can any one give any algo for this
 thank you


 On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan kartik.sac...@gmail.comwrote:

 oh..got it i didn't read that statement:(

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




 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela




 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 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] Re: FB intern

2011-07-31 Thread Prakash D
what does n mod 2's job here?

the only possible return case is when n/2 is 0 or 1



On Sat, Jul 30, 2011 at 2:04 PM, saurabh singh saurab...@gmail.com wrote:

 And yes the formula is derived by the fact that x^(a+b)=x^a*x^b
 and then think top down with respect to a general variable n.(That is how
 to split n in the most efficient way such that a+b=n)
 Thats how I reached to the solution.


 On Sat, Jul 30, 2011 at 2:01 PM, saurabh singh saurab...@gmail.comwrote:

 Its the method of going mad over optimizing ur solution till it satisfies
 ur heart :)
 There is no hard and fast rule.(If there is i am not aware)


 On Sat, Jul 30, 2011 at 1:59 PM, rShetty rajeevr...@gmail.com wrote:

 @amol and saurabh : How exactly is that formula derived for this
 problem ?
 I need to know the method to evaluate such problems in the future .
 Thank you

 On Jul 30, 1:13 pm, saurabh singh saurab...@gmail.com wrote:
  Thanx mate...You rock.:)
 
 
 
 
 
 
 
 
 
  On Sat, Jul 30, 2011 at 1:40 PM, Amol Sharma amolsharm...@gmail.com
 wrote:
   i think saurabh you wanted to say this --
 
   x^n=pow(x^n/2)*pow(x^n/2)*(x^(*n*mod2))
   --
 
   Amol Sharma
   Third Year Student
   Computer Science and Engineering
   MNNIT Allahabad
 
   On Sat, Jul 30, 2011 at 1:10 PM, Ankur Khurana 
 ankur.kkhur...@gmail.comwrote:
 
   use divide and conquer  . logm complexity . . .
 
   On Sat, Jul 30, 2011 at 1:09 PM, saurabh singh saurab...@gmail.com
 wrote:
 
   o(log n)
   x^n=pow(x^n/2)*pow(x^n/2)*(x^mod2)
 
   the base case pow(x,1)=x  pow(x,0)=1
 
   On Sat, Jul 30, 2011 at 1:02 PM, arvind kumar 
 arvindk...@gmail.comwrote:
 
   Find the least time complexity algorithm(most efficient algo) to
 find
   x^m(x to the power of m)..Facebok intern interview question!
 
   --
   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.
 
   --
   Saurabh Singh
   B.Tech (Computer Science)
   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 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.
 
   --
   Ankur Khurana
   Computer Science
   Netaji Subhas Institute Of Technology
   Delhi.
 
--
   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.
 
  --
  Saurabh Singh
  B.Tech (Computer Science)
  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 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.




 --
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT ALLAHABAD





 --
 Saurabh Singh
 B.Tech (Computer Science)
 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 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] Re: FB intern

2011-07-31 Thread Prakash D
@priyanka : thank you

On Sun, Jul 31, 2011 at 3:17 PM, saurabh singh saurab...@gmail.com wrote:

 yup you are right.prakash try some cases and you will get why its
 necessary.
 (Yup i agree can be written in an if else way but i like it this way
 better)


 On Sun, Jul 31, 2011 at 2:08 PM, priyanka raju priyark...@gmail.comwrote:


 tats bcos...
 if it is a^21...
 it will be (a^21/2)*(a^21/2)*(a^21mod2)
 = (a^10)*(a^10)*(a^1)
 correct me if i'm wrong
 --
 cheers
 priyanka

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




 --
 Saurabh Singh
 B.Tech (Computer Science)
 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 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] Re: MICROSOFT!!!!

2011-07-25 Thread Prakash D
thank you all for the gcd algo

1) is the solution is 2 3 5 2 ?

2) it will not work for double values which is beyond integer range!!


3) this will  find the number of 1's in binary representation of x^y..
right?


someone explain the CFG question plz..


On Sat, Jul 23, 2011 at 5:58 PM, arun kumar kumar0...@gmail.com wrote:

 Anna university,chennai

 On Sat, Jul 23, 2011 at 5:52 PM, saurabh singh saurab...@gmail.com
 wrote:
  where it was written?We had the same question in our MS exam and it was
  never mentioned so.
 
  On Sat, Jul 23, 2011 at 5:46 PM, arun kumar kumar0...@gmail.com wrote:
 
  the question was for positive number only.:)
 
  On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com
  wrote:
   2 will fail for negatve numbers.
  
   On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:
  
   thanks a lot arun :)
  
   On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com
   wrote:
  
   @ shady:the algo posted by naveen ms is better than eulicd algorithm
   to find gcd. for more details refer
   http://en.wikipedia.org/wiki/Binary_GCD_algorithm
  
   On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
gcd can always be found in O(log(larger number)) using Euclidean
algorithms
, couldn't understand the complexity in that  what's the
 meaning
of
O(log UV)^2 ?
   
On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana
dilipmakwa...@gmail.com
wrote:
   
@Akshata Sharma
   
(2) double full(double a)
{
   return (int)(a+0.5);
}
   
I tried this on DevC++ , with various inputs ; it is working fine

   
On 23 July 2011 17:00, Akshata Sharma akshatasharm...@gmail.com
 
wrote:
   
What about (2)?, will it always work?
   
On Sat, Jul 23, 2011 at 3:13 AM, prasanth
prasanth270...@gmail.com
wrote:
   
   
the CFG was actually
s-AB
A- a| BaB
B-bbA
   
The false statement i guess was This grammar doesnt produce a
string
of 4 consecutive bs
   
   
and 2 or 3 questions mainly focused on j=j-1 guess this unsets
the
rightmost set bit
   
   
pointer related questions were asked.One such was
   
(1)int arr[2][3]={{1,2,3},{4,5,6}};
int (*ptr)[3]=a[0];
printf((%d,%d),(*ptr)[1],(*ptr)[2]);
ptr+=1;
printf((%d,%d),(*ptr)[1],(*ptr)[2]);
   
find the output???
   
(2) double full(double a)
{
   return (int)(a+0.5);
}
   
does this always work??
   
(3) int x=123,y=231;
   int t=0;
   int l;
   l=x^y;
   while(l)
   {
   t++;
   l=l-1;
   }
   printf(%d,t);
   
--
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.
   
   
   
--
Dilip Makwana
VJTI
BTech Computers Engineering
2009-2013
   
--
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.
   
  
   --
   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
   

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-25 Thread Prakash D
* 2 3 5 6

On Mon, Jul 25, 2011 at 6:38 PM, Prakash D cegprak...@gmail.com wrote:

 thank you all for the gcd algo

 1) is the solution is 2 3 5 2 ?

 2) it will not work for double values which is beyond integer range!!


 3) this will  find the number of 1's in binary representation of x^y..
 right?


 someone explain the CFG question plz..


 On Sat, Jul 23, 2011 at 5:58 PM, arun kumar kumar0...@gmail.com wrote:

 Anna university,chennai

 On Sat, Jul 23, 2011 at 5:52 PM, saurabh singh saurab...@gmail.com
 wrote:
  where it was written?We had the same question in our MS exam and it was
  never mentioned so.
 
  On Sat, Jul 23, 2011 at 5:46 PM, arun kumar kumar0...@gmail.com
 wrote:
 
  the question was for positive number only.:)
 
  On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com
  wrote:
   2 will fail for negatve numbers.
  
   On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote:
  
   thanks a lot arun :)
  
   On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com
   wrote:
  
   @ shady:the algo posted by naveen ms is better than eulicd
 algorithm
   to find gcd. for more details refer
   http://en.wikipedia.org/wiki/Binary_GCD_algorithm
  
   On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote:
gcd can always be found in O(log(larger number)) using Euclidean
algorithms
, couldn't understand the complexity in that  what's the
 meaning
of
O(log UV)^2 ?
   
On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana
dilipmakwa...@gmail.com
wrote:
   
@Akshata Sharma
   
(2) double full(double a)
{
   return (int)(a+0.5);
}
   
I tried this on DevC++ , with various inputs ; it is working
 fine

   
On 23 July 2011 17:00, Akshata Sharma 
 akshatasharm...@gmail.com
wrote:
   
What about (2)?, will it always work?
   
On Sat, Jul 23, 2011 at 3:13 AM, prasanth
prasanth270...@gmail.com
wrote:
   
   
the CFG was actually
s-AB
A- a| BaB
B-bbA
   
The false statement i guess was This grammar doesnt produce a
string
of 4 consecutive bs
   
   
and 2 or 3 questions mainly focused on j=j-1 guess this
 unsets
the
rightmost set bit
   
   
pointer related questions were asked.One such was
   
(1)int arr[2][3]={{1,2,3},{4,5,6}};
int (*ptr)[3]=a[0];
printf((%d,%d),(*ptr)[1],(*ptr)[2]);
ptr+=1;
printf((%d,%d),(*ptr)[1],(*ptr)[2]);
   
find the output???
   
(2) double full(double a)
{
   return (int)(a+0.5);
}
   
does this always work??
   
(3) int x=123,y=231;
   int t=0;
   int l;
   l=x^y;
   while(l)
   {
   t++;
   l=l-1;
   }
   printf(%d,t);
   
--
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.
   
   
   
--
Dilip Makwana
VJTI
BTech Computers Engineering
2009-2013
   
--
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.
   
  
   --
   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

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-22 Thread Prakash D
post the 10 questions plz

On Fri, Jul 22, 2011 at 8:29 PM, shady sinv...@gmail.com wrote:

 what was it ? job interview questions or intern ?

 gcd can always be found in O(log(larger number)) , sorry, couldnt
 understand the complexity in that ?


 On Fri, Jul 22, 2011 at 8:22 PM, siva viknesh sivavikne...@gmail.comwrote:

 @ankur.. as u said i m posting today :) :)

 10 questions c output, one compiler based(CFG) ,one OS
 based (when reading internally it was just a simple percentage
 calculation question)..

 +3 for correct ans..
 -2 for wrong ans...Damn it.. i dint notice d negative marking and
 attended all :(

 ...questions were not so tough (neither so easy :P) and all , u just
 need to think aloud

 10 marks :

 1. Find gcd of 2 numbers U  V in O(log UV)^2

 2.   Test cases for finger print recognition say in a laptop to login

 3. Design question..for billing , u have barcode, barcode number,
 item price, taxes, discounts for items (some criteria were given and u
 have to  design an algo for calculating discount) and then finally
 compute Net pricewhat DS u ll usehow ll u improve this
 design...State advantages and disadvantages.

 u have to think aloud and innovative ..thats it :)

 On Jul 18, 8:46 pm, Ankur Garg ankurga...@gmail.com wrote:
  post on 22nd itself bro ;) ..there is a written  test on 23rd
 
  On Mon, Jul 18, 2011 at 8:45 PM, siva viknesh sivavikne...@gmail.com
 wrote:
 
 
 
 
 
 
 
   @all..thanks a lotsure ll post the questions after 22nd :)
 
   On Jul 18, 8:13 pm, sourabh jakhar sourabhjak...@gmail.com wrote:
study basic well they give a lot of emphasis on them
 
On Mon, Jul 18, 2011 at 8:41 PM, SkRiPt KiDdIe 
 anuragmsi...@gmail.com
   wrote:
 
 After 22nd plz post ur questions ... !!
 It wud be of great HelP.
 
 --
 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.
 
--
SOURABH JAKHAR,(CSE)(Final year)
ROOM NO 167 ,
TILAK,HOSTEL
'MNNIT ALLAHABAD
 
The Law of Win says, Let's not do it your way or my way; let's do
 it the
best way.
 
   --
   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.


  --
 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] Re: Divide 2 nos. without DIVISON

2011-05-22 Thread Prakash D IT @ CEG
could someone explain the algo with an example?

On Sun, May 22, 2011 at 8:21 PM, Puneet Ginoria punnu.gino...@gmail.comwrote:

 thnxx all.. i got the soln..
 Qdumanshu: i was asking for quotient and remainder when we divide 2 nos.
 without actually dividing them...



  --
 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] Re: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-08 Thread Prakash D IT @ CEG
mail me too plzz.. cegprak...@gmail.com



On Sun, May 8, 2011 at 10:00 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:

 mail me also usrivastav...@gmail.com


 On Sun, May 8, 2011 at 1:08 AM, ArPiT BhAtNaGaR 
 arpitbhatnagarm...@gmail.com wrote:

 dere is soln first person mail to first person on list n den the one who
 gets to next  so since we all need it :P


 On Fri, May 6, 2011 at 11:01 AM, vamsi achyuth vamsiachy...@gmail.comwrote:

 mail me++;


 On 6 May 2011 10:52, naresh kumar naresh.sac...@gmail.com wrote:

 Pleas mail to me also...
 naresh.sac...@gmail.com
 Thanks in advance


 On Fri, May 6, 2011 at 1:46 AM, Ashish Modi ashishrmod...@gmail.comwrote:

 Hello,
 Can  you please mail me ashishrmod...@gmail.com

 Thanks in advance

 --
 With Regards
 Ashish

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


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

 Arpit Bhatnagar
 (Computer Engineering)
 (MNIT JAIPUR)

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




 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 2nd Year
 @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 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] Reuest for a book

2011-05-08 Thread Prakash D IT @ CEG
@charles: think in his point of view.. everyone's needs are different

On Mon, May 9, 2011 at 4:26 AM, Charles Turner chtu...@gmail.com wrote:

  On 08/05/2011 23:32, ankit sablok wrote:

 Please mail the book Data Structures and Algorithms in C by Mark
 Allen Weiss to the following Id - ankit4...@gmail.com
 if anyone has d book


  Stop being an IDIOT requesting illegal copies of books on a public list.
 This is really irritating me now. Due to the amount of such requests, I'm
 seriously considering leaving this list. That would be a shame, since it
 sometimes contains interesting information about the topic I originally
 signed up to read about, Algorithms.

 Yours sincerely,

 Charles.

 --
 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] Re: partitioning the array

2011-05-07 Thread Prakash D IT @ CEG
sorry, i misunderstood the problem statement

On Sun, May 8, 2011 at 10:53 AM, Aakash Johari aakashj@gmail.comwrote:

 @cegprakash: it doesnt ensure that both the arrays will be having same
 number of elements


 On Sat, May 7, 2011 at 10:10 PM, cegprakash cegprak...@gmail.com wrote:

 simple..

 sum all the n elements..
 a= floor(sum/2)
 b=sum-a

 output is a b

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




 --
 -Aakash Johari
 (IIIT 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] please explain the output

2011-04-09 Thread Prakash D IT @ CEG
nice explanation

-- 
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: debugging contest

2011-03-26 Thread Prakash D IT @ CEG
is there any use with labels xxx, yyy.. ?

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