Re: [algogeeks] Amazon online test

2011-05-27 Thread balaji a
I actually attended on-campus through my college...

On 26 May 2011 16:24, jagannath prasad das jpdasi...@gmail.com wrote:

how to register for amazon ol exm .can  you plz mention ?

On Sun, Apr 24, 2011 at 6:46 PM, balaji a peshwa.bal...@gmail.com wrote:

 
  yeah i did.,...there were two section
  Section 1 - some aptitude question + predicting output ...

 --

  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group



-- 
You received this message because you are subscribed to the Google Groups
Algorithm Geeks gr...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 online test

2011-05-27 Thread Supraja Jayakumar
Hi All

Is this online test open to all aspirants ie.., is it a screening or only to
filtered candidates ?
Can I take it as for practice ?

Please tell me more about it.

Thanks
Supraja J

On Fri, May 27, 2011 at 12:27 AM, balaji a peshwa.bal...@gmail.com wrote:

 I actually attended on-campus through my college...

 On 26 May 2011 16:24, jagannath prasad das jpdasi...@gmail.com wrote:

 how to register for amazon ol exm .can  you plz mention ?

 On Sun, Apr 24, 2011 at 6:46 PM, balaji a peshwa.bal...@gmail.com wrote:

 
  yeah i did.,...there were two section
  Section 1 - some aptitude question + predicting output ...

 --

  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group



 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks gr...

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




-- 
U

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: strings

2011-05-27 Thread Senthil S
@ sunny agrawal : I misinterpreted the question .. but im not clear about
how you define interleaving of two strings .. Should the two strings be
mixed up at constant intervals or they can be mixed up anywhere .. and
should the ordering of the characters in the original strings be preserved
while constructing the third string ??

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



[algogeeks] for intelligent people

2011-05-27 Thread sunny
hi all of you you all can earn 2000+ money from internet by just
spending sometime.i have done this and it's awesome  really .
.so i am sharing the link .so hurryit
takes maximum 2
minuts for registration
http://www.earnparttimejobs.com/index.php?id=3407956

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



[algogeeks] Re: suitable data structure

2011-05-27 Thread bittu
@himnashu..Obvious Trie(Data Structure) is best in this case i will
suggest you to study Trie deeply  try it..


if you need more clarification, let me know


Thanks
Shashank


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



[algogeeks] Re: Palindrome

2011-05-27 Thread bittu
you its similar kind of problems Already Solve few days back please
check Previous threads. Small Modification needed in previous
solution .except cost not calculated but all possible palindrome have
been generated so hope you can try that  that will help .(Although
its slightly Different Question)

string s=radarradarradarradar

here is link  
http://shashank7s.blogspot.com/2011/03/wap-to-find-all-possible-palindromes-in.html
( m not sure it will give exact thinking but it will give you
approach
Run Here https://ideone.com/7tihB


Thanks
Shashank

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



[algogeeks] spoj TRAFICN- graph shortest path

2011-05-27 Thread keyankarthi
i'm trying to solve this problem.. 
https://www.spoj.pl/problems/TRAFFICN/ https://www.spoj.pl/problems/TRAFFICN/

here there are m edges.. in addition you are given k bi directional edges 
out of which u can choose only one bi directional or u choose none of the 
additional edges...

aim is to reduce the cost to go from source to destination 

ans=min(ans,dijkstras(one new added edge)) gives me tle 

can anyone throw some insight into this 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.



Re: [algogeeks] Re: strings

2011-05-27 Thread sunny agrawal
 two strings can be mixed up anywhere .. and yes the ordering of the
characters in the original strings must be preserved while constructing the
third string ??

On Fri, May 27, 2011 at 1:04 PM, Senthil S senthil2...@gmail.com wrote:

 @ sunny agrawal : I misinterpreted the question .. but im not clear about
 how you define interleaving of two strings .. Should the two strings be
 mixed up at constant intervals or they can be mixed up anywhere .. and
 should the ordering of the characters in the original strings be preserved
 while constructing the third string ??


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




-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

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



[algogeeks] Re: spoj--two squares problem

2011-05-27 Thread bittu
@ashish you forget one condition that c=x^2+y^2 iff  c= 1 mod(4) e.g. c
%4==1  also x!=y see above link its great  simple.

Thanks to Fermat  Euler



Thanks
Shashank

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sum of two

2011-05-27 Thread sukhmeet singh
@Dave nd @Akash can u explain a bit more.. I didn't get what u say..
Inserting in a map takes O(log n)  time !!

On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but couldn't
 get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.com wrote:

 @Aakash: And tell me how map works. Is making an entry O(1) regardless
 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element in
 map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com wrote:
 We can sort using STL sort function in main() before function call
 of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari rajakin...@gmail.com
 wrote:
   In while loop have i,j which points first and last index of
 array.
   In
   while loop, Check the sum of a[i],a[j], If sumk,increment i
 or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com wrote:
given an array of integers, and an integer k, find out two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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)- Hide quoted text -
 
- Show quoted text -
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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)- Hide quoted text -
 
  - Show quoted text -

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 

Re: [algogeeks] Re: sum of two

2011-05-27 Thread anshu mishra
map is internally implemented with balanced binary tree and inserting in a
BST is o(logn);

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sum of two

2011-05-27 Thread Aakash Johari
yes, you are right. map insertion takes O(log n) time. so if you know the
upper bound of N, you can simply map the existence/non-existence of any
particular element in an array. that will be in constant time (for query
purposes) and O(n) time for preprocessing.

On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but couldn't
 get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.com wrote:

 @Aakash: And tell me how map works. Is making an entry O(1) regardless
 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element in
 map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before function
 call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari rajakin...@gmail.com
 wrote:
   In while loop have i,j which points first and last index of
 array.
   In
   while loop, Check the sum of a[i],a[j], If sumk,increment i
 or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com wrote:
given an array of integers, and an integer k, find out two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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)- Hide quoted text -
 
- Show quoted text -
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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)- Hide quoted text -
 
  - Show quoted text -

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 

Re: [algogeeks] Re: sum of two

2011-05-27 Thread bhavana
can be solved easily if the elements of the array lie in a limited range
which can b known beforehand...!!

On Fri, May 27, 2011 at 2:10 PM, Aakash Johari aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know the
 upper bound of N, you can simply map the existence/non-existence of any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but couldn't
 get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.com wrote:

 @Aakash: And tell me how map works. Is making an entry O(1) regardless
 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element in
 map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before function
 call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari rajakin...@gmail.com
 wrote:
   In while loop have i,j which points first and last index of
 array.
   In
   while loop, Check the sum of a[i],a[j], If sumk,increment i
 or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com wrote:
given an array of integers, and an integer k, find out two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com
 .
 To unsubscribe from 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)- Hide quoted text -
 
- Show quoted text -
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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)- Hide quoted text -
 
  - Show quoted text -

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more 

Re: [algogeeks] [brain teaser ] Akbar Birbal Tale 27 may

2011-05-27 Thread Akshata Sharma
Birbal asks the neighbour to take out his water at once from the well he
sold to farmer, or pay rent to farmer for keeping his water in farmer's
well.
Now neighbour realized that he may run in loss by doing so, so he apologize
to farmer. dispute settled. :)

On Fri, May 27, 2011 at 12:34 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *Akbar Birbal Tale * *
 * * ***
 **
 *Emperor Akbar once ruled over India. He was a wise and intelligent ruler,
 and he had in his court the Nine Gems, his nine advisors, who were each
 known for a particular skill. One of these Gems was Birbal, known for his
 wit and wisdom. The story below is one of the examples of his wit. Do you
 have it in you to find out the answer?

 A farmer and his neighbour once went to Emperor Akbar's court with a
 complaint.
 'Your Majesty, I bought a well from him,' said the farmer pointing to his
 neighbour, 'and now he wants me to pay for the water.'
 'That's right, your Majesty,' said the neighbour. 'I sold him the well but
 not the water!'
 ?The Emperor asked Birbal to settle the dispute.
 How did Birbal solve the dispute?
 *
 *
 *

 *Update Your Answers at* : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/05/akbar-birbal-tale-27-may.html?lavesh=lavesh


 Solution:
 Will be updated after 1 day



 --

 Never explain yourself. Your friends don’t need it and
 your enemies won’t believe 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] Re: sum of two

2011-05-27 Thread sukhmeet singh
@bhavana : Explain..!!
as far as i get you is that  it would  be same as implementing map ...!!
isn't ??

On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited range
 which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know the
 upper bound of N, you can simply map the existence/non-existence of any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but couldn't
 get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.com wrote:

 @Aakash: And tell me how map works. Is making an entry O(1) regardless
 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element in
 map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before function
 call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari rajakin...@gmail.com
 wrote:
   In while loop have i,j which points first and last index of
 array.
   In
   while loop, Check the sum of a[i],a[j], If sumk,increment
 i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com wrote:
given an array of integers, and an integer k, find out
 two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to the
 Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to
 algogeeks@googlegroups.com.
 To unsubscribe from 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)- Hide quoted text -
 
- Show quoted text -
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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)- Hide quoted text -
 
  - Show quoted text -

 --
 You received this message because you are subscribed to the Google
 Groups 

Re: [algogeeks] Re: sum of two

2011-05-27 Thread bhavana
@sukhi : instead of using a map...use a boolean array elements of whoch r
initialised to false.

Starting frm the first element of the arrayif the number n is greater
than k ignore itelse mark a[n]=true and check if a[k-n]==true then we
get the required result .bt if we reach the end of array without
entering the if condition the array doesnt contain any such pair.

On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map ...!!
 isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited range
 which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know the
 upper bound of N, you can simply map the existence/non-existence of any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.com wrote:

 @Aakash: And tell me how map works. Is making an entry O(1) regardless
 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element in
 map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before function
 call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari rajakin...@gmail.com
 wrote:
   In while loop have i,j which points first and last index
 of array.
   In
   while loop, Check the sum of a[i],a[j], If sumk,increment
 i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com wrote:
given an array of integers, and an integer k, find out
 two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to
 the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to
 algogeeks@googlegroups.com.
 To unsubscribe from 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)- Hide quoted text -
 
- Show quoted text -
 
   --
   You received this message because you are subscribed to the 

Re: [algogeeks] Re: sum of two

2011-05-27 Thread bhavana
hey...bt this one works only in case given that the elements of the array
are non-negative.

On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch r
 initialised to false.

 Starting frm the first element of the arrayif the number n is greater
 than k ignore itelse mark a[n]=true and check if a[k-n]==true then we
 get the required result .bt if we reach the end of array without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map ...!!
 isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited range
 which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know
 the upper bound of N, you can simply map the existence/non-existence of any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh sukhmeet2...@gmail.com
  wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.comwrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element
 in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before function
 call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last index
 of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com
 wrote:
given an array of integers, and an integer k, find out
 two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to
 the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 Google
   Groups
 Algorithm Geeks group.
 To post to this group, send email to
 algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at

[algogeeks] output

2011-05-27 Thread Bhavesh agrawal
#include stdio.h
/* copy input to output; 2nd version */
main()
{
int c;
while ((c = getchar()) != EOF  printf(%d\n,c))
{putchar(c);
printf(\n);}
}

it's output is like
a
97
a
10

b
98
b
10


i dont understand the meaning of 10 here

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sum of two

2011-05-27 Thread sukhmeet singh
k.. got it .. but it was same as putting them into a map ..if the bound 'b'
is not known.. as said be Akash ..
But if STL is not allowed your approach is mch better..Noogle..

also a simple change that can be done if the each number is that  we can
check if (sum - a[i] )!= i then getting same can be avoided

On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the array
 are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch r
 initialised to false.

 Starting frm the first element of the arrayif the number n is greater
 than k ignore itelse mark a[n]=true and check if a[k-n]==true then we
 get the required result .bt if we reach the end of array without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map ...!!
 isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited range
 which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari 
 aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know
 the upper bound of N, you can simply map the existence/non-existence of 
 any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.com
  wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element
 in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last index
 of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com
 wrote:
given an array of integers, and an integer k, find out
 two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to
 the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact 

Re: [algogeeks] output

2011-05-27 Thread • » νιρυℓ « •
Newline Character '\n'  = ascii 10

On Fri, May 27, 2011 at 2:36 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 #include stdio.h
 /* copy input to output; 2nd version */
 main()
 {
 int c;
 while ((c = getchar()) != EOF  printf(%d\n,c))
 {putchar(c);
 printf(\n);}
 }

 it's output is like
 a
 97
 a
 10

 b
 98
 b
 10


 i dont understand the meaning of 10 here

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
Vipul

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sum of two

2011-05-27 Thread bhavana
hehe...d difference is regarding time complexity...bcoz map takes 0(logN)
for insertion while array can b accessed in constant time through index.

On Fri, May 27, 2011 at 2:39 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 k.. got it .. but it was same as putting them into a map ..if the bound 'b'
 is not known.. as said be Akash ..
 But if STL is not allowed your approach is mch better..Noogle..

 also a simple change that can be done if the each number is that  we can
 check if (sum - a[i] )!= i then getting same can be avoided

 On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the array
 are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch r
 initialised to false.

 Starting frm the first element of the arrayif the number n is greater
 than k ignore itelse mark a[n]=true and check if a[k-n]==true then we
 get the required result .bt if we reach the end of array without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map ...!!
 isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited
 range which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari 
 aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know
 the upper bound of N, you can simply map the existence/non-existence of 
 any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element
 in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma 
 gunjan.khan...@gmail.com wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last
 index of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com
 wrote:
given an array of integers, and an integer k, find
 out two
   elements
from the array whose sum is k in O(n) time. if no
 such element
   exists
output none.
 
   --
   You received this message because you are subscribed to
 the 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: sum of two

2011-05-27 Thread Aakash Johari
@sukhmeet: could you get my approach? it was same as Bhavana explained.

On Fri, May 27, 2011 at 2:12 AM, bhavana bhavana@gmail.com wrote:

 hehe...d difference is regarding time complexity...bcoz map takes 0(logN)
 for insertion while array can b accessed in constant time through index.


 On Fri, May 27, 2011 at 2:39 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 k.. got it .. but it was same as putting them into a map ..if the bound
 'b' is not known.. as said be Akash ..
 But if STL is not allowed your approach is mch better..Noogle..

 also a simple change that can be done if the each number is that  we can
 check if (sum - a[i] )!= i then getting same can be avoided

 On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the array
 are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch
 r initialised to false.

 Starting frm the first element of the arrayif the number n is
 greater than k ignore itelse mark a[n]=true and check if a[k-n]==true
 then we get the required result .bt if we reach the end of array 
 without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh sukhmeet2...@gmail.com
  wrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map
 ...!! isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.comwrote:

 can be solved easily if the elements of the array lie in a limited
 range which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari aakashj@gmail.com
  wrote:

 yes, you are right. map insertion takes O(log n) time. so if you know
 the upper bound of N, you can simply map the existence/non-existence of 
 any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..

 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the
 element in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see
 what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma 
 gunjan.khan...@gmail.com wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last
 index of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com
 wrote:
given an array of integers, and an integer k, find
 out two
   elements
from the array whose sum is k in O(n) time. if no
 such element
   exists
output none.
 
   --
   You received this message because you are subscribed
 to the Google
 Groups

Re: [algogeeks] Re: sum of two

2011-05-27 Thread sukhmeet singh
actly i did.. but bhavana didn;t used STL ..!!
My question to you was regarding Dave 's query which i didn't understand
what he meant by saying :  @Aakash: And tell me how map works. Is making an
entry O(1) regardless
of the value of the entry? For example, is it O(n) to map the sequence
1, 4, 9, 16, 25, ..., n^2? 





On Fri, May 27, 2011 at 2:44 PM, Aakash Johari aakashj@gmail.comwrote:

 @sukhmeet: could you get my approach? it was same as Bhavana explained.

 On Fri, May 27, 2011 at 2:12 AM, bhavana bhavana@gmail.com wrote:

 hehe...d difference is regarding time complexity...bcoz map takes 0(logN)
 for insertion while array can b accessed in constant time through index.


 On Fri, May 27, 2011 at 2:39 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 k.. got it .. but it was same as putting them into a map ..if the bound
 'b' is not known.. as said be Akash ..
 But if STL is not allowed your approach is mch better..Noogle..

 also a simple change that can be done if the each number is that  we can
 check if (sum - a[i] )!= i then getting same can be avoided

 On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the
 array are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch
 r initialised to false.

 Starting frm the first element of the arrayif the number n is
 greater than k ignore itelse mark a[n]=true and check if a[k-n]==true
 then we get the required result .bt if we reach the end of array 
 without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map
 ...!! isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.comwrote:

 can be solved easily if the elements of the array lie in a limited
 range which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 yes, you are right. map insertion takes O(log n) time. so if you
 know the upper bound of N, you can simply map the 
 existence/non-existence of
 any particular element in an array. that will be in constant time (for 
 query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u
 say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the
 element in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see
 what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari 
 rajakin...@gmail.com wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma 
 gunjan.khan...@gmail.com wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last
 index of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
  

Re: [algogeeks] Re: sum of two

2011-05-27 Thread Aakash Johari
In the second approach I wrote to use array for mapping


 you can simply map the existence/non-existence of any particular element
 in an array. that will be in constant time (for query purposes) and O(n)
 time for preprocessing.

 On Fri, May 27, 2011 at 2:18 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 actly i did.. but bhavana didn;t used STL ..!!
 My question to you was regarding Dave 's query which i didn't understand
 what he meant by saying :  @Aakash: And tell me how map works. Is making an
 entry O(1) regardless

 of the value of the entry? For example, is it O(n) to map the sequence
 1, 4, 9, 16, 25, ..., n^2? 





 On Fri, May 27, 2011 at 2:44 PM, Aakash Johari aakashj@gmail.comwrote:

 @sukhmeet: could you get my approach? it was same as Bhavana explained.

 On Fri, May 27, 2011 at 2:12 AM, bhavana bhavana@gmail.com wrote:

 hehe...d difference is regarding time complexity...bcoz map takes 0(logN)
 for insertion while array can b accessed in constant time through index.


 On Fri, May 27, 2011 at 2:39 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 k.. got it .. but it was same as putting them into a map ..if the bound
 'b' is not known.. as said be Akash ..
 But if STL is not allowed your approach is mch better..Noogle..

 also a simple change that can be done if the each number is that  we can
 check if (sum - a[i] )!= i then getting same can be avoided

 On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the
 array are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.comwrote:

 @sukhi : instead of using a map...use a boolean array elements of
 whoch r initialised to false.

 Starting frm the first element of the arrayif the number n is
 greater than k ignore itelse mark a[n]=true and check if a[k-n]==true
 then we get the required result .bt if we reach the end of array 
 without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map
 ...!! isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.comwrote:

 can be solved easily if the elements of the array lie in a limited
 range which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 yes, you are right. map insertion takes O(log n) time. so if you
 know the upper bound of N, you can simply map the 
 existence/non-existence of
 any particular element in an array. that will be in constant time 
 (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u
 say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari 
 aakashj@gmail.com wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave 
 dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com
 wrote:
  @Dave: I got you. I will have to check before pushing the
 element in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave 
 dave_and_da...@juno.com wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see
 what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari 
 rajakin...@gmail.com wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma 
 gunjan.khan...@gmail.com wrote:
  First of all there is an infinite loop in this
 code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last
 index of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. 

Re: [algogeeks] Re: suitable data structure

2011-05-27 Thread himanshu kansal
thnks shashankbt i hv used trie for building the dictionary..bt
since d wrong words does nt hv a common prefix...so it is nt suitable for
storing wrong words(worst case scenario is common)...
so i need a ds tht wd make d search of wrong words faster.nd v dont hv
to scan d entire dictionary file againif d word is nt found in
collection of wrong words thn v hv to scan d entire dictionary file

On Fri, May 27, 2011 at 1:07 PM, bittu shashank7andr...@gmail.com wrote:

 @himnashu..Obvious Trie(Data Structure) is best in this case i will
 suggest you to study Trie deeply  try it..


 if you need more clarification, let me know


 Thanks
 Shashank


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
Himanshu Kansal
MCS-DU

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: suitable data structure

2011-05-27 Thread bhavana
@himanshu : den do map the wrong words as u go on finding them in the doc.


On Fri, May 27, 2011 at 2:51 PM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 thnks shashankbt i hv used trie for building the dictionary..bt
 since d wrong words does nt hv a common prefix...so it is nt suitable for
 storing wrong words(worst case scenario is common)...
 so i need a ds tht wd make d search of wrong words faster.nd v dont hv
 to scan d entire dictionary file againif d word is nt found in
 collection of wrong words thn v hv to scan d entire dictionary file


 On Fri, May 27, 2011 at 1:07 PM, bittu shashank7andr...@gmail.com wrote:

 @himnashu..Obvious Trie(Data Structure) is best in this case i will
 suggest you to study Trie deeply  try it..


 if you need more clarification, let me know


 Thanks
 Shashank


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Himanshu Kansal
 MCS-DU


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Puzzle

2011-05-27 Thread anil chopra
11

On Fri, May 13, 2011 at 12:14 AM, amit amitjaspal...@gmail.com wrote:

 Consider a series in which 8 teams are participating. each team plays
 twice with all other teams. 4 of them will go to the semi final.How
 many matches should a team win, so that it will ensure that it will go
 to semi finals.?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: suitable data structure

2011-05-27 Thread bhavana
sorry guys fr my last post...bcoz dis doesnt provide any benefit..in terms
of either space or time .

On Fri, May 27, 2011 at 2:55 PM, bhavana bhavana@gmail.com wrote:

 @himanshu : den do map the wrong words as u go on finding them in the doc.


 On Fri, May 27, 2011 at 2:51 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 thnks shashankbt i hv used trie for building the dictionary..bt
 since d wrong words does nt hv a common prefix...so it is nt suitable for
 storing wrong words(worst case scenario is common)...
 so i need a ds tht wd make d search of wrong words faster.nd v dont hv
 to scan d entire dictionary file againif d word is nt found in
 collection of wrong words thn v hv to scan d entire dictionary file


 On Fri, May 27, 2011 at 1:07 PM, bittu shashank7andr...@gmail.comwrote:

 @himnashu..Obvious Trie(Data Structure) is best in this case i will
 suggest you to study Trie deeply  try it..


 if you need more clarification, let me know


 Thanks
 Shashank


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Himanshu Kansal
 MCS-DU


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Puzzle

2011-05-27 Thread Arpit Mittal
8?

On Fri, May 27, 2011 at 2:26 AM, anil chopra anil.chopra2...@gmail.comwrote:

 11

 On Fri, May 13, 2011 at 12:14 AM, amit amitjaspal...@gmail.com wrote:

 Consider a series in which 8 teams are participating. each team plays
 twice with all other teams. 4 of them will go to the semi final.How
 many matches should a team win, so that it will ensure that it will go
 to semi finals.?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: suitable data structure

2011-05-27 Thread Aakash Johari
In case of trie tree, you need not to traverse through the whole tree. Just
look at how trie tree works, you will come to know.

On Fri, May 27, 2011 at 2:27 AM, bhavana bhavana@gmail.com wrote:

 sorry guys fr my last post...bcoz dis doesnt provide any benefit..in terms
 of either space or time .


 On Fri, May 27, 2011 at 2:55 PM, bhavana bhavana@gmail.com wrote:

 @himanshu : den do map the wrong words as u go on finding them in the doc.


 On Fri, May 27, 2011 at 2:51 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 thnks shashankbt i hv used trie for building the dictionary..bt
 since d wrong words does nt hv a common prefix...so it is nt suitable for
 storing wrong words(worst case scenario is common)...
 so i need a ds tht wd make d search of wrong words faster.nd v dont
 hv to scan d entire dictionary file againif d word is nt found in
 collection of wrong words thn v hv to scan d entire dictionary file


 On Fri, May 27, 2011 at 1:07 PM, bittu shashank7andr...@gmail.comwrote:

 @himnashu..Obvious Trie(Data Structure) is best in this case i will
 suggest you to study Trie deeply  try it..


 if you need more clarification, let me know


 Thanks
 Shashank


 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Himanshu Kansal
 MCS-DU


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




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



Re: [algogeeks] Re: spoj--two squares problem

2011-05-27 Thread Balaji S
what if c=9.. 9%4=1 ryt?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: strings

2011-05-27 Thread Aakash Johari
Can be solved in this way also :

 #include iostream
 #include cstring

 using namespace std;

 string a, b, c;
 int memo[51][51][51];

 int interleave(int ai, int bi, int ci)
 {
 int r1, r2;

 r1 = r2 = 0;

 if ( ai == a.size()  bi == b.size()  ci == c.size() ) {
 return 1;
 }
 if ( ci == c.size() )
 return 0;
 if ( ai == a.size()  bi == b.size() )
 return 0;

 if ( memo[ai][bi][ci] == -1 ) {
 if ( a[ai] != c[ci]  b[bi] != c[ci] )
 r1 = interleave (ai + 1, bi + 1, ci);
 if ( a[ai] == c[ci] )
 r1 = interleave (ai + 1, bi, ci + 1);
 if ( b[bi] == c[ci] )
 r2 = interleave (ai, bi + 1, ci + 1);

 return memo[ai][bi][ci] = r1|r2;
 }

 return memo[ai][bi][ci];
 }

 int main()
 {
 cin  a  b  c;

 memset (memo, -1, sizeof(memo));

 cout  interleave(0, 0, 0)  endl;

 return 0;
 }

 On Fri, May 27, 2011 at 1:23 AM, sunny agrawal sunny816.i...@gmail.comwrote:

 two strings can be mixed up anywhere .. and yes the ordering of the
 characters in the original strings must be preserved while constructing the
 third string ??

 On Fri, May 27, 2011 at 1:04 PM, Senthil S senthil2...@gmail.com wrote:

 @ sunny agrawal : I misinterpreted the question .. but im not clear about
 how you define interleaving of two strings .. Should the two strings be
 mixed up at constant intervals or they can be mixed up anywhere .. and
 should the ordering of the characters in the original strings be preserved
 while constructing the third string ??


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




 --
 Sunny Aggrawal
 B-Tech IV year,CSI
 Indian Institute Of Technology,Roorkee

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



Re: [algogeeks] one constructor problem

2011-05-27 Thread D.N.Vishwakarma@IITR
without default constructor what will be solution

On Wed, May 25, 2011 at 10:56 AM, Aakash Johari aakashj@gmail.comwrote:

 This way you can do:

 #include iostream

 using namespace std;

 class A {
 public:
 int a;

 A(int m) {
 a = m;
 }

 A() {
 }
 };

 int main()
 {
 int i;

 A *obj[32];

 for ( i = 0; i = 31; i++ ) {
 obj[i] = new A(i);
 }

 for ( i = 0; i = 31; i++ ) {
 cout  obj[i]-a  endl;
 }

 return 0;

 }

 On Tue, May 24, 2011 at 9:38 PM, immanuel kingston 
 kingston.imman...@gmail.com wrote:


 http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm


 http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectswithoutreferencingtheconstructordirectly.htm

 Thanks,
 Immanuel



 On Wed, May 25, 2011 at 7:34 AM, D.N.Vishwakarma@IITR 
 deok...@gmail.comwrote:

 There is a class A which contains just one parameterized constructor
 A(int a). How would you initialize an array of objects of this class.

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

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




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




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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] one constructor problem

2011-05-27 Thread Aakash Johari
Provide some default value to the parameterized constructor.
*
A(int m = 0) {
a = m;
} *

On Fri, May 27, 2011 at 4:36 AM, D.N.Vishwakarma@IITR deok...@gmail.comwrote:

 without default constructor what will be solution

 On Wed, May 25, 2011 at 10:56 AM, Aakash Johari aakashj@gmail.comwrote:

 This way you can do:

 #include iostream

 using namespace std;

 class A {
 public:
 int a;

 A(int m) {
 a = m;
 }

 A() {
 }
 };

 int main()
 {
 int i;

 A *obj[32];

 for ( i = 0; i = 31; i++ ) {
 obj[i] = new A(i);
 }

 for ( i = 0; i = 31; i++ ) {
 cout  obj[i]-a  endl;
 }

 return 0;

 }

 On Tue, May 24, 2011 at 9:38 PM, immanuel kingston 
 kingston.imman...@gmail.com wrote:


 http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm


 http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectswithoutreferencingtheconstructordirectly.htm

 Thanks,
 Immanuel



 On Wed, May 25, 2011 at 7:34 AM, D.N.Vishwakarma@IITR deok...@gmail.com
  wrote:

 There is a class A which contains just one parameterized constructor
 A(int a). How would you initialize an array of objects of this class.

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

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




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




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

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



Re: [algogeeks] Puzzle

2011-05-27 Thread Arpit Mittal
could you please explain how?

On Fri, May 27, 2011 at 3:45 AM, varun pahwa varunpahwa2...@gmail.comwrote:

 i think 11.

 On Fri, May 27, 2011 at 3:06 PM, Arpit Mittal mrmittalro...@gmail.comwrote:

 8?


 On Fri, May 27, 2011 at 2:26 AM, anil chopra 
 anil.chopra2...@gmail.comwrote:

 11

 On Fri, May 13, 2011 at 12:14 AM, amit amitjaspal...@gmail.com wrote:

 Consider a series in which 8 teams are participating. each team plays
 twice with all other teams. 4 of them will go to the semi final.How
 many matches should a team win, so that it will ensure that it will go
 to semi finals.?

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
 -Arpit Mittal
 6th Semester,
 Indian Institute of Information Technology,Allahabad
 Email : arpitmittal.ii...@gmail.com
rit2008...@iiita.ac.in
 Contact : +91-8853049787

 Let every man be respected as an individual and no man idolized.


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




 --
 Varun Pahwa
 B.Tech (IT)
 6th Sem.
 Indian Institute Of Information Technology Allahabad(Amethi Campus)
 Ph : 09793899112 ,07206833114
 Official Email :: rit2008...@iiita.ac.in
 Another Email :: varunpahwa.ii...@gmail.com

 People who fail to plan are those who plan to fail.

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




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Puzzle

2011-05-27 Thread Rishabh Maurya
suppose bottom 4 teams have won least matches  and upper 4 teams have won
equal number of matches  ...

1 - x
2 - x
3 - x
4 - x

5 - 6
6 - 4
7 - 2
8 - 0

total matches are 56
and let upper four teams have won x matches each

so x = (56-(6+4+2+0))/4
 x = 11

so in this way to ensure qualification to semi finals team must win 11
matches  ...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Puzzle

2011-05-27 Thread Aakash Johari
Is it the minimum required matches to ensure for semifinals?

On Fri, May 27, 2011 at 6:06 AM, Rishabh Maurya poofiefoo...@gmail.comwrote:

 suppose bottom 4 teams have won least matches  and upper 4 teams have won
 equal number of matches  ...

 1 - x
 2 - x
 3 - x
 4 - x

 5 - 6
 6 - 4
 7 - 2
 8 - 0

 total matches are 56
 and let upper four teams have won x matches each

 so x = (56-(6+4+2+0))/4
  x = 11

 so in this way to ensure qualification to semi finals team must win 11
 matches  ...

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



[algogeeks] Google Interview Question

2011-05-27 Thread ross
Hi all,

Given an array of elements find the largest possible number that can
be formed by using the elements of the array.

eg: 10 9
ans: 910

2 3 5 78

ans: 78532

100 9

ans: 9100

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread radha krishnan
sort :)

On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:

 Hi all,

 Given an array of elements find the largest possible number that can
 be formed by using the elements of the array.

 eg: 10 9
 ans: 910

 2 3 5 78

 ans: 78532

 100 9

 ans: 9100

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Google Interview Question

2011-05-27 Thread adityasirohi
are you kidding me. Just simple sort wont work.

On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 sort :)


 On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:

 Hi all,

 Given an array of elements find the largest possible number that can
 be formed by using the elements of the array.

 eg: 10 9
 ans: 910

 2 3 5 78

 ans: 78532

 100 9

 ans: 9100

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Google Interview Question

2011-05-27 Thread Piyush Sinha
we can work out if we sort according to the leftmost integer

On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
 are you kidding me. Just simple sort wont work.

 On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
 radhakrishnance...@gmail.com wrote:

 sort :)


 On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:

 Hi all,

 Given an array of elements find the largest possible number that can
 be formed by using the elements of the array.

 eg: 10 9
 ans: 910

 2 3 5 78

 ans: 78532

 100 9

 ans: 9100

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread radha krishnan
Haha !! Any counter  case against sort ? ?? ? :P

On Fri, May 27, 2011 at 7:02 PM, adityasir...@gmail.com wrote:

 are you kidding me. Just simple sort wont work.

 On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
 radhakrishnance...@gmail.com wrote:

 sort :)


 On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:

 Hi all,

 Given an array of elements find the largest possible number that can
 be formed by using the elements of the array.

 eg: 10 9
 ans: 910

 2 3 5 78

 ans: 78532

 100 9

 ans: 9100

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
Correct me if i m wrong !!!

Number of matches of each team  = 14.
Let team A,B,C,D qualify for semifinal.
1.maximum number of matches A can win  = 14 (all played )
2.maximum number of matches B can win = 12 (all played except played
with team A)
3.maximum number of matches C can win = 10 (all played except played
with team A and B)
4.maximum number of matches D can win = 8 (all played except played
with team A , B and C)


so 8 should  be the minimum number of matches to be won to proceed for
semis !!!

On May 27, 6:10 pm, Aakash Johari aakashj@gmail.com wrote:
 Is it the minimum required matches to ensure for semifinals?

 On Fri, May 27, 2011 at 6:06 AM, Rishabh Maurya poofiefoo...@gmail.comwrote:









  suppose bottom 4 teams have won least matches  and upper 4 teams have won
  equal number of matches  ...

  1 - x
  2 - x
  3 - x
  4 - x

  5 - 6
  6 - 4
  7 - 2
  8 - 0

  total matches are 56
  and let upper four teams have won x matches each

  so x = (56-(6+4+2+0))/4
   x = 11

  so in this way to ensure qualification to semi finals team must win 11
  matches  ...

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group. To post to this group, send email 
  toalgoge...@googlegroups.com.
  To unsubscribe from this group, send email 
  toalgogeeks+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.



Re: [algogeeks] Google Interview Question

2011-05-27 Thread wujin chen
@Piyush, how to deal with this case :100 , 10

2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com

 we can work out if we sort according to the leftmost integer

 On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
  are you kidding me. Just simple sort wont work.
 
  On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
  radhakrishnance...@gmail.com wrote:
 
  sort :)
 
 
  On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:
 
  Hi all,
 
  Given an array of elements find the largest possible number that can
  be formed by using the elements of the array.
 
  eg: 10 9
  ans: 910
 
  2 3 5 78
 
  ans: 78532
 
  100 9
 
  ans: 9100
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Google Interview Question

2011-05-27 Thread adityasirohi
how about this case:

 9, 100 - 9100
100 9
9100

 2, 3, 9, 78 --
 78 9 3 2
9 78 3 2

I guess solution should be:-
sort the array of numbers in an ascending order and then check for the first
element in the array, if there is any other element greater than it, shift
all the elements one right and place that element in the left most space.


On Fri, May 27, 2011 at 9:37 AM, wujin chen wujinchen...@gmail.com wrote:

 @Piyush, how to deal with this case :100 , 10


 2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com

 we can work out if we sort according to the leftmost integer

 On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
  are you kidding me. Just simple sort wont work.
 
  On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
  radhakrishnance...@gmail.com wrote:
 
  sort :)
 
 
  On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:
 
  Hi all,
 
  Given an array of elements find the largest possible number that can
  be formed by using the elements of the array.
 
  eg: 10 9
  ans: 910
 
  2 3 5 78
 
  ans: 78532
 
  100 9
 
  ans: 9100
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Puzzle

2011-05-27 Thread Rishabh Maurya
No , you are wrong  ..  problem statement says how many matches should a
teams win to ensure its qualification , their no word like minimum or
maximum  ...
8 gets wrong if following situation arises

1 - 9
2 - 9
3 - 9
4 - 9
5 - 8
6 - 6
7 - 4
8 - 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] Google Interview Question

2011-05-27 Thread Piyush Sinha
how about adding zeroes at the end of integers to make to equal to the
integer with maximum number of digits and sort them...

ex-
101 10

adding zeroes..
101 100

sort 100 101

therefore make number as 10110

100 1

adding zeroes
100 100

therefore number is 1100

I am not sure of the method.if there is any counter case please do
suggest...

On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
 @radha,  i think your solution is wrong.
 for this case: 101,10
 in your solution , the ans is 10101,but the max ans is 10110.

 2011/5/27 radha krishnan radhakrishnance...@gmail.com

 10100 is max ans
 okay
 convert the numbers to strings and sort based on the first character
 !!!
 if equal do that recursively  and then if length is less give that
 preference !!
 i think this solution ..
 may be this is wrong !!

 On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.comwrote:

 @Piyush, how to deal with this case :100 , 10


 2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com

 we can work out if we sort according to the leftmost integer

 On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
  are you kidding me. Just simple sort wont work.
 
  On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
  radhakrishnance...@gmail.com wrote:
 
  sort :)
 
 
  On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com wrote:
 
  Hi all,
 
  Given an array of elements find the largest possible number that can
  be formed by using the elements of the array.
 
  eg: 10 9
  ans: 910
 
  2 3 5 78
 
  ans: 78532
 
  100 9
 
  ans: 9100
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google
 Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Puzzle

2011-05-27 Thread Arpit Mittal
@rishabh :

in your solution u have taken scores of last 4 teams as 6 4 2 0. what if i
take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!

and i can also take the scores of last 4 teams as 6 4 4 2 then the ans would
be
56-(6+4+4+2)/4 = 10!!!

so how you can say it would be 11?



On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.comwrote:

 No , you are wrong  ..  problem statement says how many matches should a
 teams win to ensure its qualification , their no word like minimum or
 maximum  ...
 8 gets wrong if following situation arises

 1 - 9
 2 - 9
 3 - 9
 4 - 9
 5 - 8
 6 - 6
 7 - 4
 8 - 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.




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread Logic King
i agree with piyush...can't find the countercase...satisfied with the algo.

On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number that
 can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
@Arpit 

Any four team cannot win 12 matches in total.
...Rishabh is wid right answer that is (  11  ).

Hence any team winning its any 11 out of 14 matches ensures its entry
to semis.
But not below 11 its entry to semi will depend on other team
performance.


On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
 @rishabh :

 in your solution u have taken scores of last 4 teams as 6 4 2 0. what if i
 take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!

 and i can also take the scores of last 4 teams as 6 4 4 2 then the ans would
 be
 56-(6+4+4+2)/4 = 10!!!

 so how you can say it would be 11?

 On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.comwrote:









  No , you are wrong  ..  problem statement says how many matches should a
  teams win to ensure its qualification , their no word like minimum or
  maximum  ...
  8 gets wrong if following situation arises

  1 - 9
  2 - 9
  3 - 9
  4 - 9
  5 - 8
  6 - 6
  7 - 4
  8 - 2

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

 --
 -Arpit Mittal
 6th Semester,
 Indian Institute of Information Technology,Allahabad
 Email : arpitmittal.ii...@gmail.com
            rit2008...@iiita.ac.in
 Contact : +91-8853049787

 Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Puzzle

2011-05-27 Thread Arpit Mittal
@rishabh : now i understand it better... thanks :)


On Fri, May 27, 2011 at 7:22 AM, Rishabh Maurya poofiefoo...@gmail.comwrote:

 because we want upper 4 teams to win maximum matches altogether    so
 to satisfy this criteria  ..  last team should win 0 , and team 7 must have
 lost all its matches except from team 8  , so it wins 2 and similarly team 6
 wins 4 and team 5 wins 6 .

 don't forget to watch   MI vs RCB .. :)

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




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Puzzle

2011-05-27 Thread Arpit Mittal
@Vishwakarma

it is now ok that 11 should be the answer, but why any 4 teams cannot win 12
matches in total...

for that they have to score 12*4 = 48 points out of 56. then wats the
problem.

i know how it is coming 11 now, but i am replying back for the doubt i have
in a line u just mentioned in your post... :)


On Fri, May 27, 2011 at 7:23 AM, vishwakarma vishwakarma.ii...@gmail.comwrote:

 @Arpit 

 Any four team cannot win 12 matches in total.
 ...Rishabh is wid right answer that is (  11  ).

 Hence any team winning its any 11 out of 14 matches ensures its entry
 to semis.
 But not below 11 its entry to semi will depend on other team
 performance.


 On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
  @rishabh :
 
  in your solution u have taken scores of last 4 teams as 6 4 2 0. what if
 i
  take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!
 
  and i can also take the scores of last 4 teams as 6 4 4 2 then the ans
 would
  be
  56-(6+4+4+2)/4 = 10!!!
 
  so how you can say it would be 11?
 
  On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.com
 wrote:
 
 
 
 
 
 
 
 
 
   No , you are wrong  ..  problem statement says how many matches should
 a
   teams win to ensure its qualification , their no word like minimum or
   maximum  ...
   8 gets wrong if following situation arises
 
   1 - 9
   2 - 9
   3 - 9
   4 - 9
   5 - 8
   6 - 6
   7 - 4
   8 - 2
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group. To post to this group, send email
 toalgoge...@googlegroups.com.
   To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  -Arpit Mittal
  6th Semester,
  Indian Institute of Information Technology,Allahabad
  Email : arpitmittal.ii...@gmail.com
 rit2008...@iiita.ac.in
  Contact : +91-8853049787
 
  Let every man be respected as an individual and no man idolized.

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




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
Take input as vector of string or array of string
sort the vector
print from end to beginning

On Fri, May 27, 2011 at 7:51 PM, Logic King crazy.logic.k...@gmail.comwrote:

 i agree with piyush...can't find the countercase...satisfied with the algo.


 On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number that
 can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the
 Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, 

[algogeeks] Immediate requirements for Peoplesoft Developer // wilmington,DE

2011-05-27 Thread Prakash recruiter
Dear Folks,

Wishes for the Day,
We need consultant for *PeopleSoft Developer*
please share suitable profiles to prak...@panzersolutions.com

*Job title:   PeopleSoft Developer*
*Location  :   Wilmington, DE *
*Duration  :   6 Months*
*Rate:   Market *

Job Responsibilities:
Participate in the requirements definition process.
Review and sign-off on completed requirements documents.
Translate business requirements into viable technical architectures,
database schemas and designs.
Implement the designs (design, code, test, deploy).
Support the deployed applications through debugging, fixing, and maintenance
releases.
Understand the current applications and technical architecture and provide
technical and programming support to the developers.

Experience:
Peoplesoft skills:
*GL, AP*, Purchasing, Project Costing and Expense modules in Finance,
Recruitment and Base HR, *Peoplecode* development, *SQR* development, *
PeopleSoft* architecture concepts,* SQL, PLSQL*
*
*
Experience generating required *artifacts* to document the code and its
related test cases and implementation plans.

*Requirement gathering* and hands-on development experience is a must.
__
Thanks -
Sriram Prakash - prak...@panzersolutions.com
Panzer Solutions
45 Stuart Ave, K Unit1:09 PM 4/7/2011
Norwalk, CT 06850 USA
Voice:201-753-5485
URL: www.panzersolutions.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
@Piyush Sinha,
what about  9, 801

2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 Take input as vector of string or array of string
 sort the vector
 print from end to beginning


 On Fri, May 27, 2011 at 7:51 PM, Logic King crazy.logic.k...@gmail.comwrote:

 i agree with piyush...can't find the countercase...satisfied with the
 algo.


 On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number that
 can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the
 Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com
 .
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

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

Re: [algogeeks] Google Interview Question

2011-05-27 Thread Aakash Johari
@vipul: try for 100 and 10

2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 @Piyush Sinha,
 what about  9, 801

 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 Take input as vector of string or array of string
 sort the vector
 print from end to beginning


 On Fri, May 27, 2011 at 7:51 PM, Logic King 
 crazy.logic.k...@gmail.comwrote:

 i agree with piyush...can't find the countercase...satisfied with the
 algo.


 On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number
 that can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the
 Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received 

Re: [algogeeks] Google Interview Question

2011-05-27 Thread Arpit Mittal
@piyush :

for 1, 100

you did
100,100
then sort
 result 100,100

 so u said ans is 1100 but it could also be 1001 as 100=100...

correct me if i am wrong?

On Fri, May 27, 2011 at 7:39 AM, Aakash Johari aakashj@gmail.comwrote:

 @vipul: try for 100 and 10


 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 @Piyush Sinha,
 what about  9, 801

 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 Take input as vector of string or array of string
 sort the vector
 print from end to beginning


 On Fri, May 27, 2011 at 7:51 PM, Logic King 
 crazy.logic.k...@gmail.comwrote:

 i agree with piyush...can't find the countercase...satisfied with the
 algo.


 On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha ecstasy.piy...@gmail.com
  wrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com
 wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number
 that can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the
 Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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 

Re: [algogeeks] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
@Aakash, yeah missed that, overriding default string comparator while
sorting will do that.

On Fri, May 27, 2011 at 8:11 PM, Arpit Mittal mrmittalro...@gmail.comwrote:

 @piyush :

 for 1, 100

 you did
 100,100
 then sort
  result 100,100

  so u said ans is 1100 but it could also be 1001 as 100=100...

 correct me if i am wrong?


 On Fri, May 27, 2011 at 7:39 AM, Aakash Johari aakashj@gmail.comwrote:

 @vipul: try for 100 and 10


 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 @Piyush Sinha,
 what about  9, 801

 2011/5/27 • » νιρυℓ « • vipulmehta.1...@gmail.com

 Take input as vector of string or array of string
 sort the vector
 print from end to beginning


 On Fri, May 27, 2011 at 7:51 PM, Logic King crazy.logic.k...@gmail.com
  wrote:

 i agree with piyush...can't find the countercase...satisfied with the
 algo.


 On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha 
 ecstasy.piy...@gmail.com wrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first
 character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen 
 wujinchen...@gmail.comwrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com
 wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number
 that can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the
 Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the
 Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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 

[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
so here we go 

Let A loses two of its matches to (one to B and one to C).
Let B loses two of its matches to(one to A and one to C)
Then C loses two of its matches to(one to A and one to C).
Now.
team D, if it ever plays with (A,B,C) will loses..hence minimum number
o matches it is going to loses is 6.

Hence, D could only won 8 matches...
A--12
B--12
C--12
D--8
The same thing goes to if the above team instead of loosing its two
matches to two different team loses to a same team.
Hence (12,12,12,12) cannot be feasible !!!

I hope it is clear.

On May 27, 7:27 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
 @Vishwakarma

 it is now ok that 11 should be the answer, but why any 4 teams cannot win 12
 matches in total...

 for that they have to score 12*4 = 48 points out of 56. then wats the
 problem.

 i know how it is coming 11 now, but i am replying back for the doubt i have
 in a line u just mentioned in your post... :)

 On Fri, May 27, 2011 at 7:23 AM, vishwakarma 
 vishwakarma.ii...@gmail.comwrote:









  @Arpit 

  Any four team cannot win 12 matches in total.
  ...Rishabh is wid right answer that is (  11  ).

  Hence any team winning its any 11 out of 14 matches ensures its entry
  to semis.
  But not below 11 its entry to semi will depend on other team
  performance.

  On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
   @rishabh :

   in your solution u have taken scores of last 4 teams as 6 4 2 0. what if
  i
   take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!

   and i can also take the scores of last 4 teams as 6 4 4 2 then the ans
  would
   be
   56-(6+4+4+2)/4 = 10!!!

   so how you can say it would be 11?

   On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.com
  wrote:

No , you are wrong  ..  problem statement says how many matches should
  a
teams win to ensure its qualification , their no word like minimum or
maximum  ...
8 gets wrong if following situation arises

1 - 9
2 - 9
3 - 9
4 - 9
5 - 8
6 - 6
7 - 4
8 - 2

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

   --
   -Arpit Mittal
   6th Semester,
   Indian Institute of Information Technology,Allahabad
   Email : arpitmittal.ii...@gmail.com
              rit2008...@iiita.ac.in
   Contact : +91-8853049787

   Let every man be respected as an individual and no man idolized.

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

 --
 -Arpit Mittal
 6th Semester,
 Indian Institute of Information Technology,Allahabad
 Email : arpitmittal.ii...@gmail.com
            rit2008...@iiita.ac.in
 Contact : +91-8853049787

 Let every man be respected as an individual and no man idolized.

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



[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
correction---it was typo mistake ...
Team  C loses to(one to A and one to B)

On May 27, 7:44 pm, vishwakarma vishwakarma.ii...@gmail.com wrote:
 so here we go 

 Let A loses two of its matches to (one to B and one to C).
 Let B loses two of its matches to(one to A and one to C)
 Then C loses two of its matches to(one to A and one to C).
 Now.
 team D, if it ever plays with (A,B,C) will loses..hence minimum number
 o matches it is going to loses is 6.

 Hence, D could only won 8 matches...
 A--12
 B--12
 C--12
 D--8
 The same thing goes to if the above team instead of loosing its two
 matches to two different team loses to a same team.
 Hence (12,12,12,12) cannot be feasible !!!

 I hope it is clear.

 On May 27, 7:27 pm, Arpit Mittal mrmittalro...@gmail.com wrote:







  @Vishwakarma

  it is now ok that 11 should be the answer, but why any 4 teams cannot win 12
  matches in total...

  for that they have to score 12*4 = 48 points out of 56. then wats the
  problem.

  i know how it is coming 11 now, but i am replying back for the doubt i have
  in a line u just mentioned in your post... :)

  On Fri, May 27, 2011 at 7:23 AM, vishwakarma 
  vishwakarma.ii...@gmail.comwrote:

   @Arpit 

   Any four team cannot win 12 matches in total.
   ...Rishabh is wid right answer that is (  11  ).

   Hence any team winning its any 11 out of 14 matches ensures its entry
   to semis.
   But not below 11 its entry to semi will depend on other team
   performance.

   On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
@rishabh :

in your solution u have taken scores of last 4 teams as 6 4 2 0. what if
   i
take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!

and i can also take the scores of last 4 teams as 6 4 4 2 then the ans
   would
be
56-(6+4+4+2)/4 = 10!!!

so how you can say it would be 11?

On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.com
   wrote:

 No , you are wrong  ..  problem statement says how many matches should
   a
 teams win to ensure its qualification , their no word like minimum or
 maximum  ...
 8 gets wrong if following situation arises

 1 - 9
 2 - 9
 3 - 9
 4 - 9
 5 - 8
 6 - 6
 7 - 4
 8 - 2

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

--
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
           rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

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

  --
  -Arpit Mittal
  6th Semester,
  Indian Institute of Information Technology,Allahabad
  Email : arpitmittal.ii...@gmail.com
             rit2008...@iiita.ac.in
  Contact : +91-8853049787

  Let every man be respected as an individual and no man idolized.

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



[algogeeks] Re: Puzzle

2011-05-27 Thread vishwakarma
correction--Then C loses two of its matches to(one to A and one to
C).  to Then C loses two of its matches to(one to A and one to B)
.

On May 27, 7:44 pm, vishwakarma vishwakarma.ii...@gmail.com wrote:
 so here we go 

 Let A loses two of its matches to (one to B and one to C).
 Let B loses two of its matches to(one to A and one to C)
 Then C loses two of its matches to(one to A and one to C).
 Now.
 team D, if it ever plays with (A,B,C) will loses..hence minimum number
 o matches it is going to loses is 6.

 Hence, D could only won 8 matches...
 A--12
 B--12
 C--12
 D--8
 The same thing goes to if the above team instead of loosing its two
 matches to two different team loses to a same team.
 Hence (12,12,12,12) cannot be feasible !!!

 I hope it is clear.

 On May 27, 7:27 pm, Arpit Mittal mrmittalro...@gmail.com wrote:







  @Vishwakarma

  it is now ok that 11 should be the answer, but why any 4 teams cannot win 12
  matches in total...

  for that they have to score 12*4 = 48 points out of 56. then wats the
  problem.

  i know how it is coming 11 now, but i am replying back for the doubt i have
  in a line u just mentioned in your post... :)

  On Fri, May 27, 2011 at 7:23 AM, vishwakarma 
  vishwakarma.ii...@gmail.comwrote:

   @Arpit 

   Any four team cannot win 12 matches in total.
   ...Rishabh is wid right answer that is (  11  ).

   Hence any team winning its any 11 out of 14 matches ensures its entry
   to semis.
   But not below 11 its entry to semi will depend on other team
   performance.

   On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
@rishabh :

in your solution u have taken scores of last 4 teams as 6 4 2 0. what if
   i
take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!

and i can also take the scores of last 4 teams as 6 4 4 2 then the ans
   would
be
56-(6+4+4+2)/4 = 10!!!

so how you can say it would be 11?

On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya poofiefoo...@gmail.com
   wrote:

 No , you are wrong  ..  problem statement says how many matches should
   a
 teams win to ensure its qualification , their no word like minimum or
 maximum  ...
 8 gets wrong if following situation arises

 1 - 9
 2 - 9
 3 - 9
 4 - 9
 5 - 8
 6 - 6
 7 - 4
 8 - 2

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

--
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
           rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

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

  --
  -Arpit Mittal
  6th Semester,
  Indian Institute of Information Technology,Allahabad
  Email : arpitmittal.ii...@gmail.com
             rit2008...@iiita.ac.in
  Contact : +91-8853049787

  Let every man be respected as an individual and no man idolized.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Puzzle

2011-05-27 Thread Arpit Mittal
@vishwakarma

thanks for rectifying me...
its clear... 12 is not posible, i was in another way :)

On Fri, May 27, 2011 at 7:46 AM, vishwakarma vishwakarma.ii...@gmail.comwrote:

 correction---it was typo mistake ...
 Team  C loses to(one to A and one to B)

 On May 27, 7:44 pm, vishwakarma vishwakarma.ii...@gmail.com wrote:
  so here we go 
 
  Let A loses two of its matches to (one to B and one to C).
  Let B loses two of its matches to(one to A and one to C)
  Then C loses two of its matches to(one to A and one to C).
  Now.
  team D, if it ever plays with (A,B,C) will loses..hence minimum number
  o matches it is going to loses is 6.
 
  Hence, D could only won 8 matches...
  A--12
  B--12
  C--12
  D--8
  The same thing goes to if the above team instead of loosing its two
  matches to two different team loses to a same team.
  Hence (12,12,12,12) cannot be feasible !!!
 
  I hope it is clear.
 
  On May 27, 7:27 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
 
 
 
 
 
 
 
   @Vishwakarma
 
   it is now ok that 11 should be the answer, but why any 4 teams cannot
 win 12
   matches in total...
 
   for that they have to score 12*4 = 48 points out of 56. then wats the
   problem.
 
   i know how it is coming 11 now, but i am replying back for the doubt i
 have
   in a line u just mentioned in your post... :)
 
   On Fri, May 27, 2011 at 7:23 AM, vishwakarma 
 vishwakarma.ii...@gmail.comwrote:
 
@Arpit 
 
Any four team cannot win 12 matches in total.
...Rishabh is wid right answer that is (  11  ).
 
Hence any team winning its any 11 out of 14 matches ensures its entry
to semis.
But not below 11 its entry to semi will depend on other team
performance.
 
On May 27, 7:11 pm, Arpit Mittal mrmittalro...@gmail.com wrote:
 @rishabh :
 
 in your solution u have taken scores of last 4 teams as 6 4 2 0.
 what if
i
 take 2 2 2 2 then the ans would be 56-(2+2+2+2)/4 = 12...!!!
 
 and i can also take the scores of last 4 teams as 6 4 4 2 then the
 ans
would
 be
 56-(6+4+4+2)/4 = 10!!!
 
 so how you can say it would be 11?
 
 On Fri, May 27, 2011 at 6:52 AM, Rishabh Maurya 
 poofiefoo...@gmail.com
wrote:
 
  No , you are wrong  ..  problem statement says how many matches
 should
a
  teams win to ensure its qualification , their no word like
 minimum or
  maximum  ...
  8 gets wrong if following situation arises
 
  1 - 9
  2 - 9
  3 - 9
  4 - 9
  5 - 8
  6 - 6
  7 - 4
  8 - 2
 
   --
  You received this message because you are subscribed to the
 Google
GroupsAlgorithm Geeks group. To post to this group, send
 emailtoalgoge...@googlegroups.com.To unsubscribe from this group,
 send email toalgogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 --
 -Arpit Mittal
 6th Semester,
 Indian Institute of Information Technology,Allahabad
 Email : arpitmittal.ii...@gmail.com
rit2008...@iiita.ac.in
 Contact : +91-8853049787
 
 Let every man be respected as an individual and no man idolized.
 
--
You received this message because you are subscribed to the Google
 Groups  Algorithm Geeks group. To post to this group, send
 emailtoalgoge...@googlegroups.com.  To unsubscribe from this group, send
 email toalgogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
   --
   -Arpit Mittal
   6th Semester,
   Indian Institute of Information Technology,Allahabad
   Email : arpitmittal.ii...@gmail.com
  rit2008...@iiita.ac.in
   Contact : +91-8853049787
 
   Let every man be respected as an individual and no man idolized.

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




-- 
-Arpit Mittal
6th Semester,
Indian Institute of Information Technology,Allahabad
Email : arpitmittal.ii...@gmail.com
   rit2008...@iiita.ac.in
Contact : +91-8853049787

Let every man be respected as an individual and no man idolized.

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



[algogeeks] Senior Network Admin // Boston, MA // 6+ Months contract

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.

Title  :   Senior Network Admin
Location   :   Boston, MA
Duration  :   6+ Months contract


 QUALIFICATIONS REQUIRED AT HIRE (List knowledge, skills, abilities)
 Experience with designing, configuring and troubleshooting complex network
backbones.
 Knowledge of the capabilities and limitations of computer hardware and ITS
traffic/data acquisition and control devices
 Knowledge of serial communication technologies, MODBUS over serial/IP and
NTCIP protocols.
 Knowledge of routing protocols (e.g. EIGRP, OSPF, RIP, and BGP) in a mixed
environment.
 Knowledge of VLAN technology, VTP and STP protocols.
 Experience in Access Control Lists, Cisco Firewalls, VPN technologies and
other security technologies.
 Solid understanding of network routers and switches.
 Experience with data acquisition/control devices and sub-systems
communications including but not limited to PLCs, RTUs, FACPs, ACPs, etc.
 Knowledge of T1, T3, SONET, DWDM and OC technologies.
 Experience with Metro-Ethernet technologies.
 Experience in Network monitoring and management tools.
 Experience in VOIP and QoS.
 Ability to communicate effectively orally and in writing;  Ability to work
in a team setting.
 Ability to adjust to changing situations to meet emergencies or changing
program or production requirements.
 Knowledge of the methods and techniques of statistics.



QUALIFICATIONS ACQUIRED ON JOB (List knowledge, skills, abilities)
Knowledge of the policies, procedures, specifications, standards and
guidelines governing assigned unit activities.
Knowledge of the types and uses of agency forms.

MINIMUM REQUIREMENTS
Applicants must have at least four years of full-time, or equivalent
part-time, professional experience in networking of which at least two years
must have been in work in which the major duties included computer, traffic
devices, data acquisition/control devices and networking systems analysis.




Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



[algogeeks] Sure Shot Closure for Perl Programmer in Ft. Lauderdale, FL

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*
Please reply at soh...@panzersolutions.com
*
Title  :   Perl Programmer
Location   :   Ft. Lauderdale, FL
Duration  :   6 Month contract


*Must-haves *
4-6 years of Perl Programming experience.
Strong knowledge of internet technologies such as HTTP, XML, XSLT,
JavaScript and HTML
Extensive SQL experience
Windows and Unix (FreeBSD or Linux) Experience

*Plusses *
Development and/or system administration in a hosting environment

*Responsibility *
Our client is a large company located in Boca Raton. They need someone to
design and develop web applications used by internal and external customers.
They will be working on a online billing/ordering system. The programmer
will be writing Perl code on a Unix platform.




Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



Re: [algogeeks] Google Interview Question

2011-05-27 Thread anshu mishra
@all go through this code

#includeiostream
#includealgorithm

using namespace std;
bool compare(int a, int b)
{
string u, v;
u = v = ;
while (a)
{
u += (a % 10 + '0');
a/=10;
}
while (b)
{
v += (b % 10 + '0');
b/=10;
}
int i = 0, j = 0;
reverse(u.begin(), u.end());
reverse(v.begin(), v.end());
while (i  u.size() || j  v.size())
{
if (i == u.size()) i = 0;
if (j == v.size()) j = 0;
for (; i  u.size()  j  v.size(); i++, j++)
{
if (u[i] == v[j]) continue;
return (u[i]  v[j]);
}
}
if (u.size() == v.size()) return true;
}
int main()
{
int n;
cin  n;
int ar[n];
int i;
for (i = 0; i  n; i++)
{
cin  ar[i];
}
sort (ar, ar +n, compare);
for (i = 0; i  n; i++) cout  ar[i];
cout  endl;
return 0;
}

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



[algogeeks] Immediate Need for Sharepoint/.NET Developer in Denver CO

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
Please reply at soh...@panzersolutions.com

Title  :   Sharepoint/.NET Developer
Location   :   Denver CO
Duration  :   6 month contract to hire
Green card and Citizens only

 *Must-haves *
Our client is looking for a motivated individual with the following
experience...
8 years development experience with 3 years designing and developing .NET
projects
Experience deploying, configuring and customizing Sharepoint WSS 3.0 and/or
Sharepoint 2010
Experience with object oriented analysis/design
Knowledge of design patterns, refactoring and unit testing
Exposure and knowledge of various ORM technologies such as NHibernate
Experience using Agile Methodologies such as Extreme Programming (XP)
Experience with LINQ and Entity Framework
Experience integrating COTS (commercial off-the-shelf) applications into
portals is highly desirable
Experience with DOJO, JQuery, or Microsoft AJAX Toolkit
Experience with automated deployment solutions like Nant or MSBuild



Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



[algogeeks] island puzzle

2011-05-27 Thread himanshu kansal
a king has two sons eric and bob.he wants to divide his
islands
the islands are in a queue.eric being elder gets the first
chancethey both can pick d island alternatively from beginning or
end of the queue only.design an algo so tht eric gets the max.
piece of land.
i hv solved it if the no of islands are even
bt nt getting any clue whn no of islands are odd
in the odd casei think bob vl hv an advantage ovr ericbut how
to develop strategy for eric(if no of islands are odd)

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



[algogeeks] Weblogic Portal Developer -- BASKING RIDGE, NJ -- 2 months contract

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*Please reply at soh...@panzersolutions.com
*
Title  :   Weblogic Portal Developer
Location   :   BASKING RIDGE, NJ
Duration  :   2 Months contract
Pay Rate  :   $40/HR on C2C



Must-haves
J2EE development (WebLogic Portal) – Tomcat is a plus
Oracle DB development
Unix scripting.

Responsibilities
Add user feed back feature to Knova knowledge article.
Implement automatic process to publish contents
Update the website




Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



Re: [algogeeks] Google Interview Question

2011-05-27 Thread Supraja Jayakumar
Hi

Isnt this the Kadane's (largest subarray) problem ?

Rgds
Supraja J

On Fri, May 27, 2011 at 9:41 AM, anshu mishra anshumishra6...@gmail.comwrote:

 @all go through this code

 #includeiostream
 #includealgorithm

 using namespace std;
 bool compare(int a, int b)
 {
 string u, v;
 u = v = ;
 while (a)
 {
 u += (a % 10 + '0');
 a/=10;
 }
 while (b)
 {
 v += (b % 10 + '0');
 b/=10;
 }
 int i = 0, j = 0;
 reverse(u.begin(), u.end());
 reverse(v.begin(), v.end());
 while (i  u.size() || j  v.size())
 {
 if (i == u.size()) i = 0;
 if (j == v.size()) j = 0;
 for (; i  u.size()  j  v.size(); i++, j++)
 {
 if (u[i] == v[j]) continue;
 return (u[i]  v[j]);
 }
 }
 if (u.size() == v.size()) return true;
 }
 int main()
 {
 int n;
 cin  n;
 int ar[n];
 int i;
 for (i = 0; i  n; i++)
 {
 cin  ar[i];
 }
 sort (ar, ar +n, compare);
 for (i = 0; i  n; i++) cout  ar[i];
 cout  endl;
 return 0;
 }

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




-- 
U

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
Kadane's algorithm is considers subarray sum, we are considering
concatenation here.

On Fri, May 27, 2011 at 9:45 PM, Supraja Jayakumar suprajasank...@gmail.com
 wrote:

 Hi

 Isnt this the Kadane's (largest subarray) problem ?

 Rgds
 Supraja J

 On Fri, May 27, 2011 at 9:41 AM, anshu mishra 
 anshumishra6...@gmail.comwrote:

 @all go through this code

 #includeiostream
 #includealgorithm

 using namespace std;
 bool compare(int a, int b)
 {
 string u, v;
 u = v = ;
 while (a)
 {
 u += (a % 10 + '0');
 a/=10;
 }
 while (b)
 {
 v += (b % 10 + '0');
 b/=10;
 }
 int i = 0, j = 0;
 reverse(u.begin(), u.end());
 reverse(v.begin(), v.end());
 while (i  u.size() || j  v.size())
 {
 if (i == u.size()) i = 0;
 if (j == v.size()) j = 0;
 for (; i  u.size()  j  v.size(); i++, j++)
 {
 if (u[i] == v[j]) continue;
 return (u[i]  v[j]);
 }
 }
 if (u.size() == v.size()) return true;
 }
 int main()
 {
 int n;
 cin  n;
 int ar[n];
 int i;
 for (i = 0; i  n; i++)
 {
 cin  ar[i];
 }
 sort (ar, ar +n, compare);
 for (i = 0; i  n; i++) cout  ar[i];
 cout  endl;
 return 0;
 }

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




 --
 U

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
Vipul

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



[algogeeks] 100% close for UI Developer in Chicago, IL

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.

*Please reply at soh...@panzersolutions.com* *
*
Title  :   UI Developer
Location   :   Chicago, IL
Duration  :   6 Month contract
Rate  :   $45/Hr on Corp to Corp


Required Skills:
5 plus years of experience in front-end application/user interface design
Mid to senior level experience with the following technologies:
html, javascript, css, photoshop, adobe, dreamweaver
Experience with the following types of interface design (in order of
importance):
1) website design
2) mobility or desktop design

NOTE: Candidate needs solid web design experience (Interface design) and/or
Mobile or desktop design experience

Nice to have:
Winforms
WPF
Backend development (java, c#, asp, .net development)
1 year of experience in designing interfaces for iPhone or Android

Description
Candidate will be a part of a team responsible for designing user interface
for website, desktop and mobile applications. He or she may be involved in
redesigning interfaces for existing applications as well as designing a
front end for dynamic prototypes. Our client is currently consolidating a
group of applications into one enterprise level software suite. Candidate
will be expected to help redesign a front end that is both visually
appealing and functional.




Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



[algogeeks] Re: Google Interview Question

2011-05-27 Thread xeron!x
No, Kadane's algorithm considers subarray sum, we are considering
concatenation ( for whole array ).
The solution with custom string comparator : http://ideone.com/doASH.

On May 27, 9:15 pm, Supraja Jayakumar suprajasank...@gmail.com
wrote:
 Hi

 Isnt this the Kadane's (largest subarray) problem ?

 Rgds
 Supraja J

 On Fri, May 27, 2011 at 9:41 AM, anshu mishra 
 anshumishra6...@gmail.comwrote:









  @all go through this code

  #includeiostream
  #includealgorithm

  using namespace std;
  bool compare(int a, int b)
  {
          string u, v;
          u = v = ;
          while (a)
          {
                  u += (a % 10 + '0');
                  a/=10;
          }
          while (b)
          {
                  v += (b % 10 + '0');
                  b/=10;
          }
          int i = 0, j = 0;
          reverse(u.begin(), u.end());
          reverse(v.begin(), v.end());
          while (i  u.size() || j  v.size())
          {
                  if (i == u.size()) i = 0;
                  if (j == v.size()) j = 0;
                  for (; i  u.size()  j  v.size(); i++, j++)
                  {
                          if (u[i] == v[j]) continue;
                          return (u[i]  v[j]);
                  }
          }
          if (u.size() == v.size()) return true;
  }
  int main()
  {
          int n;
          cin  n;
          int ar[n];
          int i;
          for (i = 0; i  n; i++)
          {
                  cin  ar[i];
          }
          sort (ar, ar +n, compare);
          for (i = 0; i  n; i++) cout  ar[i];
          cout  endl;
          return 0;
  }

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

 --
 U

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



[algogeeks] Lotus Connections Developer // Wilmington, DE // 6 Months contract

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.

*Please reply at soh...@panzersolutions.com
** *
Title  :   Lotus Connections Developer
Location   :   Wilmington, DE
Duration  :   6 Months contract


MUST:
IBM Lotus Connections
Technical Widget Developtment
Java Script / WebSphere – background

PLUS:
API – extract and Input data
Web Social Software
Rational Applicational Developtment tooks within Websphere

Responsibilities
Developtment from scratch – working on an internal social networking tool,
combining Facebook and LinkedIn, to improve busines intelligence  /
communication  Will be working with internal BA’s, developing a prototype
for first 4weeks, then 6 months of developtment / production.



Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



[algogeeks] ms ques

2011-05-27 Thread UTKARSH SRIVASTAV
test cases for internet explorer

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



[algogeeks] ATG Developer // Vernon Hills, IL // 12 Months contract

2011-05-27 Thread sohail panzer
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.

*Please reply at soh...@panzersolutions.com
*
Title  :   ATG Developer
Location   :   Vernon Hills, IL
Duration  :   12 Months contract


MUST HAVES:
Expert level ATG development experience (5-7 years)
Specific experience developing ATG version 9.1
Familiarity and experience with Java based programming
Exceptional communication skills
Interpersonal communication is extremely important as they will be working
closely in teams and collaborating with other development groups

** For the Lead Developer role add experience leading ATG development
projects  enhancements

Responsibilities
This organizations client in Vernon Hills just launched their new ecommerce
website 30 days ago.  They have a series of projects lined up that tie
together a set of large enhancements. This is not just implementation work,
but extension and integration into their applications.  The rest of the
client’s applications are .NET based, but the ATG commerce suite is Java.
No .NET experience is necessary.



Thank you,

Sohail Khan | Technical Recruiter
Panzer Solutions LLc
45 Stuart Ave, K
Norwalk, CT 06850 USA
Voice: 203-813-2052
soh...@panzersolutions.com
URL: www.panzersolutions.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.



[algogeeks] Re: Puzzle

2011-05-27 Thread L
Ah! sorry.
This combination is not possible.
It will be 10,10,10,10,10,4,2,0. So, the answer is 11.

On May 27, 10:10 pm, L prnk.bhatna...@gmail.com wrote:
 The worst case will occur when 5 teams have the same number of wins.
 As only 4 can qualify, one team with the same number of points will
 not be able to qualify.

 Team. Wins
 1. 11
 2. 11
 3. 11
 4. 11
 5. 11
 6. 1
 7. 0
 8. 0

 In this scenario, a team with 11 points will not be able to qualify.
 So, to ensure that it is in the finals a team should win 12 matches.

 On May 27, 6:06 pm, Rishabh Maurya poofiefoo...@gmail.com wrote:







  suppose bottom 4 teams have won least matches  and upper 4 teams have won
  equal number of matches  ...

  1 - x
  2 - x
  3 - x
  4 - x

  5 - 6
  6 - 4
  7 - 2
  8 - 0

  total matches are 56
  and let upper four teams have won x matches each

  so x = (56-(6+4+2+0))/4
   x = 11

  so in this way to ensure qualification to semi finals team must win 11
  matches  ...

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread ankit sambyal
@Piyush:  try 97,8,9
acc. to ur algo,  adding 0s:   97,80,90
then sorting : 97,90,80
so final ans acc. to ur algo: 9798
whereas the correct ans is : 9897


Ankit
BITS Pilani


On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 how about adding zeroes at the end of integers to make to equal to the
 integer with maximum number of digits and sort them...

 ex-
 101 10

 adding zeroes..
 101 100

 sort 100 101

 therefore make number as 10110

 100 1

 adding zeroes
 100 100

 therefore number is 1100

 I am not sure of the method.if there is any counter case please do
 suggest...

 On 5/27/11, wujin chen wujinchen...@gmail.com wrote:
  @radha,  i think your solution is wrong.
  for this case: 101,10
  in your solution , the ans is 10101,but the max ans is 10110.
 
  2011/5/27 radha krishnan radhakrishnance...@gmail.com
 
  10100 is max ans
  okay
  convert the numbers to strings and sort based on the first character
  !!!
  if equal do that recursively  and then if length is less give that
  preference !!
  i think this solution ..
  may be this is wrong !!
 
  On Fri, May 27, 2011 at 7:07 PM, wujin chen wujinchen...@gmail.com
 wrote:
 
  @Piyush, how to deal with this case :100 , 10
 
 
  2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com
 
  we can work out if we sort according to the leftmost integer
 
  On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote:
   are you kidding me. Just simple sort wont work.
  
   On Fri, May 27, 2011 at 9:31 AM, radha krishnan 
   radhakrishnance...@gmail.com wrote:
  
   sort :)
  
  
   On Fri, May 27, 2011 at 6:57 PM, ross jagadish1...@gmail.com
 wrote:
  
   Hi all,
  
   Given an array of elements find the largest possible number that
 can
   be formed by using the elements of the array.
  
   eg: 10 9
   ans: 910
  
   2 3 5 78
  
   ans: 78532
  
   100 9
  
   ans: 9100
  
   --
   You received this message because you are subscribed to the Google
  Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit 

Re: [algogeeks] Google Interview Question

2011-05-27 Thread shubham
check whether these steps work:

step 1:
sort the given numbers in the decreasing order based on their first 
digit.
step 2:
if two numbers come out to be equal in the above case  both of 
their next digit exist then sort on the basis of their next digit, otherwise 
the number
whose next digit doesnot exist should be placed before the other 
number.
step 3:
   concatenate these numbers.

e.g.

(0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
(97,8,9) sorting gives: 9,97,8 = 9978

correct me if i'm wrong.

Shubham

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread • » νιρυℓ « •
@shubham, 10 101 ??

On Fri, May 27, 2011 at 11:41 PM, shubham shubh2...@gmail.com wrote:

 check whether these steps work:

 step 1:
 sort the given numbers in the decreasing order based on their first
 digit.
 step 2:
 if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
 whose next digit doesnot exist should be placed before the other
 number.
 step 3:
concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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,
Vipul

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread ankit sambyal
@shubam: won't work
   try following test case:  8,89,9

Ankit Sambyal



On Fri, May 27, 2011 at 11:11 AM, shubham shubh2...@gmail.com wrote:

 check whether these steps work:

 step 1:
 sort the given numbers in the decreasing order based on their first
 digit.
 step 2:
 if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
 whose next digit doesnot exist should be placed before the other
 number.
 step 3:
concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

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


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



[algogeeks] Odd Even Sort array

2011-05-27 Thread ross
Hi all,

Sort all elements in odd indices of an array in ascending order and
even indices in descending order.
Finally, rearrange so that all even indexed elements come first.

eg:

input – 7 2 6 4 8 3 1

even indexed : 7 6 8 1 = sort 8 7 6 1
odd indexed: 2 4 3 = sort 2 3 4

output – 8 7 6 1 2 3 4

What could be the best algo to solve it?
Is it possible to arrive at the output using only O(1) extra space?

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



[algogeeks] Re: Puzzle

2011-05-27 Thread Don
To solve this, look at an 8x8 grid representing the games played. The
diagonal is not used, because teams do not play themselves. Below the
diagonal is the first game between each team and above the diagonal is
the second game. Assume that teams 1-4 are the ones who will go to the
semi-finals. This means that you only need to assign winners in the
first 4 rows and first 4 columns. The lower right of the grid can
remain empty. Start by assigning team 1-4 as the winner every time
they play teams 5-8. That gives teams 1-4 eight wins each. That leaves
just 12 games left to assign in the top left quarter of the grid. It
is not hard to assign them so that each time wins 3 of the games,
meaning that it takes 11 games to assure a spot in the semi-finals.

Here is a grid of results for one such outcome:

X134
1X24
12X3
423X
1234
1234
1234
1234

Don

On May 12, 1:44 pm, amit amitjaspal...@gmail.com wrote:
 Consider a series in which 8 teams are participating. each team plays
 twice with all other teams. 4 of them will go to the semi final.How
 many matches should a team win, so that it will ensure that it will go
 to semi finals.?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-05-27 Thread srajan dongre
@ankit sambyal.i think d rite answer will be 9978 in dat case.



On Fri, May 27, 2011 at 11:50 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @shubam: won't work
try following test case:  8,89,9

 Ankit Sambyal



 On Fri, May 27, 2011 at 11:11 AM, shubham shubh2...@gmail.com wrote:

 check whether these steps work:

 step 1:
 sort the given numbers in the decreasing order based on their
 first digit.
 step 2:
 if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
 whose next digit doesnot exist should be placed before the other
 number.
 step 3:
concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




-- 
--

Srajan Dongre
||nd year  CSI (dual degree)
Indian Institute of Technology , Roorkee
Uttrakhand , India
pin code--247667

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] posix threads

2011-05-27 Thread Douglas Diniz
Whats the point? There is infinite points to use threads, even in a
single core.

On Fri, May 27, 2011 at 4:05 PM, jagannath jpdasi...@gmail.com wrote:
 hi guys,
       i know that pthread is an user-level thread and an user-level
 can't take the advantage of SMP. Then what is the point of creating
 user-level threads if they can't be scheduled on multiple cores?Please
 clear my doubt which has been hitting me for long...

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





-- 
---
Douglas Gameiro Diniz
Engenheiro de Computação - 2003 - UNICAMP

Mobile: (19) 92158777
Gtalk: dgdiniz
Msn: thedougdi...@hotmail.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.



Re: [algogeeks] Google Interview Question

2011-05-27 Thread ankit sambyal
@srajan: ya , i made a mistake...the correct ans  will of-course be 9978




On Fri, May 27, 2011 at 12:11 PM, srajan dongre srajan.don...@gmail.comwrote:

 @ankit sambyal.i think d rite answer will be 9978 in dat case.




 On Fri, May 27, 2011 at 11:50 PM, ankit sambyal ankitsamb...@gmail.comwrote:

 @shubam: won't work
try following test case:  8,89,9

 Ankit Sambyal



 On Fri, May 27, 2011 at 11:11 AM, shubham shubh2...@gmail.com wrote:

 check whether these steps work:

 step 1:
 sort the given numbers in the decreasing order based on their
 first digit.
 step 2:
 if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
 whose next digit doesnot exist should be placed before the other
 number.
 step 3:
concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.




 --
 --

 Srajan Dongre
 ||nd year  CSI (dual degree)
 Indian Institute of Technology , Roorkee
 Uttrakhand , India
 pin code--247667


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Odd Even Sort array

2011-05-27 Thread Piyush Sinha
will it be given that the number of elements is always even??

On 5/28/11, ross jagadish1...@gmail.com wrote:
 Hi all,

 Sort all elements in odd indices of an array in ascending order and
 even indices in descending order.
 Finally, rearrange so that all even indexed elements come first.

 eg:

 input – 7 2 6 4 8 3 1

 even indexed : 7 6 8 1 = sort 8 7 6 1
 odd indexed: 2 4 3 = sort 2 3 4

 output – 8 7 6 1 2 3 4

 What could be the best algo to solve it?
 Is it possible to arrive at the output using only O(1) extra space?

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




-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Odd Even Sort array

2011-05-27 Thread srajan dongre
wat about insertion sort (with some limited conditions obviously )  ??

On Sat, May 28, 2011 at 12:56 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 will it be given that the number of elements is always even??

 On 5/28/11, ross jagadish1...@gmail.com wrote:
  Hi all,
 
  Sort all elements in odd indices of an array in ascending order and
  even indices in descending order.
  Finally, rearrange so that all even indexed elements come first.
 
  eg:
 
  input – 7 2 6 4 8 3 1
 
  even indexed : 7 6 8 1 = sort 8 7 6 1
  odd indexed: 2 4 3 = sort 2 3 4
 
  output – 8 7 6 1 2 3 4
 
  What could be the best algo to solve it?
  Is it possible to arrive at the output using only O(1) extra space?
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

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




-- 
--

Srajan Dongre
||nd year  CSI (dual degree)
Indian Institute of Technology , Roorkee
Uttrakhand , India
pin code--247667

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Odd Even Sort array

2011-05-27 Thread LALIT SHARMA
It will give correct answer ,
but instead of doing manipulation after taking input.
as it would take some O(n) time. if n would be large , we would incur
this extra cost .

we should change the termination condition of merge-sort function and
modify the merge function of merge sort ..to reach our objective .

correct me , if i am wrong ...

On Sat, May 28, 2011 at 1:40 AM, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 main()
 {
       int a[100];
       int i,j,N;
       printf(enter the number of elements: );
       scanf(%d,N);
       for(i=0;iN;i++)
         scanf(%d,a[i]);
       if(N%2) j = N/2+1;
       else j = N/2;
       i =1;
       while(jN)
       {
         swap(a[i],a[j]);
         i+=2;
         j+=2;
       }
       if(N%2){
              inv_mergesort(a,0,N/2);//sort the array in descending order
              mergesort(a,N/2+1,N-1);
       }
       else{
            inv_mergesort(a,0,N/2-1);//sort the array in descending order
             mergesort(a,N/2,N-1);
       }

       for(i=0;iN;i++)
          printf(%d,a[i]);
 }

 I hope the code doesn't contain any bugs...:P :P

 On 5/28/11, srajan dongre srajan.don...@gmail.com wrote:
 wat about insertion sort (with some limited conditions obviously )  ??

 On Sat, May 28, 2011 at 12:56 AM, Piyush Sinha
 ecstasy.piy...@gmail.comwrote:

 will it be given that the number of elements is always even??

 On 5/28/11, ross jagadish1...@gmail.com wrote:
  Hi all,
 
  Sort all elements in odd indices of an array in ascending order and
  even indices in descending order.
  Finally, rearrange so that all even indexed elements come first.
 
  eg:
 
  input – 7 2 6 4 8 3 1
 
  even indexed : 7 6 8 1 = sort 8 7 6 1
  odd indexed: 2 4 3 = sort 2 3 4
 
  output – 8 7 6 1 2 3 4
 
  What could be the best algo to solve it?
  Is it possible to arrive at the output using only O(1) extra space?
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 


 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

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




 --
 --

 Srajan Dongre
 ||nd year  CSI (dual degree)
 Indian Institute of Technology , Roorkee
 Uttrakhand , India
 pin code--247667

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




 --
 *Piyush Sinha*
 *IIIT, Allahabad*
 *+91-8792136657*
 *+91-7483122727*
 *https://www.facebook.com/profile.php?id=10655377926 *

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





-- 
Lalit Kishore Sharma,
IIIT Allahabad (Amethi Capmus),
6th Sem.

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



[algogeeks] Re: Google Interview Question

2011-05-27 Thread Dave
@Shubham: Try 8, 89, 7. Your algorithm gives 8897, but the right
answer is 8987.

Dave

On May 27, 1:11 pm, shubham shubh2...@gmail.com wrote:
 check whether these steps work:

 step 1:
         sort the given numbers in the decreasing order based on their first
 digit.
 step 2:
         if two numbers come out to be equal in the above case  both of
 their next digit exist then sort on the basis of their next digit, otherwise
 the number
         whose next digit doesnot exist should be placed before the other
 number.
 step 3:
        concatenate these numbers.

 e.g.

 (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
 (97,8,9) sorting gives: 9,97,8 = 9978

 correct me if i'm wrong.

 Shubham

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Google Interview Question

2011-05-27 Thread Logic King
@sunny it will work fine if you have 2 numbers only...but what about the
list...3..4 or 5..or morethen the possible number of combinations will
be  'N!'...where n is the number of digits...the code will work quite
slowly for larger 'n'.

On Fri, May 27, 2011 at 3:33 PM, Dave dave_and_da...@juno.com wrote:

 @Shubham: Try 8, 89, 7. Your algorithm gives 8897, but the right
 answer is 8987.

 Dave

 On May 27, 1:11 pm, shubham shubh2...@gmail.com wrote:
  check whether these steps work:
 
  step 1:
  sort the given numbers in the decreasing order based on their
 first
  digit.
  step 2:
  if two numbers come out to be equal in the above case  both of
  their next digit exist then sort on the basis of their next digit,
 otherwise
  the number
  whose next digit doesnot exist should be placed before the other
  number.
  step 3:
 concatenate these numbers.
 
  e.g.
 
  (0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
  (97,8,9) sorting gives: 9,97,8 = 9978
 
  correct me if i'm wrong.
 
  Shubham

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Odd Even Sort array

2011-05-27 Thread subramania jeeva
I hope merge sort is not an inplace sorting.. It'll take extra space (in
function merge) and since it uses recursion it'll also take stack space..
I think this sol will work.
  1. partition the array by holding the even elements on first space(n/2 or
n/2-1 depends on odd sized and even sized array) of array and odd elements
in last n/2 space of array.
  2. Do heapsort by using both min heap and maxheap  by having 0 and (sizeof
even elements) as root of heap.
  3. Heap don't use extra space and time complexity is O(nlgn).













Cheers
  ~ Jeeva ~

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 ques

2011-05-27 Thread Logic King
http://samples.msdn.microsoft.com/ietestcenter/


On Fri, May 27, 2011 at 9:40 AM, radha krishnan 
radhakrishnance...@gmail.com wrote:

 Check whether this is storing  Google  Search Results ? ? ?? ? ? ? ? ??
 [HONEY POTTING]


 On Fri, May 27, 2011 at 10:07 PM, UTKARSH SRIVASTAV 
 usrivastav...@gmail.com wrote:

 test cases for internet explorer

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


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Odd Even Sort array

2011-05-27 Thread saurabh singh
Yup...I think thats the way to go...modify heap sort...'ignoring the odd
childs' for ascending and ignoring the even child for decending.
If i am wrong in this then quick sort has to be the solution.
On Sat, May 28, 2011 at 8:44 AM, subramania jeeva subramaniaje...@gmail.com
 wrote:

 I hope merge sort is not an inplace sorting.. It'll take extra space (in
 function merge) and since it uses recursion it'll also take stack space..
 I think this sol will work.
   1. partition the array by holding the even elements on first space(n/2 or
 n/2-1 depends on odd sized and even sized array) of array and odd elements
 in last n/2 space of array.
   2. Do heapsort by using both min heap and maxheap  by having 0 and
 (sizeof even elements) as root of heap.
   3. Heap don't use extra space and time complexity is O(nlgn).













 Cheers
   ~ Jeeva ~



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



Re: [algogeeks] Re: sum of two

2011-05-27 Thread sukhmeet singh
ya .. it can work for negative indexes also if the bound is known.. like if
the range is from -10 to +10 then declare an array of 20 and then refer
a[10] as a[0] and use negative indexes to do the same procedure !!

On Fri, May 27, 2011 at 2:32 PM, bhavana bhavana@gmail.com wrote:

 hey...bt this one works only in case given that the elements of the array
 are non-negative.


 On Fri, May 27, 2011 at 2:30 PM, bhavana bhavana@gmail.com wrote:

 @sukhi : instead of using a map...use a boolean array elements of whoch r
 initialised to false.

 Starting frm the first element of the arrayif the number n is greater
 than k ignore itelse mark a[n]=true and check if a[k-n]==true then we
 get the required result .bt if we reach the end of array without
 entering the if condition the array doesnt contain any such pair.


 On Fri, May 27, 2011 at 2:26 PM, sukhmeet singh 
 sukhmeet2...@gmail.comwrote:

 @bhavana : Explain..!!
 as far as i get you is that  it would  be same as implementing map ...!!
 isn't ??


 On Fri, May 27, 2011 at 2:16 PM, bhavana bhavana@gmail.com wrote:

 can be solved easily if the elements of the array lie in a limited range
 which can b known beforehand...!!


 On Fri, May 27, 2011 at 2:10 PM, Aakash Johari 
 aakashj@gmail.comwrote:

 yes, you are right. map insertion takes O(log n) time. so if you know
 the upper bound of N, you can simply map the existence/non-existence of 
 any
 particular element in an array. that will be in constant time (for query
 purposes) and O(n) time for preprocessing.


 On Fri, May 27, 2011 at 1:29 AM, sukhmeet singh 
 sukhmeet2...@gmail.com wrote:

 @Dave nd @Akash can u explain a bit more.. I didn't get what u say..
 Inserting in a map takes O(log n)  time !!

 On Fri, May 20, 2011 at 8:35 PM, Aakash Johari aakashj@gmail.com
  wrote:

 @Dave: This is what is still a doubt to me. I have searched but
 couldn't get the info regarding this.


 On Fri, May 20, 2011 at 8:01 AM, Dave dave_and_da...@juno.comwrote:

 @Aakash: And tell me how map works. Is making an entry O(1)
 regardless
 of the value of the entry? For example, is it O(n) to map the
 sequence
 1, 4, 9, 16, 25, ..., n^2?

 Dave

 On May 20, 9:39 am, Aakash Johari aakashj@gmail.com wrote:
  @Dave: I got you. I will have to check before pushing the element
 in map.
 
 
 
 
 
  On Fri, May 20, 2011 at 7:30 AM, Dave dave_and_da...@juno.com
 wrote:
   @Aakash: Yeah, but try the same array with sum = 6 and see what
   happens.
 
   Dave
 
   On May 20, 9:04 am, Aakash Johari aakashj@gmail.com
 wrote:
int main()
{
int a[10] = {5, 3, 10, 9, 8, 23, 11, 4, 12, 6};
int i;
int sum;
int flag = 0;
 
mapint, int m;
 
for ( i = 0; i  10; i++ ) {
m[a[i]] = 1;
}
 
sum = 13;
 
for ( i = 0; i  10; i++ ) {
if ( m[sum - a[i]] == 1 ) {
flag = 1;
break;
}
}
 
if ( flag == 1 )
cout  a[i] sum - a[i]  endl;
 
return 0;
 
}
On Fri, May 20, 2011 at 7:01 AM, hari rajakin...@gmail.com
 wrote:
 We can sort using STL sort function in main() before
 function call of
 arraysum().
 
 On May 20, 6:49 am, Gunjan Sharma gunjan.khan...@gmail.com
 wrote:
  First of all there is an infinite loop in this code
  Secondly it works only for sorted array.
 
  On Fri, May 20, 2011 at 7:16 PM, hari 
 rajakin...@gmail.com wrote:
   In while loop have i,j which points first and last index
 of array.
   In
   while loop, Check the sum of a[i],a[j], If
 sumk,increment i or
   else
   decrement j. Run the while loop till ij..
 
   CODE:
 
   int arraysum(int a[], int k, int i, int j)
   while(ij)
   {
int p=0;
int b[10]; //to store index of selected nos
sum=a[i]+a[j];
if (sum==k)
{
b[p++]=i;b[p++]=j;
}
elseif(sumk)
i++;
else(sumk)
j++;
return b;
   }
 
   On May 20, 4:38 am, amit amitthecoo...@gmail.com
 wrote:
given an array of integers, and an integer k, find out
 two
   elements
from the array whose sum is k in O(n) time. if no such
 element
   exists
output none.
 
   --
   You received this message because you are subscribed to
 the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to
 algogeeks@googlegroups.com.
   To unsubscribe from 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
  Gunjan Sharma
  B.Tech IV year CSE
 
  Contact No- +91 9997767077
 
 --
 You received this message because you are subscribed to the
 

Re: [algogeeks] Odd Even Sort array

2011-05-27 Thread Logic King
@ross
i can do it in O(n) time using an extra array of the same size as the given
array

first sort both the even indexed terms and odd indexed terms by modifying
quick sort...it can be done in one traversal.

and then using extra array and then move the even indexed terms followed by
odd indexed terms
i think it should work..

if anyone have the idea that can reduce the space required then please share
!!

On Fri, May 27, 2011 at 1:29 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 how large n will be...O(n) can't grow more than O(nlogn)so in any
 case the complexity is going to be O(nlogn)..so i dnt see any point of
 bringing our any modification of mergersort...even if u think so,
 provide a concrete algo

 On 5/28/11, LALIT SHARMA lks.ru...@gmail.com wrote:
  It will give correct answer ,
  but instead of doing manipulation after taking input.
  as it would take some O(n) time. if n would be large , we would incur
  this extra cost .
 
  we should change the termination condition of merge-sort function and
  modify the merge function of merge sort ..to reach our objective .
 
  correct me , if i am wrong ...
 
  On Sat, May 28, 2011 at 1:40 AM, Piyush Sinha ecstasy.piy...@gmail.com
  wrote:
  main()
  {
int a[100];
int i,j,N;
printf(enter the number of elements: );
scanf(%d,N);
for(i=0;iN;i++)
  scanf(%d,a[i]);
if(N%2) j = N/2+1;
else j = N/2;
i =1;
while(jN)
{
  swap(a[i],a[j]);
  i+=2;
  j+=2;
}
if(N%2){
   inv_mergesort(a,0,N/2);//sort the array in descending order
   mergesort(a,N/2+1,N-1);
}
else{
 inv_mergesort(a,0,N/2-1);//sort the array in descending order
  mergesort(a,N/2,N-1);
}
 
for(i=0;iN;i++)
   printf(%d,a[i]);
  }
 
  I hope the code doesn't contain any bugs...:P :P
 
  On 5/28/11, srajan dongre srajan.don...@gmail.com wrote:
  wat about insertion sort (with some limited conditions obviously )  ??
 
  On Sat, May 28, 2011 at 12:56 AM, Piyush Sinha
  ecstasy.piy...@gmail.comwrote:
 
  will it be given that the number of elements is always even??
 
  On 5/28/11, ross jagadish1...@gmail.com wrote:
   Hi all,
  
   Sort all elements in odd indices of an array in ascending order and
   even indices in descending order.
   Finally, rearrange so that all even indexed elements come first.
  
   eg:
  
   input – 7 2 6 4 8 3 1
  
   even indexed : 7 6 8 1 = sort 8 7 6 1
   odd indexed: 2 4 3 = sort 2 3 4
  
   output – 8 7 6 1 2 3 4
  
   What could be the best algo to solve it?
   Is it possible to arrive at the output using only O(1) extra space?
  
   --
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
  
  
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  --
 
  Srajan Dongre
  ||nd year  CSI (dual degree)
  Indian Institute of Technology , Roorkee
  Uttrakhand , India
  pin code--247667
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  *Piyush Sinha*
  *IIIT, Allahabad*
  *+91-8792136657*
  *+91-7483122727*
  *https://www.facebook.com/profile.php?id=10655377926 *
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
 
  --
  Lalit Kishore Sharma,
  IIIT Allahabad (Amethi Capmus),
  6th Sem.
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, 

[algogeeks] Re: sum of two

2011-05-27 Thread Dave
If map insertion is O(log n), then the algorithms that insert each
element into the map will be O(n log n), but the problem statement
insists that we find two elements of the array that sum to a given
number in O(n) time. Thus, Aakash's solution (http://groups.google.com/
group/algogeeks/msg/541180b4f2d6c930) using map doesn't satisfy the
time requirement.

Dave

On May 27, 3:38 am, anshu mishra anshumishra6...@gmail.com wrote:
 map is internally implemented with balanced binary tree and inserting in a
 BST is o(logn);

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: sum of two

2011-05-27 Thread Aakash Johari
@Dave: I have suggested another solution in previous threads. Please go
through that. That is without maps. It uses array for mapping.

On Fri, May 27, 2011 at 10:09 PM, Dave dave_and_da...@juno.com wrote:

 If map insertion is O(log n), then the algorithms that insert each
 element into the map will be O(n log n), but the problem statement
 insists that we find two elements of the array that sum to a given
 number in O(n) time. Thus, Aakash's solution (http://groups.google.com/
 group/algogeeks/msg/541180b4f2d6c930) using map doesn't satisfy the
 time requirement.

 Dave

 On May 27, 3:38 am, anshu mishra anshumishra6...@gmail.com wrote:
  map is internally implemented with balanced binary tree and inserting in
 a
  BST is o(logn);

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.