Re: [algogeeks] complexity

2011-07-28 Thread sachin sharma
it is O(plg5)


Best Wishes
Sachin Sharma

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

2011-07-28 Thread Puneet Gautam
@sachin: Explain pls...!!?


On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote:
 it is O(plg5)


 Best Wishes
 Sachin Sharma

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

2011-07-28 Thread sagar pareek
+1 @ankur  :)

On Wed, Jul 27, 2011 at 11:23 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote:

 one request : dont use trubo C


 On Wed, Jul 27, 2011 at 10:23 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 I m getting o/p
 1
 2 1 1
 1
 2 2 1
  but on wards when x=y=z= -1
 then i m getting something different o/p.

 On Wed, Jul 27, 2011 at 10:18 PM, Jnana Sagar 
 supremeofki...@gmail.comwrote:

 what do u mean by o/p..actually what r u asking for..sorry to ask
 so..i couldn't get u..

 On 7/27/11, Vijay Khandar vijaykhand...@gmail.com wrote:
  #includestdio.h
  #includeconio.h
  void main()
  {
  clrscr();
  int x,y,z;
  x=y=z=1;
  printf(\n %d,++x||++y++z);
  printf(\n %d %d %d ,x,y,z);
  x=y=z=1;
  printf(\n %d,++x++y||++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=1;
  printf(\n %d,++x++y++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x++y||++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x||++y++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x++y++z);
  printf(\n %d %d %d,x,y,z);
  getch();
  }
 
  plz anyone provide the o/p for this program.I m very much
  confusing
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

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




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

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



Re: [algogeeks] Logical operator question

2011-07-28 Thread Prem Krishna Chettri
Can SomeOne verify the Compilation as ..

1
211
1
221
1
222
0
0-10
0
00-1
0
0-1-1

Thx..

On Thu, Jul 28, 2011 at 11:47 AM, sagar pareek sagarpar...@gmail.comwrote:

 +1 @ankur  :)


 On Wed, Jul 27, 2011 at 11:23 PM, Ankur Khurana 
 ankur.kkhur...@gmail.comwrote:

 one request : dont use trubo C


 On Wed, Jul 27, 2011 at 10:23 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 I m getting o/p
 1
 2 1 1
 1
 2 2 1
  but on wards when x=y=z= -1
 then i m getting something different o/p.

 On Wed, Jul 27, 2011 at 10:18 PM, Jnana Sagar 
 supremeofki...@gmail.comwrote:

 what do u mean by o/p..actually what r u asking for..sorry to ask
 so..i couldn't get u..

 On 7/27/11, Vijay Khandar vijaykhand...@gmail.com wrote:
  #includestdio.h
  #includeconio.h
  void main()
  {
  clrscr();
  int x,y,z;
  x=y=z=1;
  printf(\n %d,++x||++y++z);
  printf(\n %d %d %d ,x,y,z);
  x=y=z=1;
  printf(\n %d,++x++y||++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=1;
  printf(\n %d,++x++y++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x++y||++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x||++y++z);
  printf(\n %d %d %d,x,y,z);
  x=y=z=-1;
  printf(\n %d,++x++y++z);
  printf(\n %d %d %d,x,y,z);
  getch();
  }
 
  plz anyone provide the o/p for this program.I m very much
  confusing
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

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


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



Re: [algogeeks] Re: interview ques

2011-07-28 Thread Puneet Gautam
@bharath: To store the bunch of records together also, we gonna need
another useful ds like linked list or array which again points to
the problem of excessive storage or excessive pointers...
correct me if am not..!



On 7/28/11, bharath bharath.sri...@gmail.com wrote:
 @Dumanshu: A B+ tree is a multi-level index. It indexes the index
 until the final level is small enough to fit into a data block that
 can fit in memory.

 On Jul 27, 10:11 pm, Dumanshu duman...@gmail.com wrote:
 Use multilevel indexing

 On Jul 27, 11:07 pm, himanshu kansal himanshukansal...@gmail.com
 wrote:







  if u hv say 20 million records and u have to create a b+ tree then you
  might be storing 20 million pointers at the leaf levelhow can u
  optimize this(using b+ tree only)???

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



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



Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Tyler Durden
@Rajeev:
How will you update the position of each element in the linked list after 
removing a particular element? Won't you have to traverse the list 
completely in which case your algo will be O(n^2) ??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/Jylnk0KFxy0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] complexity

2011-07-28 Thread Rajeev Kumar
@Puneet,
 get_power(int a, int b) works in O(logb) as you keep on dividing b with
2...
you are calling that method *P *times in *func(int p) *method.
So it is *plogb...*u r passing 5 as b valueit will be *plog5*

On Thu, Jul 28, 2011 at 11:45 AM, Puneet Gautam puneet.nsi...@gmail.comwrote:

 @sachin: Explain pls...!!?


 On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote:
  it is O(plg5)
 
 
  Best Wishes
  Sachin Sharma
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




-- 
Thank You
Rajeev Kumar

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



Re: [algogeeks] complexity

2011-07-28 Thread Puneet Gautam
k...thanks...


On 7/28/11, Rajeev Kumar rajeevprasa...@gmail.com wrote:
 @Puneet,
  get_power(int a, int b) works in O(logb) as you keep on dividing b with
 2...
 you are calling that method *P *times in *func(int p) *method.
 So it is *plogb...*u r passing 5 as b valueit will be *plog5*

 On Thu, Jul 28, 2011 at 11:45 AM, Puneet Gautam
 puneet.nsi...@gmail.comwrote:

 @sachin: Explain pls...!!?


 On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote:
  it is O(plg5)
 
 
  Best Wishes
  Sachin Sharma
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




 --
 Thank You
 Rajeev Kumar

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



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



Re: Re : [algogeeks] Re: size of self referential structure

2011-07-28 Thread sunny agrawal
Okay.
I was a bit wrongactually the thing is that
The exact number of bytes allocated for various C data types depends on *both
the machine and the compiler.**

*so it may be the that the compiler u are using is 32 bit..
one thing that u can try out is that on ubuntu install 64 bit codeblocks
ide. i think u will get size of pointers as 8 bytes.

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



Re: [algogeeks] puzzle

2011-07-28 Thread Hemalatha
Give all the primary and  secondary diagonal Elements a value -1 and the
rest as 1s.

-1 1 1 1 1 -1
1 -1 1 1 -1 1
1 1 -1 -1 1 1
1 1 -1 -1  1 1
1 -1 1 1 -1 1
-1 1 1 1 1 -1


Regards
Hemalatha

On Thu, Jul 28, 2011 at 11:29 AM, priyanka goel priya888g...@gmail.comwrote:

 @ SkRiPt...
 can u pl explain ur ans?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-07-28 Thread sunny agrawal
@Hemlatha
this is one of the possible solution

the Question is to find Number of such solutions

On Thu, Jul 28, 2011 at 12:09 PM, Hemalatha 
hemalatha.amru...@googlemail.com wrote:

 Give all the primary and  secondary diagonal Elements a value -1 and the
 rest as 1s.

 -1 1 1 1 1 -1
 1 -1 1 1 -1 1
 1 1 -1 -1 1 1
 1 1 -1 -1  1 1
 1 -1 1 1 -1 1
 -1 1 1 1 1 -1


 Regards
 Hemalatha


 On Thu, Jul 28, 2011 at 11:29 AM, priyanka goel priya888g...@gmail.comwrote:

 @ SkRiPt...
 can u pl explain ur ans?

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




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



Re: [algogeeks] Re: size of self referential structure

2011-07-28 Thread Jnana Sagar
@aditya..the answer may vary, because c is machine dependent
language..in few machines int is of 2 bytes and char is of 1 byte..u
can't say..it varies with diff machines

On 7/26/11, aditya kumar aditya.kumar130...@gmail.com wrote:
 char *s[5] is a array of pointers of type char . but the thing is size of
 pointers is 4byte irrespective of its type . coz address is always an
 unsigned int which is of 4byte.
 On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam
 puneet.nsi...@gmail.comwrote:

 @everyone:
 I have this mind strangling doubt..!!!

 Why is char *s[5] of 20 bytes...?

 yes the output is 28...

 On 7/26/11, Don dondod...@gmail.com wrote:
  A reasonable guess would be 28 bytes. But the size of a structure is
  implementation dependent, and therefore, some other result could be
  correct as well.
  Don
 
  On Jul 26, 7:40 am, Puneet Gautam puneet.nsi...@gmail.com wrote:
  #includestdio.h
  #includestddef.h
  struct node{
 int a;
 char *b[5];
 struct node *link;
 };
  main()
  {
int a;
a=sizeof(struct node);
printf(%d,a);
getchar();
return 0;
}
 
  Whats the output..?
 
  --
  You received this message because you are subscribed to the Google
  Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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



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



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



Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Deoki Nandan
there is no specification on complexity . if input matrix is
1 2 3
4 5 6
7 8 9
then after 180 rotation output should be
1 2 3 6  9 8 7 4 5

On Wed, Jul 27, 2011 at 11:34 PM, amit karmakar
amit.codenam...@gmail.comwrote:

 If you meant rotate a 2D matrix by angle 180 of order n x n
 Then you cannot have a O(n) algo, Each of the n^2 elements must be
 accessed so you cannot have anything less than n^2

 On Jul 27, 10:59 pm, Puneet Gautam puneet.nsi...@gmail.com wrote:
  Can anyone give an O(n) solution pls...??
  I think the above code is an O(n^2) solution..
  if i am not wrong...!!!
 
  On 7/27/11, amit amit.codenam...@gmail.com wrote:
 
 
 
   #include cstdio
   #include algorithm
   using namespace std;
 
   const int MX = 1000;
   int n, m;
   int a[MX][MX];
 
   int main() {
   scanf(%d%d, n, m);
   for(int i = 0; i  n; i++)
   for(int j = 0; j  m; j++)
   scanf(%d, a[i][j]);
 
   for(int i = 0; i  n/2; i++)
   for(int j = 0; j  m; j++)
   swap(a[i][j], a[n-i-1][m-j-1]);
   if(n1)
   for(int j = 0; j  m/2; j++)
   swap(a[n/2][j], a[n/2][m-j-1]);
 
   for(int i = 0; i  n; i++) {
   for(int j = 0; j  m; j++)
   printf(%d , a[i][j]);
   printf(\n);
   }
   }
 
   On Jul 27, 7:54 pm, Anika Jain anika.jai...@gmail.com wrote:
   is it lyk for {1,2,3
  4,5,6,
  7,8,9}
   to be {3,2,1,
6,5,4,
9,8,7}??
 
   On Wed, Jul 27, 2011 at 9:37 AM, Deoki Nandan deok...@gmail.com
 wrote:
rotate a 2D matrix by angle 180
 
--
**With Regards
Deoki Nandan Vishwakarma
 
*
*
 
 --
You received this message because you are subscribed to the Google
Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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.




-- 
**With Regards
Deoki Nandan Vishwakarma

*
*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-07-28 Thread sunny agrawal
yes 2^((n-1)^2) is the answer :)

consider a row or column of size n, Number of ways it can we filled with 1's
and -1's(such that product is 1) is
sum of all nCi where i = 0,2,4. (i = no of -1s) and that will be 2^(n-1)
(same is the number when product is -1 )
so now let f(i,j) is the number of ways to fill the matrix of size i,j
then
f(i,j) = 2^(i-2)*2^(j-2)*f(i-1)(j-1)*2
where f(1,1) = 1;

explanation for f(i,j)
matrix of size (i,j) can be broken into four parts = matrix of size(i-1,j-1)
+ jth column of size i-1+ ith row
of size (j-1) + element at[i,j]

so ans is
number of ways matrix [i-1][j-1] can be filled is f(i,j) multiplied with
when both row and col are 1 and element is 1 or both row and col are -1 and
ele is -1

solving the equation for f(n,n) will give 2^((n-1)^2)

@skript
my method is little bit complexhow did u arrived at solution.is
there a simple way to get to the same answer?


On Thu, Jul 28, 2011 at 12:11 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 @Hemlatha
 this is one of the possible solution

 the Question is to find Number of such solutions

 On Thu, Jul 28, 2011 at 12:09 PM, Hemalatha 
 hemalatha.amru...@googlemail.com wrote:

 Give all the primary and  secondary diagonal Elements a value -1 and the
 rest as 1s.

 -1 1 1 1 1 -1
 1 -1 1 1 -1 1
 1 1 -1 -1 1 1
 1 1 -1 -1  1 1
 1 -1 1 1 -1 1
 -1 1 1 1 1 -1


 Regards
 Hemalatha


 On Thu, Jul 28, 2011 at 11:29 AM, priyanka goel 
 priya888g...@gmail.comwrote:

 @ SkRiPt...
 can u pl explain ur ans?

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




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




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



Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Rajeev Kumar
@Tayler : That's y i am using Java ArrayList instead of linked list where
arrayList maintains element position.But problem is when an element is
removed from the list,all subsequent elements to be moved forward
Please check javadoc of arrayList :
http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html

On Thu, Jul 28, 2011 at 11:58 AM, Tyler Durden abhishek.khattr...@gmail.com
 wrote:

 @Rajeev:
 How will you update the position of each element in the linked list after
 removing a particular element? Won't you have to traverse the list
 completely in which case your algo will be O(n^2) ??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/Jylnk0KFxy0J.

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




-- 
Thank You
Rajeev Kumar

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



Re: [algogeeks] Small Doubt

2011-07-28 Thread MANNU
@Prem: Each program is provided with a pool of address, which consist
of heap, stack etc.
 My question is that if I write an address 0xff which is
not provided to that program then
 what will be the output?

On 7/28/11, Prem Krishna Chettri hprem...@gmail.com wrote:
 First of all this is a good Question as this is use regularly in Device
 Driver kind of Development Mode and hence there is no question of Not
 Possible.

 So how to Do it is Question. which is as follows :-

 Point your pointer to mem add that U want and Now this Mem Add is HEX guys
 (Not 4 or 5 or any base 10 val) , so put it as 0x(whatever U want).

 Do whatever  U want to do on that address using that pointer now.

 The Code above is correct but the implementation is wrong so...


 #includestdio.h
 int main()
 {
int *p = (int *)0xff;
   // *p = 4; /** Dude can U put hex val here .. Oh its already assigned
 to 0xff..  **/ Now print it coutpendl;
return 0;
 }

 Regards
  Prem

 On Thu, Jul 28, 2011 at 10:44 AM, Tyler Durden abhishek.khattr...@gmail.com
 wrote:

 @Ankita: So when is 4000 memory address is allotted?? I mean what use does
 int *p = 4000 serve here??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/0OU6tMQudMoJ.

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


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



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



Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Tyler Durden
@Rajeev: Okay, I am using C which has no such facilities of auto indexing 
the list..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/BsMmVwxw_T4J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Small Doubt

2011-07-28 Thread Prem Krishna Chettri
Hey.. good To have your Question . Well lemme try to elaborate things here
as i cannot use WhiteBoard . So Srry guys... :(

Well partly you have answered your question and some part can even be
reflected in the above thread of virtual - physical mem mapping. using MMU..
So I wont go beyond MMU.

Here it goes.

Well if you write a prg.. when it bcme process, OS assign a  bunch of ID as
Address which it can use in sense. However, this address are not what is
real add.there is what MMU kicks in...

So if 0xff U think is assigned its not actually its is mapped with something
like this .. PID + 0x0ff = xyzxyx( Hell anything let the OS answer it). that
MMU issue.

So, the question here is wat the case if the house you want is not in your
area. Dude you are not a kind to cry infront of your parent to get one for
U..

Similarly, OS will not give you the access directly to physical Mem ( under
his control ) hence, the pointer allocation may fail.

Now here comes the compiler of whatever type say g++ which may silently say
dude that house you want is unavailable or may keep quiet... but complains
when you are in need to stay in that house , or rather when you try to put
something within it.

So, the direct answer to your question is definitely your design of
Compiler. but rather I would like to say, the pointer allocation fails to
prove your address allocation.

Does that makes sense. lemme know for more without whiteboard.. :)

Regards
 Prem




On Thu, Jul 28, 2011 at 1:26 PM, MANNU manishkr2...@gmail.com wrote:

 @Prem: Each program is provided with a pool of address, which consist
 of heap, stack etc.
 My question is that if I write an address 0xff which is
 not provided to that program then
 what will be the output?

 On 7/28/11, Prem Krishna Chettri hprem...@gmail.com wrote:
  First of all this is a good Question as this is use regularly in Device
  Driver kind of Development Mode and hence there is no question of Not
  Possible.
 
  So how to Do it is Question. which is as follows :-
 
  Point your pointer to mem add that U want and Now this Mem Add is HEX
 guys
  (Not 4 or 5 or any base 10 val) , so put it as 0x(whatever U want).
 
  Do whatever  U want to do on that address using that pointer now.
 
  The Code above is correct but the implementation is wrong so...
 
 
  #includestdio.h
  int main()
  {
 int *p = (int *)0xff;
// *p = 4; /** Dude can U put hex val here .. Oh its already
 assigned
  to 0xff..  **/ Now print it coutpendl;
 return 0;
  }
 
  Regards
   Prem
 
  On Thu, Jul 28, 2011 at 10:44 AM, Tyler Durden 
 abhishek.khattr...@gmail.com
  wrote:
 
  @Ankita: So when is 4000 memory address is allotted?? I mean what use
 does
  int *p = 4000 serve here??
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To view this discussion on the web visit
  https://groups.google.com/d/msg/algogeeks/-/0OU6tMQudMoJ.
 
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 

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



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



Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Rajeev Kumar
@puneet

Can you give us an example what u mean by 180 degree rotation...
For given matrix like
1, 2,   3, 4
5, 6,   7, 8
9,10,11,  12
13,14,15,16

What is the expected output?

On Wed, Jul 27, 2011 at 11:29 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:

 Can anyone give an O(n) solution pls...??
 I think the above code is an O(n^2) solution..
 if i am not wrong...!!!



 On 7/27/11, amit amit.codenam...@gmail.com wrote:
  #include cstdio
  #include algorithm
  using namespace std;
 
  const int MX = 1000;
  int n, m;
  int a[MX][MX];
 
  int main() {
  scanf(%d%d, n, m);
  for(int i = 0; i  n; i++)
  for(int j = 0; j  m; j++)
  scanf(%d, a[i][j]);
 
  for(int i = 0; i  n/2; i++)
  for(int j = 0; j  m; j++)
  swap(a[i][j], a[n-i-1][m-j-1]);
  if(n1)
  for(int j = 0; j  m/2; j++)
  swap(a[n/2][j], a[n/2][m-j-1]);
 
  for(int i = 0; i  n; i++) {
  for(int j = 0; j  m; j++)
  printf(%d , a[i][j]);
  printf(\n);
  }
  }
 
 
  On Jul 27, 7:54 pm, Anika Jain anika.jai...@gmail.com wrote:
  is it lyk for {1,2,3
 4,5,6,
 7,8,9}
  to be {3,2,1,
   6,5,4,
   9,8,7}??
 
 
 
  On Wed, Jul 27, 2011 at 9:37 AM, Deoki Nandan deok...@gmail.com
 wrote:
   rotate a 2D matrix by angle 180
 
   --
   **With Regards
   Deoki Nandan Vishwakarma
 
   *
   *
 
--
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.




-- 
Thank You
Rajeev Kumar

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



[algogeeks] C output

2011-07-28 Thread Aman Goyal
#include‹stdio.h›
main()
{
struct xx
{
int x;
struct yy
{
char s;
struct xx *p;
};
struct yy *q;
};
}

ouput: compiler error.

Any logical reasons?

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

2011-07-28 Thread amit
This should be O(2^n)

#include cstdio
#include cstring
using namespace std;

int n;
int sol[1000];
void solve(int pos, int k) {
for(int i = 0; i  k; i++) printf(%d, , sol[i]);
putchar('\n');
for(int i = pos; i  n; i++) {
sol[k] = i+1;
solve(i+1, k+1);
}
}

int main() {
scanf(%d, n);
solve(0, 0);
}


On Jul 27, 8:33 pm, Ankur Garg ankurga...@gmail.com wrote:
 Hi

 The solution in the link is of complexity (n*2^n))

 Does anyone know any better solution ?

 Regards
 Ankur
 On Tue, Jul 26, 2011 at 11:10 PM, rajeev bharshetty 
 rajeevr...@gmail.comwrote:



  @Ankur The link does has a very good explanation. Nice solution :)

  On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil kp101...@gmail.com wrote:

  @Ankur Garg: Nice explanation at the link given by u...

  On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.comwrote:

  Check this

 http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html

  On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki 
  vishaltha...@gmail.comwrote:

  Here is the working code..

  #include stdio.h
  #include stdlib.h
  int a[] = {1,2,3,4,5};
  #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
  void print_comb(int len)
  {
         int tlen = len;
         int i, j, k;
          int al = ARRLEN(a);
         for (i = 0; i  al; i++) {
                 for (j=i+len-1; jal;j++) {
                 for (k = i; k  i+len-1; k++) {
                         printf(%d , a[k]);
                 }
                 printf(%d\n, a[j]);
                  }
         }
  }

  int main(int argc, char *argv[])
  {
         int len = atoi(argv[1]);
          print_comb(len);
         return 0;
  }

  On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com
  wrote:

   check this link:

   *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*

   On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com
  wrote:

   Given an array of size n, print all the possible subset of array of
   size k.
   eg:-
   input:
   a[]={1,2,3,4}, k = 2
   output:
   1,2
   1,3
   1,4
   2,3
   2,4
   3,4

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

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

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

  --
  Regards
  Rajeev N B http://www.opensourcemania.co.cc

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

2011-07-28 Thread Aman Goyal
c(n,2) * c(n,2)

On Wed, Jul 27, 2011 at 11:07 PM, siva viknesh sivavikne...@gmail.comwrote:

 No. rectangles in NxN matrix

 ... is it   n^2 + (n-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.



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

2011-07-28 Thread Vijay Khandar
Now got it Thanks...

On Wed, Jul 27, 2011 at 11:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 The output is 10101101
 consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) -
 f(2) - f(1)
   1   0 110
 1   01

 Hope you get the recursion there .

 On Wed, Jul 27, 2011 at 11:19 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 int f(int n)
 {
 if(n=1)
 {
 printf( %d,n);
 }
 else
 {
 f(n/2);
 printf( %d,n%2);
 }
 }

 void main()
 {
 clrscr();
 f(173);
 getch();
 }

 o/p-1 0 1 0 1 1 0 1
 but i m getting  1 0 1 1 0 1 0 1

 plz explain me...

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




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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

2011-07-28 Thread Aman Goyal
yes this will be the case.

On Wed, Jul 27, 2011 at 11:35 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:

 @nikhil:So what u mean is that if i have:

 struct{
 int a;
 char b[5];
 };

 the size of this struct's node will be 12 not 9.., to make it a multiple of
 4??



 On 7/26/11, Nikhil Gupta nikhilgupta2...@gmail.com wrote:
  Padding is not a topic of self referential structure.
 
  Padding means that extra spaces of memory are used by the compiler to
  allocate memory. This is done to have the memory address as a multiple of
  the size of the variable. This speeds up the processing of these
 variables
  by the compiler.
 
  On Tue, Jul 26, 2011 at 8:09 PM, Puneet Gautam
  puneet.nsi...@gmail.comwrote:
 
  what is meant by padding in self_referenced structure?
  Is it always necessary?
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Nikhil Gupta
  Senior Co-ordinator, Publicity
  CSI, NSIT Students' Branch
  NSIT, New Delhi, India
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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] DE Shaw - Data Structure Section Qn

2011-07-28 Thread Akshata Sharma
using array, we can do in O(logn) always as it is ordered. If all values
hash to same bucket in case of hashtable, it would be O(n) worse case

On Thu, Jul 28, 2011 at 12:03 AM, rajeev bharshetty rajeevr...@gmail.comwrote:

 Hash Table with Bucket , made of linked list .

 At most if all n values hash to same bucket then at worst case we must
 traverse n linked list nodes to find the element.

 Hope it is clear


 On Wed, Jul 27, 2011 at 11:59 PM, Reynald reynaldsus...@gmail.com wrote:

 Which of the following data structure do better job (has lesser time
 complexity) at searching elements that has a worst-case time
 complexity of O(n)? Do not account for the cost of building the Data
 structure in searching cost.
 a) Linked list with element sorted by value
 b) Binary tree with no ordering
 c) Ordered array
 d) Hast table with bucket, made up of linked list, where linked list
 have no ordering.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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

2011-07-28 Thread Aman Goyal
(C(n+1,2))* (C(n+1,2))

choosing any two rows from n+1 rows, and any two columns from n+1 columns
will yield a rectangle .
So solution is the no of possible combinations.

On Wed, Jul 27, 2011 at 11:23 PM, Abhinav Arora
abhinavdgr8b...@gmail.comwrote:

 It will be (1+2+3+,,,+n)^2.u can verify it for a chess board hich will
 have 1296 rectangles for n=8

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/Yka7s3mbdwAJ.

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: how to calculate the complexity

2011-07-28 Thread bharath
Master's theorem is for recursive programs only. In general, there is
no golden rule to calculate time complexity.
Few pointers are to identify the key operations (eg - loops) and
analyze the estimated running time based on a input size.

On Jul 27, 2:46 pm, rajeev bharshetty rajeevr...@gmail.com wrote:
 Masters Theoremhttp://en.wikipedia.org/wiki/Master_theorem

 On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA coolguyinat...@gmail.comwrote:

  Can anybody explain the basic steps that how to calculate the
  complexity of an algo so that i would be able to find complexity of
  any program

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Blocked/Unrolled linked list with no duplicates and sorted

2011-07-28 Thread banu
Anyone ?

On Jul 26, 10:27 pm, banu varun.nagp...@gmail.com wrote:
 Hi,
 Basically I am trying to create a blocked linked list(unrolled linked
 list) with following properties
 - Configurable number of elements in each node
 - No duplicate elements in the unrolled linked list
 - Linked list is sorted either during insertion or after creating the
 linked list
 - In place

 Assuming I need to create a sorted unrolled linked list with no
 duplicate elements with block size say 2

 Example: 10,2,4,2,5,7,9.11,11,5

 Final blocked linked list: (2,4)-(5,7)-(9,10)-(11,x) or in reverse
 order

 Note: x means unutilized location in the array wihtin the node. In
 case there are not enough elements to insert in a node, some memory
 allocated for a node is unutilized

 // Following is node structure
 #define ARRAY_SZ 2
 typedef struct node
 {
     struct node* next;
     long long int elements[ARRAY_SZ];
     long long int elemIndex;

 }NODE, *NODE_PTR;

 Can you suggest me a way to do this correctly and efficiently? It
 could be an pseudo text or C-code.

 Thanks
 Varun

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



Re: [algogeeks] how to calculate the complexity

2011-07-28 Thread Anish Kumar
Masters' Theorem can be applied only to Divide and Conquer kind of alogs. I
would suggest you to read the initial few chapters of Introduction to
Algorithms by Cormen.

Regards

On 28 July 2011 01:16, rajeev bharshetty rajeevr...@gmail.com wrote:

 Masters Theorem
 http://esudo apt-get install 
 python-lxmln.wikipedia.org/wiki/Master_theoremhttp://en.wikipedia.org/wiki/Master_theorem


 On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA coolguyinat...@gmail.comwrote:

 Can anybody explain the basic steps that how to calculate the
 complexity of an algo so that i would be able to find complexity of
 any program

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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




-- 
Anish S Kumar

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



Re: [algogeeks] Sparse matrix

2011-07-28 Thread Anish Kumar
I think this can help
http://en.wikipedia.org/wiki/Sparse_matrix#Storing_a_sparse_matrix

On 28 July 2011 00:45, aditi garg aditi.garg.6...@gmail.com wrote:

 can u plz elaborate...


 On Thu, Jul 28, 2011 at 12:04 AM, rajeev bharshetty 
 rajeevr...@gmail.comwrote:

 To store sparse matrix adjacency lists should be used rather than
 adjacency matrix ...


 On Thu, Jul 28, 2011 at 12:03 AM, aditi garg 
 aditi.garg.6...@gmail.comwrote:

 How wud u store a sparse matrix( whch has elemensts only below or abv
 the diagonal) in memory...what data structure u wud use and y?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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




 --
 Aditi Garg
 Undergraduate Student
 Electronics  Communication Divison
 NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
 Sector 3, Dwarka
 New Delhi

 9718388816

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




-- 
Anish S Kumar

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



Re: [algogeeks] puzzle

2011-07-28 Thread 석문기
The problem is finding the subspaces that satisfy two conditions in the 6*6
total space?

2011/7/28 vetri natarajananitha...@gmail.com

 given a 6x6 matrix with all the elements as either 1 or -1.
 find the number of ways the elements can b arranged such that

 1.the product of all elements of all columns is 1
 2.the product of all elements of all rows is 1

 can u pls post the answer if u no...

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



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



Re: [algogeeks] how to calculate the complexity

2011-07-28 Thread Puneet Gautam
Time complexity:

int get_power(int a, int b)
{
if(!b) return 1;
if(b%2) return a * get_power(a, b/2);
return get_power(a, b/2);
}
int func(int p)
{
int sum = 0;
for(int i = 1; i = p; ++i) {
sum += get_power(i, 5);
}
return sum;
}

O(plgp) or O(plg5)..? or anything else..?


On 7/28/11, sunny agrawal sunny816.i...@gmail.com wrote:
 Master theorem can be used when we know the recurrence relation.

 You can read the 2nd Chapter of CLRS..

 On Thu, Jul 28, 2011 at 1:16 AM, rajeev bharshetty
 rajeevr...@gmail.comwrote:

 Masters Theorem
 http://en.wikipedia.org/wiki/Master_theorem


 On Thu, Jul 28, 2011 at 1:14 AM, NITIN SHARMA
 coolguyinat...@gmail.comwrote:

 Can anybody explain the basic steps that how to calculate the
 complexity of an algo so that i would be able to find complexity of
 any program

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Rajeev N B http://www.opensourcemania.co.cc

 *Winners Don't do Different things , they do things Differently*

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



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

2011-07-28 Thread aditi garg
well im not sure bt i guess one possible reason could be that struct yy is a
member of struct xx..so a pointer of struct yy cannot be declared widout ref
to xx...

On Wed, Jul 27, 2011 at 9:52 PM, Aman Goyal aman.goya...@gmail.com wrote:

 #include‹stdio.h›
 main()
 {
 struct xx
 {
 int x;
 struct yy
 {
 char s;
   struct xx *p;
 };
 struct yy *q;
 };
 }

 ouput: compiler error.

 Any logical reasons?

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




-- 
Aditi Garg
Undergraduate Student
Electronics  Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

9718388816

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

2011-07-28 Thread ankit sambyal
In the question it is specified that the data structure should have a worst
case time complexity of O(N)

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



Re: [algogeeks] C output

2011-07-28 Thread Prem Krishna Chettri
Well, this is quiet obvious even the least follower of C struct can answer
it but the good part is why does compiler is design to do so..

Hope ppls do follow me in this activation rec..

 yy *q
 struct yy (defined in somewhere)
 x..

 Guys above notation is in stack so srry again for no Whiteboard..

and yy is now not to be found as the struct is defined inside of xx whose
scope is lost as soon as we come out of this activation stack but look the
joke of this code.

there is redefinition of yy inside xx and xx have no idea about the lost
activation rec regarding yy.. so xx (lol) is lost in some inconsistency and
ask compiler to answer it..

Compiler like a BAD tech lead say Dude.. M gonna throw u out and keeps
posted with this nasty error..

Make Sense.

Regards
 Prem



On Wed, Jul 27, 2011 at 9:52 PM, Aman Goyal aman.goya...@gmail.com wrote:

 #include‹stdio.h›
 main()
 {
 struct xx
 {
 int x;
 struct yy
 {
 char s;
   struct xx *p;
 };
 struct yy *q;
 };
 }

 ouput: compiler error.

 Any logical reasons?

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

2011-07-28 Thread prabhat
i think there will be warning due to inner structure is not declaring
variable.
Inner structure must be like:
struct yy
{
char s;
struct xx *p;
}a;

On Jul 27, 9:22 pm, Aman Goyal aman.goya...@gmail.com wrote:
 #include‹stdio.h›
 main()
 {
 struct xx
 {
 int x;
 struct yy
 {
 char s;
         struct xx *p;

 };
 struct yy *q;
 };
 }

 ouput: compiler error.

 Any logical reasons?

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

2011-07-28 Thread vj
O(lgn) in ordered array using binary search

On Jul 28, 1:44 pm, ankit sambyal ankitsamb...@gmail.com wrote:
 In the question it is specified that the data structure should have a worst
 case time complexity of O(N)

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



Re: [algogeeks] Re: Blocked/Unrolled linked list with no duplicates and sorted

2011-07-28 Thread sunny agrawal
Nice Problem :)

i think taking care of duplicates is very simple...but main point is
sorted insertion
that has to very carefully done
there are many cases that need to be taken care of
1. if the value to be inserted is between two nodes and both nodes are
fullthen a new node will be inserted in the link list and value to be
inserted will be the first element in the new node
case: (1,2)-(4,5) and 3 need to be inserted
after insertion list will be
(1,2)-(3,x)-(4,5)-NULL

2. else the value that need to be inserted will be inside some node...
if there is empty space in the nodesimply insert using insertion sort
(1,2)-(4,x) and 3 is to be inserted, insertion sort in node 2 will suffice
(1,2)-(3,4)-NULL
3. but if the node in which the value need to inserted is full then last
number from that node will be shifted to a new node and then insert the
value in the node.
if array_sz is large the one instead of shifting the last element u can
split into two halves and put first half in first and second in 2nd
(1,2)-(3,5)4 to be inserted
(1,2)-(1,4) -(5,x) -NULL
i think considering these 3 cases would suffice...although first case
can be merged with 3rd if programmed carefully


On Thu, Jul 28, 2011 at 3:35 AM, banu varun.nagp...@gmail.com wrote:

 Anyone ?

 On Jul 26, 10:27 pm, banu varun.nagp...@gmail.com wrote:
  Hi,
  Basically I am trying to create a blocked linked list(unrolled linked
  list) with following properties
  - Configurable number of elements in each node
  - No duplicate elements in the unrolled linked list
  - Linked list is sorted either during insertion or after creating the
  linked list
  - In place
 
  Assuming I need to create a sorted unrolled linked list with no
  duplicate elements with block size say 2
 
  Example: 10,2,4,2,5,7,9.11,11,5
 
  Final blocked linked list: (2,4)-(5,7)-(9,10)-(11,x) or in reverse
  order
 
  Note: x means unutilized location in the array wihtin the node. In
  case there are not enough elements to insert in a node, some memory
  allocated for a node is unutilized
 
  // Following is node structure
  #define ARRAY_SZ 2
  typedef struct node
  {
  struct node* next;
  long long int elements[ARRAY_SZ];
  long long int elemIndex;
 
  }NODE, *NODE_PTR;
 
  Can you suggest me a way to do this correctly and efficiently? It
  could be an pseudo text or C-code.
 
  Thanks
  Varun

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



Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Piyush Sinha
@amitno it wont work..check it..

On Wed, Jul 27, 2011 at 10:07 PM, amit amit.codenam...@gmail.com wrote:

 This should be O(2^n)

 #include cstdio
 #include cstring
 using namespace std;

 int n;
 int sol[1000];
 void solve(int pos, int k) {
for(int i = 0; i  k; i++) printf(%d, , sol[i]);
putchar('\n');
for(int i = pos; i  n; i++) {
sol[k] = i+1;
solve(i+1, k+1);
}
 }

 int main() {
scanf(%d, n);
solve(0, 0);
 }


 On Jul 27, 8:33 pm, Ankur Garg ankurga...@gmail.com wrote:
  Hi
 
  The solution in the link is of complexity (n*2^n))
 
  Does anyone know any better solution ?
 
  Regards
  Ankur
  On Tue, Jul 26, 2011 at 11:10 PM, rajeev bharshetty 
 rajeevr...@gmail.comwrote:
 
 
 
   @Ankur The link does has a very good explanation. Nice solution :)
 
   On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil kp101...@gmail.com
 wrote:
 
   @Ankur Garg: Nice explanation at the link given by u...
 
   On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.com
 wrote:
 
   Check this
 
  
 http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html
 
   On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki 
 vishaltha...@gmail.comwrote:
 
   Here is the working code..
 
   #include stdio.h
   #include stdlib.h
   int a[] = {1,2,3,4,5};
   #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
   void print_comb(int len)
   {
  int tlen = len;
  int i, j, k;
   int al = ARRLEN(a);
  for (i = 0; i  al; i++) {
  for (j=i+len-1; jal;j++) {
  for (k = i; k  i+len-1; k++) {
  printf(%d , a[k]);
  }
  printf(%d\n, a[j]);
   }
  }
   }
 
   int main(int argc, char *argv[])
   {
  int len = atoi(argv[1]);
   print_comb(len);
  return 0;
   }
 
   On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com
   wrote:
 
check this link:
 
*http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*
 
On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com
   wrote:
 
Given an array of size n, print all the possible subset of array
 of
size k.
eg:-
input:
a[]={1,2,3,4}, k = 2
output:
1,2
1,3
1,4
2,3
2,4
3,4
 
--
You received this message because you are subscribed to the
 Google
   Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
--
You received this message because you are subscribed to the Google
   Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.
 
   --
   You received this message because you are subscribed to the Google
   Groups Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.
 
   --
   Regards
   Rajeev N B http://www.opensourcemania.co.cc
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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-7483122727*
* 

Re: [algogeeks] Re: C output

2011-07-28 Thread Piyush Kapoor
It is not showing compiler error on Codeblocks on my machine.

On Thu, Jul 28, 2011 at 2:26 PM, prabhat prabhat0...@gmail.com wrote:

 i think there will be warning due to inner structure is not declaring
 variable.
 Inner structure must be like:
 struct yy
 {
 char s;
struct xx *p;
 }a;

 On Jul 27, 9:22 pm, Aman Goyal aman.goya...@gmail.com wrote:
  #include‹stdio.h›
  main()
  {
  struct xx
  {
  int x;
  struct yy
  {
  char s;
  struct xx *p;
 
  };
  struct yy *q;
  };
  }
 
  ouput: compiler error.
 
  Any logical reasons?

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




-- 
*Regards,*
*Piyush Kapoor,*
*CSE-IT-BHU*

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



[algogeeks] Re: Sparse matrix

2011-07-28 Thread prabhat

as far as i know multi linklist it used to store sparse matrix
On Jul 27, 11:33 pm, aditi garg aditi.garg.6...@gmail.com wrote:
 How wud u store a sparse matrix( whch has elemensts only below or abv
 the diagonal) in memory...what data structure u wud use and y?

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

2011-07-28 Thread Rohit Srivastava
no error in dev c++.

On Thu, Jul 28, 2011 at 2:43 PM, Piyush Kapoor pkjee2...@gmail.com wrote:

 It is not showing compiler error on Codeblocks on my machine.


 On Thu, Jul 28, 2011 at 2:26 PM, prabhat prabhat0...@gmail.com wrote:

 i think there will be warning due to inner structure is not declaring
 variable.
 Inner structure must be like:
 struct yy
 {
 char s;
struct xx *p;
 }a;

 On Jul 27, 9:22 pm, Aman Goyal aman.goya...@gmail.com wrote:
  #include‹stdio.h›
  main()
  {
  struct xx
  {
  int x;
  struct yy
  {
  char s;
  struct xx *p;
 
  };
  struct yy *q;
  };
  }
 
  ouput: compiler error.
 
  Any logical reasons?

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




 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

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


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



Re: [algogeeks] Logical operator question

2011-07-28 Thread kavitha nk
@prem::ya its rite..


//BE COOL//   kavi

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

2011-07-28 Thread kavitha nk
wat does it mean dat sizweof cannot be applied to functions??den wat is
foo()?is s a func ly na??explain me i cant get it..

//BE COOL//   kavi

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

2011-07-28 Thread Prem Krishna Chettri
Thx Kavi.. :)

On Thu, Jul 28, 2011 at 2:59 PM, kavitha nk kavithan...@gmail.com wrote:

 @prem::ya its rite..


 //BE COOL//   kavi

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

2011-07-28 Thread kavitha nk
http://geeksforgeeks.org/?p=1029
follow the link fa one more soln..
//BE COOL//   kavi

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

2011-07-28 Thread sunny agrawal
Solution in the link is for BST, not for BT

On Thu, Jul 28, 2011 at 3:15 PM, kavitha nk kavithan...@gmail.com wrote:


 http://geeksforgeeks.org/?p=1029
 follow the link fa one more soln..
 //BE COOL//   kavi

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



Re: [algogeeks] Least Common Ancestor

2011-07-28 Thread kavitha nk
oh 5n sry...how to get practiced wit algo???help me
//BE COOL//   kavi

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

2011-07-28 Thread rajeev bharshetty
No error in gcc 4.3.2 too

On Thu, Jul 28, 2011 at 2:47 PM, Rohit Srivastava access2ro...@gmail.comwrote:

 no error in dev c++.


 On Thu, Jul 28, 2011 at 2:43 PM, Piyush Kapoor pkjee2...@gmail.comwrote:

 It is not showing compiler error on Codeblocks on my machine.


 On Thu, Jul 28, 2011 at 2:26 PM, prabhat prabhat0...@gmail.com wrote:

 i think there will be warning due to inner structure is not declaring
 variable.
 Inner structure must be like:
 struct yy
 {
 char s;
struct xx *p;
 }a;

 On Jul 27, 9:22 pm, Aman Goyal aman.goya...@gmail.com wrote:
  #include‹stdio.h›
  main()
  {
  struct xx
  {
  int x;
  struct yy
  {
  char s;
  struct xx *p;
 
  };
  struct yy *q;
  };
  }
 
  ouput: compiler error.
 
  Any logical reasons?

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




 --
 *Regards,*
 *Piyush Kapoor,*
 *CSE-IT-BHU*

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


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




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

*Winners Don't do Different things , they do things Differently*

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

2011-07-28 Thread kavitha nk
first create a temp char array with size equal to dat of the string
length.scan each word(char by char until end is white space is
reached)...then start filling the new array from last by subtracting the
original string length with each word lengthcrct me if i'm wrong..

//BE COOL//   kavi

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

2011-07-28 Thread KK
bool foo(int x)

// Implement this function where 0 = x = 100
It should return true x% of times n false otherwise

first i told him to have a static int s then increment it each time
the func is called...
and if  s % (100 - x ) == 0 then true else false.

then he told me to have some different approach..

I told him like this:

bool foo(int x)
{
// checking if x is btw 0  100

if(x == 0)
  return false;
if(x == 100)
  return true;

 srand(time(0));
 int rno = rand();

 if(rno % (100 - x) == 0)
return True;
 else
   return False;
}

He was like okk but i think he was not completely satisfied
Any other Approach...

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

2011-07-28 Thread Muthu Raj
Please elaborate upon the question a little more :)
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*




On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote:

 bool foo(int x)

 // Implement this function where 0 = x = 100
 It should return true x% of times n false otherwise

 first i told him to have a static int s then increment it each time
 the func is called...
 and if  s % (100 - x ) == 0 then true else false.

 then he told me to have some different approach..

 I told him like this:

 bool foo(int x)
 {
// checking if x is btw 0  100

if(x == 0)
  return false;
if(x == 100)
  return true;

 srand(time(0));
 int rno = rand();

 if(rno % (100 - x) == 0)
return True;
 else
   return False;
 }

 He was like okk but i think he was not completely satisfied
 Any other Approach...

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

2011-07-28 Thread Nikhil Jindal
Generate a random number from 1 to 100.
If it is less than or equal to x, return true, else return false.
This will ensure that ur returning true with x/100 probability.

Cheers
Nikhil Jindal

On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote:

 bool foo(int x)

 // Implement this function where 0 = x = 100
 It should return true x% of times n false otherwise

 first i told him to have a static int s then increment it each time
 the func is called...
 and if  s % (100 - x ) == 0 then true else false.

 then he told me to have some different approach..

 I told him like this:

 bool foo(int x)
 {
// checking if x is btw 0  100

if(x == 0)
  return false;
if(x == 100)
  return true;

 srand(time(0));
 int rno = rand();

 if(rno % (100 - x) == 0)
return True;
 else
   return False;
 }

 He was like okk but i think he was not completely satisfied
 Any other Approach...

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

2011-07-28 Thread sharmila saru
my area of interest is computer network as  u ask question abt
that .. i will answer immediately..

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

2011-07-28 Thread Rahul
How it is that we open a number of email in a computer , when there is only
one port for smtp?
---
Rahul



On Thu, Jul 28, 2011 at 5:23 PM, sharmila saru sharmi99p...@gmail.comwrote:

 my area of interest is computer network as  u ask question abt
 that .. i will answer immediately..

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

2011-07-28 Thread Tyler Durden
Only a warning in Dev C++ due to no variable declaration of inner structure

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/HtevjjeGDZoJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: interview ques

2011-07-28 Thread bharath
@Puneet, to store anything on a machine, you will need to have a
pointer to it else there is no question of accessing it. I am guessing
the question emphasized on reducing the size of the B+ tree. Also,
with B+ trees, you have sequence pointers at the data record level.
Therefore, if these data records are stored in a single chunk,
bringing the chunk into memeory is good enough. An additional storage
structure will not be required.

On Jul 28, 1:27 am, Puneet Gautam puneet.nsi...@gmail.com wrote:
 @bharath: To store the bunch of records together also, we gonna need
 another useful ds like linked list or array which again points to
 the problem of excessive storage or excessive pointers...
 correct me if am not..!

 On 7/28/11, bharath bharath.sri...@gmail.com wrote:







  @Dumanshu: A B+ tree is a multi-level index. It indexes the index
  until the final level is small enough to fit into a data block that
  can fit in memory.

  On Jul 27, 10:11 pm, Dumanshu duman...@gmail.com wrote:
  Use multilevel indexing

  On Jul 27, 11:07 pm, himanshu kansal himanshukansal...@gmail.com
  wrote:

   if u hv say 20 million records and u have to create a b+ tree then you
   might be storing 20 million pointers at the leaf levelhow can u
   optimize this(using b+ tree only)???

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

2011-07-28 Thread Tushar Bindal
I think that we have to make a spiral traversal
So o/p for your matrix would be:
1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10

On Thu, Jul 28, 2011 at 1:56 PM, Rajeev Kumar rajeevprasa...@gmail.comwrote:

 @puneet

 Can you give us an example what u mean by 180 degree rotation...
 For given matrix like
 1, 2,   3, 4
 5, 6,   7, 8
 9,10,11,  12
 13,14,15,16

 What is the expected output?


 On Wed, Jul 27, 2011 at 11:29 PM, Puneet Gautam 
 puneet.nsi...@gmail.comwrote:

 Can anyone give an O(n) solution pls...??
 I think the above code is an O(n^2) solution..
 if i am not wrong...!!!



 On 7/27/11, amit amit.codenam...@gmail.com wrote:
  #include cstdio
  #include algorithm
  using namespace std;
 
  const int MX = 1000;
  int n, m;
  int a[MX][MX];
 
  int main() {
  scanf(%d%d, n, m);
  for(int i = 0; i  n; i++)
  for(int j = 0; j  m; j++)
  scanf(%d, a[i][j]);
 
  for(int i = 0; i  n/2; i++)
  for(int j = 0; j  m; j++)
  swap(a[i][j], a[n-i-1][m-j-1]);
  if(n1)
  for(int j = 0; j  m/2; j++)
  swap(a[n/2][j], a[n/2][m-j-1]);
 
  for(int i = 0; i  n; i++) {
  for(int j = 0; j  m; j++)
  printf(%d , a[i][j]);
  printf(\n);
  }
  }
 
 
  On Jul 27, 7:54 pm, Anika Jain anika.jai...@gmail.com wrote:
  is it lyk for {1,2,3
 4,5,6,
 7,8,9}
  to be {3,2,1,
   6,5,4,
   9,8,7}??
 
 
 
  On Wed, Jul 27, 2011 at 9:37 AM, Deoki Nandan deok...@gmail.com
 wrote:
   rotate a 2D matrix by angle 180
 
   --
   **With Regards
   Deoki Nandan Vishwakarma
 
   *
   *
 
--
   You received this message because you are subscribed to the Google
   Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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.




 --
 Thank You
 Rajeev Kumar

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




-- 
Tushar Bindal
Computer Engineering
Delhi College of Engineering
Mob: +919818442705
E-Mail : tushicom...@gmail.com
Website: www.jugadengg.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] Re: sizeof() question.

2011-07-28 Thread Tyler Durden
No, it's wrong to say that sizeof() can't be applied to functions. It's an 
operator and can take the function name as its operand. 

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/15qdLm5AH8sJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 Q

2011-07-28 Thread Anantha Krishnan
We must use 
BIThttp://www.topcoder.com/tc?module=Staticd1=tutorialsd2=binaryIndexedTreesto
solve this problem with O(nlogn).

Here http://ideone.com/IaU3F is my implementation.

Thanks  Regards
Anantha Krishnan


On Tue, Jul 26, 2011 at 7:18 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create
 another array ar_low[] such that ar_low[i] = number of elements lower
 than or equal to ar[i] in ar[i+1:n-1].
 So the output of above should be {0,2,1,2,2,1,0}

 Time complexity : O(nlogn)
 use of extra space allowed.


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

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

2011-07-28 Thread Rajeev Kumar
Hi All,
Algorithm :(as ankur suggested above)
1)Assume given array is a[];
2)construct a temporary array of size a.length+1.Insert '0' as first element
in temp(to simplify the edge conditional checks)
3)temp array contains sum of elements upto index(i) of that position.
4)Create a hashmap and traverse across the list.If the same number comes
again,construct a list and add to the list.
  basicall hashmap contains position of contiguous elements which sum upto
zero.
5)Now get all hashmap values(linkedlists):Linked list stores the positions
which gives zero sum.
  for each linked list(if list size is greater than one) get the
combaintions of two elements and call printarray method with start and end
index.

I have implemented the above algorithm here(working java code).
http://rajeevprasanna.blogspot.com/2011/07/contiguous-subarray-with-sum-zero.html

Please let me know if any thing wrong

On Thu, Jul 21, 2011 at 1:12 PM, sagar pareek sagarpar...@gmail.com wrote:

 thank you kamakshii  :)
 it is really helpful


 On Thu, Jul 21, 2011 at 1:28 AM, Kamakshii Aggarwal kamakshi...@gmail.com
  wrote:

 use sum calculated in 2nd array as index for hashing..and index for second
 array as value of hashing;
 for example
 original array:20 , -9 , 3 , 1, 5 , 0, -6 , 9
 array after addition:20 , 11,14,15,20,20,14,23
 according to above example hashing will be like this
 k[20]=0;
 k{11]=1;
 k[14]=2;
 k[15]=3;
 again when now 20 comes so collision occurs as k[20] is already 1.
 therefore all the elements from index( k[20]+1) to 4(coz next 20 occurs at
 dis location) form the required string..



 On Thu, Jul 21, 2011 at 12:43 AM, sagar pareek sagarpar...@gmail.comwrote:

 how collision occur at 14 and 20
 actually i m not getting hash function
 Thanks in advance

 On Thu, Jul 21, 2011 at 12:39 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 @sagar: i read contiguous afterwards therefore i deleted my post...
 and for ankur's approach
 :
 original array:20 , -9 , 3 , 1, 5 , 0, -6 , 9
 array after addition:20 , 11,14,15,20,20,14,23

 now when u hash  second array elements
 then u fill find collision at value 14 and 20
 this means terms b/w 1st 14 and 2nd 14 adds t0 0.(1,5,0,-6)...
 is it clear now?



 On Thu, Jul 21, 2011 at 12:22 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:


 a little mistake in ankur's solution
  20 , -9 , 3 , 1, 5 , 0, -6 , 9
 20 , 11,14,15,20,20(instead of 0),14,23
 now if sum of two consecutive terms is same then this means a 0
 exists.and hence it can be printed as a subarray..else ankur's sol works
 fine..:)


 On Thu, Jul 21, 2011 at 12:06 AM, sagar pareek 
 sagarpar...@gmail.comwrote:

 @ankur

 pls explain through an example by taking above problem.


 On Wed, Jul 20, 2011 at 10:52 PM, SAMMM somnath.nit...@gmail.comwrote:



 Nice solution dude . Like that one 

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

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




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




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

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

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




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

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE 

[algogeeks]

2011-07-28 Thread Coder Coder
Can anyone tell me the iterative code to find mirror image of a binary
tree??


thanx..

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

2011-07-28 Thread mohit verma
hey  guys,
One simple example:

class A{
int a,b;
public:
 A():a(2),b(3){}
};

class B:public A
{
   public:
  int c;
};

int main()
{
   B ob;
int *ptr=ob.c;
cout*ptr;
ptr--;
cout*ptr;
ptr--;
cout*ptr;
return 0;
}

AFAIK, inheritance in any visibility mode does not provide access to private
members of base class(Or even copy them to derived class memory space in
private section). So how can the above program can run successfully? Could
someone elaborate on inheritance internals : what is going on in this case?
-- 

*MOHIT VERMA*

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

2011-07-28 Thread mageshthegreat
I don't think you use smtp to view yahoo or gmail. It is only http requests and 
responses. The smtp is significant only if you use your computer as the server 
to send or receive emails. If you have a local apache server then it uses the 
port to send out mails from your local copy of website running on the server.

Sent from BlackBerry® on Airtel

-Original Message-
From: Rahul rahul.r.m...@gmail.com
Sender: algogeeks@googlegroups.com
Date: Thu, 28 Jul 2011 17:26:20 
To: algogeeks@googlegroups.com
Reply-To: algogeeks@googlegroups.com
Subject: Re: [algogeeks] hai...

How it is that we open a number of email in a computer , when there is only
one port for smtp?
---
Rahul



On Thu, Jul 28, 2011 at 5:23 PM, sharmila saru sharmi99p...@gmail.comwrote:

 my area of interest is computer network as  u ask question abt
 that .. i will answer immediately..

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Menon
Hello friends,

Recently I appeared for placement interviews for Amazon in my
campus.Unfortunately though I couldn't make it, still want to share
something for others here preparing for amazon interviews!

First of all though it is very hard to crack, here are a few things
which can make your preparation easier and effective!

In the interview, I have found that most of the questions asked are
repeated questions which are available online rather than any new
questions they have made. A few examples are loop in a linked list,
print all permuations of a string, binary search in a rotated array
etc.. These all questions are very commonly found in websites like
careercup.com and also in this google group. Instead of just going
through hundreds of question be sure that you can perform the best of
100% if you are given from these frequently asked questions.

Just to add, if you are very good in coding it's fine , else make sure
that you can also code these above questions very well rather than
just explaining the algos!. They will definitely ask you to code
these!

In  Cracking the coding interview all the questions are very very
important. To my astonishment most of the questions in the sections
like Linked LIsts, Arrays, Trees and Graph, Recursion from the
aforesaid book were asked in our interview!  So never miss reading and
coding these questions before going to your interview.

Though it's very weird to say, I would say that if you are very very
good with these around 40 most frequently repeated questions, which
can be collected through googling, your performance is almost 80%
guaranteed in the interview. It's sure that you will have to face only
a very few question outside from this. And if you are somewhat more
good enough , you can easily make through to the AMAZON!

All the best for all :)
Repeating once again, rather than just reading through hundreds of
questions it would be best if you practice coding and studying the few
30 interview questions! Else you will have to regret like me :|


#We will be having Google on our campus soon! I'm totally strange to
their selection process,tests and intreview, so if anyone have any
idea please do share here! Thanks!

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



Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Neha Sharan
@rahul:what kind of questons were asked in aptitude test?

On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.comwrote:

 Hello friends,

 Recently I appeared for placement interviews for Amazon in my
 campus.Unfortunately though I couldn't make it, still want to share
 something for others here preparing for amazon interviews!

 First of all though it is very hard to crack, here are a few things
 which can make your preparation easier and effective!

 In the interview, I have found that most of the questions asked are
 repeated questions which are available online rather than any new
 questions they have made. A few examples are loop in a linked list,
 print all permuations of a string, binary search in a rotated array
 etc.. These all questions are very commonly found in websites like
 careercup.com and also in this google group. Instead of just going
 through hundreds of question be sure that you can perform the best of
 100% if you are given from these frequently asked questions.

 Just to add, if you are very good in coding it's fine , else make sure
 that you can also code these above questions very well rather than
 just explaining the algos!. They will definitely ask you to code
 these!

 In  Cracking the coding interview all the questions are very very
 important. To my astonishment most of the questions in the sections
 like Linked LIsts, Arrays, Trees and Graph, Recursion from the
 aforesaid book were asked in our interview!  So never miss reading and
 coding these questions before going to your interview.

 Though it's very weird to say, I would say that if you are very very
 good with these around 40 most frequently repeated questions, which
 can be collected through googling, your performance is almost 80%
 guaranteed in the interview. It's sure that you will have to face only
 a very few question outside from this. And if you are somewhat more
 good enough , you can easily make through to the AMAZON!

 All the best for all :)
 Repeating once again, rather than just reading through hundreds of
 questions it would be best if you practice coding and studying the few
 30 interview questions! Else you will have to regret like me :|


 #We will be having Google on our campus soon! I'm totally strange to
 their selection process,tests and intreview, so if anyone have any
 idea please do share here! Thanks!

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



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

2011-07-28 Thread Tushar Bindal
If this is the case, we can follow this method:

take variables
1. dir = 1
2. st_col=0
3. end_col = n-1
4. st_row = 1
5. end_row = n-1
6. row = 0
7. col = n-1
8. noOfCellsVisited = 0

dir are as follows:
1 - left ro right
2 - top to bottom
3 - right to left
4 - bottom to top

row will keep account of the row we will traverse when dir=1 or 3
col will keep account of the column we will traverse when dir=2 or 4

st_col and end_col will keep account of leftmost and rightmost columns for
traversing rows
st_row and end_row will keep account of topmost and bottom rows for
traversing columns


while(noOfCellsVisitedmn)
{
if(dir == 1)
{
for i = st_col to end_col
{ print arr[row][i]; noOfCellsVisited++}
dir++;
end_col--;
row = n-1-row;
}

if(dir==2)
{
for i = st_row to end_row
{ print arr[i][col]; noOfCellsVisited++}
dir++;
end_row--;
col=n-1-col;
}

if(dir==3)
{
for i = end_col to st_col
{ print arr[row][i]; noOfCellsVisited++}
dir++;
row=n-row;
st_col++;
}
if(dir==4)
{
for i = end_row to st_row
{ print arr[i][col; noOfCellsVisited++}

}
dir=1;
col=n-1-(i-1);
st_row++;
}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Menon
I dont remember exactly!
There where a few questions from Computer Networks, OS etc also a few
aptitude questions!
20 mcq + 2 programming questions,


On Jul 28, 5:31 pm, Neha Sharan neharick...@gmail.com wrote:
 @rahul:what kind of questons were asked in aptitude test?

 On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.comwrote:







  Hello friends,

  Recently I appeared for placement interviews for Amazon in my
  campus.Unfortunately though I couldn't make it, still want to share
  something for others here preparing for amazon interviews!

  First of all though it is very hard to crack, here are a few things
  which can make your preparation easier and effective!

  In the interview, I have found that most of the questions asked are
  repeated questions which are available online rather than any new
  questions they have made. A few examples are loop in a linked list,
  print all permuations of a string, binary search in a rotated array
  etc.. These all questions are very commonly found in websites like
  careercup.com and also in this google group. Instead of just going
  through hundreds of question be sure that you can perform the best of
  100% if you are given from these frequently asked questions.

  Just to add, if you are very good in coding it's fine , else make sure
  that you can also code these above questions very well rather than
  just explaining the algos!. They will definitely ask you to code
  these!

  In  Cracking the coding interview all the questions are very very
  important. To my astonishment most of the questions in the sections
  like Linked LIsts, Arrays, Trees and Graph, Recursion from the
  aforesaid book were asked in our interview!  So never miss reading and
  coding these questions before going to your interview.

  Though it's very weird to say, I would say that if you are very very
  good with these around 40 most frequently repeated questions, which
  can be collected through googling, your performance is almost 80%
  guaranteed in the interview. It's sure that you will have to face only
  a very few question outside from this. And if you are somewhat more
  good enough , you can easily make through to the AMAZON!

  All the best for all :)
  Repeating once again, rather than just reading through hundreds of
  questions it would be best if you practice coding and studying the few
  30 interview questions! Else you will have to regret like me :|

  #We will be having Google on our campus soon! I'm totally strange to
  their selection process,tests and intreview, so if anyone have any
  idea please do share here! Thanks!

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

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Neha Sharan
Thanks.

On Thu, Jul 28, 2011 at 6:07 PM, Rahul Menon menonrahul1...@gmail.comwrote:

 I dont remember exactly!
 There where a few questions from Computer Networks, OS etc also a few
 aptitude questions!
 20 mcq + 2 programming questions,


 On Jul 28, 5:31 pm, Neha Sharan neharick...@gmail.com wrote:
  @rahul:what kind of questons were asked in aptitude test?
 
  On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.com
 wrote:
 
 
 
 
 
 
 
   Hello friends,
 
   Recently I appeared for placement interviews for Amazon in my
   campus.Unfortunately though I couldn't make it, still want to share
   something for others here preparing for amazon interviews!
 
   First of all though it is very hard to crack, here are a few things
   which can make your preparation easier and effective!
 
   In the interview, I have found that most of the questions asked are
   repeated questions which are available online rather than any new
   questions they have made. A few examples are loop in a linked list,
   print all permuations of a string, binary search in a rotated array
   etc.. These all questions are very commonly found in websites like
   careercup.com and also in this google group. Instead of just going
   through hundreds of question be sure that you can perform the best of
   100% if you are given from these frequently asked questions.
 
   Just to add, if you are very good in coding it's fine , else make sure
   that you can also code these above questions very well rather than
   just explaining the algos!. They will definitely ask you to code
   these!
 
   In  Cracking the coding interview all the questions are very very
   important. To my astonishment most of the questions in the sections
   like Linked LIsts, Arrays, Trees and Graph, Recursion from the
   aforesaid book were asked in our interview!  So never miss reading and
   coding these questions before going to your interview.
 
   Though it's very weird to say, I would say that if you are very very
   good with these around 40 most frequently repeated questions, which
   can be collected through googling, your performance is almost 80%
   guaranteed in the interview. It's sure that you will have to face only
   a very few question outside from this. And if you are somewhat more
   good enough , you can easily make through to the AMAZON!
 
   All the best for all :)
   Repeating once again, rather than just reading through hundreds of
   questions it would be best if you practice coding and studying the few
   30 interview questions! Else you will have to regret like me :|
 
   #We will be having Google on our campus soon! I'm totally strange to
   their selection process,tests and intreview, so if anyone have any
   idea please do share here! Thanks!
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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

2011-07-28 Thread Tushar Bindal
There will be following changes to this

while(noOfCellsVisitedmn)
{
if(dir == 1)
{
for i = st_col to end_col
{ print arr[row][i]; noOfCellsVisited++}
dir++;
end_col--;
row = n-1-row;
}

else if(dir==2)
{
for i = st_row to end_row
{ print arr[i][col]; noOfCellsVisited++}
dir++;
end_row--;
col=n-1-col;
}

else if(dir==3)
{
for i = end_col to st_col
{ print arr[row][i]; noOfCellsVisited++}
dir++;
row=n-row;
st_col++;
}

else if(dir==4)
{
for i = end_row to st_row
{ print arr[i][col; noOfCellsVisited++}

}
dir=1;
col=n-1-(i+1);
st_row++;
}
}

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

2011-07-28 Thread Tushar Bindal
i am sorry for givin such a naive solution and making so many mistakes.
i still left a mistake in dir==4
*
col=n-1-(col+1);*

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



Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Siddharth kumar
#includeiostream
#define ARR_LEN 5

using namespace std;

int main()
{
int int_arr[ARR_LEN], k, min, max, x, temp, i;

for(i=0; iARR_LEN; i++)
cinint_arr[i];

coutEnter k: ;
cink;
min = (1k)-1;
max = min(ARR_LEN-k);

for(x=min; x=max; x=((x+(x(-x)))|(((x^(x+(x(-x2)/(x(-x )
{
temp = x;
i = 0;
while(temp)
{
if(temp1)
coutint_arr[i] ;

i++;
temp = temp1;
}
coutendl;
}
return 0;
}

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



Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
thanks amit for this code
i tried this for the first time and am still not over finding out my
mistakes (got another one while trying it out on an array)

yours was an easy one :)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Muthu Raj
Thnks a lot  neha :)
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*




On Thu, Jul 28, 2011 at 6:01 PM, Neha Sharan neharick...@gmail.com wrote:

 @rahul:what kind of questons were asked in aptitude test?

 On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.comwrote:

 Hello friends,

 Recently I appeared for placement interviews for Amazon in my
 campus.Unfortunately though I couldn't make it, still want to share
 something for others here preparing for amazon interviews!

 First of all though it is very hard to crack, here are a few things
 which can make your preparation easier and effective!

 In the interview, I have found that most of the questions asked are
 repeated questions which are available online rather than any new
 questions they have made. A few examples are loop in a linked list,
 print all permuations of a string, binary search in a rotated array
 etc.. These all questions are very commonly found in websites like
 careercup.com and also in this google group. Instead of just going
 through hundreds of question be sure that you can perform the best of
 100% if you are given from these frequently asked questions.

 Just to add, if you are very good in coding it's fine , else make sure
 that you can also code these above questions very well rather than
 just explaining the algos!. They will definitely ask you to code
 these!

 In  Cracking the coding interview all the questions are very very
 important. To my astonishment most of the questions in the sections
 like Linked LIsts, Arrays, Trees and Graph, Recursion from the
 aforesaid book were asked in our interview!  So never miss reading and
 coding these questions before going to your interview.

 Though it's very weird to say, I would say that if you are very very
 good with these around 40 most frequently repeated questions, which
 can be collected through googling, your performance is almost 80%
 guaranteed in the interview. It's sure that you will have to face only
 a very few question outside from this. And if you are somewhat more
 good enough , you can easily make through to the AMAZON!

 All the best for all :)
 Repeating once again, rather than just reading through hundreds of
 questions it would be best if you practice coding and studying the few
 30 interview questions! Else you will have to regret like me :|


 #We will be having Google on our campus soon! I'm totally strange to
 their selection process,tests and intreview, so if anyone have any
 idea please do share here! Thanks!

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


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

2011-07-28 Thread Balaji S
Given a 3X3 matrix , with 1's 0's and -1's ( 1 is player one 0 is player two
-1 is none)

how ll you find who is the winner / draw in a tic tac toe game in the most
effiecient manner...

-- 
With Regards,
Balaji.S

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

2011-07-28 Thread Tyler Durden
#includestdio.h
#includemath.h

int set_bits(int a)
{
int c=0;
while(a)
{
if(a  1)
c++;
a =1;
}
return c;
}

void sub(int a[],int n,int k)
{
 int i; int x,c=0,j;
 x = pow(2,n);
 for(i=0;ix;i++)  //this statement is exec 2^n times
 {
 if(set_bits(i) == k)  // This is satisfied nCk times
 {
c=0;
printf({ );
for(j=0;ck;j++) /* this loop runs n times 
(no.of bits in 2^n - 1) */
if(ij  1)
{
printf(%d ,a[n-j-1]);
c++;
}
printf(}\n);
 }
 }
 
 }
int main()
{

int a[]= {1,2,3,4};
int k=2,n=4;
sub(a,n,k);

getch();
}

Time Complexity is quite high. O(n(2^n))

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/jWHXwaHrTGEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] self referential struct. Contd.

2011-07-28 Thread Nikhil Gupta
Here's another example.

struct example
{
int a;
char b;
int c;
}

Now if a variable of type example is declared then
(considering base address as 2000)
a gets : 2000 to 2003
b gets : 2004
c gets : 2005 to 2008 ? NO

It gets 2008 to 2011. The bytes from 2005 to 2007 (3 bytes) are padded in
this case.

On Thu, Jul 28, 2011 at 12:18 AM, Aman Goyal aman.goya...@gmail.com wrote:

 yes this will be the case.


 On Wed, Jul 27, 2011 at 11:35 PM, Puneet Gautam 
 puneet.nsi...@gmail.comwrote:

 @nikhil:So what u mean is that if i have:

 struct{
 int a;
 char b[5];
 };

 the size of this struct's node will be 12 not 9.., to make it a multiple
 of 4??



 On 7/26/11, Nikhil Gupta nikhilgupta2...@gmail.com wrote:
  Padding is not a topic of self referential structure.
 
  Padding means that extra spaces of memory are used by the compiler to
  allocate memory. This is done to have the memory address as a multiple
 of
  the size of the variable. This speeds up the processing of these
 variables
  by the compiler.
 
  On Tue, Jul 26, 2011 at 8:09 PM, Puneet Gautam
  puneet.nsi...@gmail.comwrote:
 
  what is meant by padding in self_referenced structure?
  Is it always necessary?
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Nikhil Gupta
  Senior Co-ordinator, Publicity
  CSI, NSIT Students' Branch
  NSIT, New Delhi, India
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-07-28 Thread sandz
Please e-mail the book as well.
nsandee...@gmail.com

Thanks.

On Jun 24, 6:28 pm, cooks rohit.wali...@gmail.com wrote:
 addToMailList(rohit.wali...@gmail.com);
 :)

 On Jun 24, 2:08 pm, murthy.krishn...@gmail.com







 murthy.krishn...@gmail.com wrote:
  yaa If any one has it, can you please mail it to me also

  Thanks,

  On Fri, Jun 24, 2011 at 2:36 PM, alok kediya alokked...@gmail.com wrote:
   any one downloaded or having link to download link, plz share it with me..
   thanks in advance :)

   Thanks,
   Alok

   On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal 
   agr.bhav...@gmail.comwrote:

   mail it to me plz..

   agr.bhav...@gmail.com

   --
   You received this message because you are subscribed to theGoogleGroups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from 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 theGoogleGroups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

  --
  P.V.N.S.S. Krishna Murthy,
  Intern at Broadcom Private Limited,
  Bangalore,
  Contact no:- +919845812996.

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

2011-07-28 Thread Tushar Bindal
though the code given by siddharth seems to be a bit tough to understand due
to one long statement, it gives a good idea to run the main loop fron 2^k
-1  to (2^k - 1)*(2^(n-k)) since these rae the only numbers having k digits
set

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

2011-07-28 Thread Arun Vishwanathan
when u log in with a user name and password, the mail client(gmail)(mail
server) contacts the IMAP server through a port(imap is 143 i guess)and you
can view your mails on the server(the mails that were sent to u sit in a
queue on this server) itself or bring a copy to your local machine.SMTP
server is only in play when a mail is sent(outgoing).

On Thu, Jul 28, 2011 at 2:23 PM, mageshthegr...@gmail.com wrote:

 **I don't think you use smtp to view yahoo or gmail. It is only http
 requests and responses. The smtp is significant only if you use your
 computer as the server to send or receive emails. If you have a local apache
 server then it uses the port to send out mails from your local copy of
 website running on the server.

 Sent from BlackBerry® on Airtel
 --
 *From: *Rahul rahul.r.m...@gmail.com
 *Sender: *algogeeks@googlegroups.com
 *Date: *Thu, 28 Jul 2011 17:26:20 +0530
 *To: *algogeeks@googlegroups.com
 *ReplyTo: *algogeeks@googlegroups.com
 *Subject: *Re: [algogeeks] hai...

 How it is that we open a number of email in a computer , when there is only
 one port for smtp?
 ---
 Rahul



 On Thu, Jul 28, 2011 at 5:23 PM, sharmila saru sharmi99p...@gmail.comwrote:

 my area of interest is computer network as  u ask question abt
 that .. i will answer immediately..

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




-- 
 Arun Vish
Graduate Student
Department of Computer Science
University of Southern California

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

2011-07-28 Thread Vishal Thanki
+1 Nikhil

On Thu, Jul 28, 2011 at 4:26 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote:
 Generate a random number from 1 to 100.
 If it is less than or equal to x, return true, else return false.
 This will ensure that ur returning true with x/100 probability.
 Cheers
 Nikhil Jindal

 On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote:

 bool foo(int x)

 // Implement this function where 0 = x = 100
 It should return true x% of times n false otherwise

 first i told him to have a static int s then increment it each time
 the func is called...
 and if  s % (100 - x ) == 0 then true else false.

 then he told me to have some different approach..

 I told him like this:

 bool foo(int x)
 {
    // checking if x is btw 0  100

    if(x == 0)
              return false;
    if(x == 100)
              return true;

     srand(time(0));
     int rno = rand();

     if(rno % (100 - x) == 0)
            return True;
     else
           return False;
 }

 He was like okk but i think he was not completely satisfied
 Any other Approach...

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

2011-07-28 Thread radha krishnan
Excuse me MR.balaji :P
U got selected for Microsoft Redmond :P still preparing ? :P

On Thu, Jul 28, 2011 at 6:01 AM, Balaji S balaji.ceg...@gmail.com wrote:
 Given a 3X3 matrix , with 1's 0's and -1's ( 1 is player one 0 is player two
 -1 is none)

 how ll you find who is the winner / draw in a tic tac toe game in the most
 effiecient manner...

 --
 With Regards,
     Balaji.S

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

2011-07-28 Thread himanshu kansal
@bharath: yeah i was also thinking that we could store a pointer to a data
block in which multiple records can be stored.but i think for searching
a record we have to 1st get to that block and then search the record in that
block

On Thu, Jul 28, 2011 at 5:31 PM, bharath bharath.sri...@gmail.com wrote:

 @Puneet, to store anything on a machine, you will need to have a
 pointer to it else there is no question of accessing it. I am guessing
 the question emphasized on reducing the size of the B+ tree. Also,
 with B+ trees, you have sequence pointers at the data record level.
 Therefore, if these data records are stored in a single chunk,
 bringing the chunk into memeory is good enough. An additional storage
 structure will not be required.

 On Jul 28, 1:27 am, Puneet Gautam puneet.nsi...@gmail.com wrote:
  @bharath: To store the bunch of records together also, we gonna need
  another useful ds like linked list or array which again points to
  the problem of excessive storage or excessive pointers...
  correct me if am not..!
 
  On 7/28/11, bharath bharath.sri...@gmail.com wrote:
 
 
 
 
 
 
 
   @Dumanshu: A B+ tree is a multi-level index. It indexes the index
   until the final level is small enough to fit into a data block that
   can fit in memory.
 
   On Jul 27, 10:11 pm, Dumanshu duman...@gmail.com wrote:
   Use multilevel indexing
 
   On Jul 27, 11:07 pm, himanshu kansal himanshukansal...@gmail.com
   wrote:
 
if u hv say 20 million records and u have to create a b+ tree then
 you
might be storing 20 million pointers at the leaf levelhow can u
optimize this(using b+ tree only)???
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

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




-- 

  Regards
Himanshu Kansal
  Msc Comp. sc.
(University of Delhi)

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



Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Singhal
Hi friends,
I would recommend to go through all topics mentioned on tutorials on site
topcoder for google.Make a note, do practise more of greedy and dynamic
programming questions.In final rounds of interview, they generally ask
questions involving probability along with computation which is also covered
in topcoder.
Best of luck.

On Thu, Jul 28, 2011 at 6:28 PM, Muthu Raj sameer.mut...@gmail.com wrote:

 Thnks a lot  neha :)
 *Muthuraj R.
 4TH Year BE.**
 Information Science Dept*
 *PESIT, Bengaluru .
 *





 On Thu, Jul 28, 2011 at 6:01 PM, Neha Sharan neharick...@gmail.comwrote:

 @rahul:what kind of questons were asked in aptitude test?

 On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.comwrote:

 Hello friends,

 Recently I appeared for placement interviews for Amazon in my
 campus.Unfortunately though I couldn't make it, still want to share
 something for others here preparing for amazon interviews!

 First of all though it is very hard to crack, here are a few things
 which can make your preparation easier and effective!

 In the interview, I have found that most of the questions asked are
 repeated questions which are available online rather than any new
 questions they have made. A few examples are loop in a linked list,
 print all permuations of a string, binary search in a rotated array
 etc.. These all questions are very commonly found in websites like
 careercup.com and also in this google group. Instead of just going
 through hundreds of question be sure that you can perform the best of
 100% if you are given from these frequently asked questions.

 Just to add, if you are very good in coding it's fine , else make sure
 that you can also code these above questions very well rather than
 just explaining the algos!. They will definitely ask you to code
 these!

 In  Cracking the coding interview all the questions are very very
 important. To my astonishment most of the questions in the sections
 like Linked LIsts, Arrays, Trees and Graph, Recursion from the
 aforesaid book were asked in our interview!  So never miss reading and
 coding these questions before going to your interview.

 Though it's very weird to say, I would say that if you are very very
 good with these around 40 most frequently repeated questions, which
 can be collected through googling, your performance is almost 80%
 guaranteed in the interview. It's sure that you will have to face only
 a very few question outside from this. And if you are somewhat more
 good enough , you can easily make through to the AMAZON!

 All the best for all :)
 Repeating once again, rather than just reading through hundreds of
 questions it would be best if you practice coding and studying the few
 30 interview questions! Else you will have to regret like me :|


 #We will be having Google on our campus soon! I'm totally strange to
 their selection process,tests and intreview, so if anyone have any
 idea please do share here! Thanks!

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


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




-- 
Rahul singhal

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

2011-07-28 Thread Tushar Bindal
can't we include -9 , 3 , 1, 5 , 0 as a possible sub array?

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

2011-07-28 Thread Ankur Khurana
it will be answer as per my algo .

On Thu, Jul 28, 2011 at 7:39 PM, Tushar Bindal tushicom...@gmail.comwrote:

 can't we include -9 , 3 , 1, 5 , 0 as a possible sub array?

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




-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

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



[algogeeks] Re: AMAZON Q

2011-07-28 Thread SVIX
extra memory allowed... and n log n and resultant array should
have values f(x) in the same order as x in the first array (before
sort)

now, sort the first array and take distinct (another array)... create
a dictionaryint,int. add each element in the sorted list and it's
index as key and value.

now, for each element in the original array, lookup it's sorted index
in the dictionary...

On Jul 26, 6:48 am, Piyush Sinha ecstasy.piy...@gmail.com wrote:
 You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create
 another array ar_low[] such that ar_low[i] = number of elements lower
 than or equal to ar[i] in ar[i+1:n-1].
 So the output of above should be {0,2,1,2,2,1,0}

 Time complexity : O(nlogn)
 use of extra space allowed.

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

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



Re: [algogeeks]

2011-07-28 Thread sagar pareek
viod mirror(node *root)
{
 node* tmp;
 if(root)
 {
  mirror(root-left);
  mirror(root-right);

  tmp=root-left;
  root-left=root-right;
  root-right=tmp;
 }
}

On Thu, Jul 28, 2011 at 6:40 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 http://www.ideone.com/NyAmw


 On Thu, Jul 28, 2011 at 5:48 PM, Coder Coder algogeek.co...@gmail.comwrote:

 Can anyone tell me the iterative code to find mirror image of a binary
 tree??


 thanx..

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-7483122727*
 * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY
 NEVER
 *

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




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

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



Re: [algogeeks]

2011-07-28 Thread ambika iyer
how to find the complexity of the above recursive code 

On Thu, Jul 28, 2011 at 8:02 PM, sagar pareek sagarpar...@gmail.com wrote:

 viod mirror(node *root)
 {
  node* tmp;
  if(root)
  {
   mirror(root-left);
   mirror(root-right);

   tmp=root-left;
   root-left=root-right;
   root-right=tmp;

  }
 }

 On Thu, Jul 28, 2011 at 6:40 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:

 http://www.ideone.com/NyAmw


 On Thu, Jul 28, 2011 at 5:48 PM, Coder Coder algogeek.co...@gmail.comwrote:

 Can anyone tell me the iterative code to find mirror image of a binary
 tree??


 thanx..

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-7483122727*
 * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY
 NEVER
 *

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

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




-- 
Ambi :)

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

2011-07-28 Thread Rajeev Kumar
@Tushar :
We can do it...thing is to modify the getCombinations() method in the
program to select any two instead of selecting two elements side by
side...

On Thu, Jul 28, 2011 at 7:31 AM, Tushar Bindal tushicom...@gmail.comwrote:

 yeah
 i was just confirming that it is meant to be printed or is it considered
 reduntant as it wasn't mentioned in the question.

 thanks for this algo.

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




-- 
Thank You
Rajeev Kumar

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



Re: [algogeeks]

2011-07-28 Thread ambika iyer
@tushar : thnx!!

On Thu, Jul 28, 2011 at 8:11 PM, Tushar Bindal tushicom...@gmail.comwrote:

 it should be O(n)
 where n is number of nodes as we get into the function once for a node.
 we just perform some O(1) operations to do the swapping.


 On Thu, Jul 28, 2011 at 8:05 PM, ambika iyer balu200...@gmail.com wrote:

 how to find the complexity of the above recursive code 


 On Thu, Jul 28, 2011 at 8:02 PM, sagar pareek sagarpar...@gmail.comwrote:

 viod mirror(node *root)
 {
  node* tmp;
  if(root)
  {
   mirror(root-left);
   mirror(root-right);

   tmp=root-left;
   root-left=root-right;
   root-right=tmp;

  }
 }

 On Thu, Jul 28, 2011 at 6:40 PM, Piyush Sinha 
 ecstasy.piy...@gmail.comwrote:

 http://www.ideone.com/NyAmw


 On Thu, Jul 28, 2011 at 5:48 PM, Coder Coder 
 algogeek.co...@gmail.comwrote:

 Can anyone tell me the iterative code to find mirror image of a binary
 tree??


 thanx..

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-7483122727*
 * https://www.facebook.com/profile.php?id=10655377926 NEVER SAY
 NEVER
 *

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




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

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




 --
 Ambi :)

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




 --
 Tushar Bindal
 Computer Engineering
 Delhi College of Engineering
 Mob: +919818442705
 E-Mail : tushicom...@gmail.com
 Website: www.jugadengg.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.




-- 
Ambi :)

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

2011-07-28 Thread radha krishnan
Anyone have an idea about DirectI Written test ?
Thanks in Advance !

Radhakrishnan,
CEG,AU,
Chennai

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

2011-07-28 Thread sunny agrawal
as Number of possible sets are nCk i think complexity of the best solution
will be O(k*nCk) (as in siddarths solution)
siddharth's solution will fail in case k  64
a simple recursive program is possible i think in same complexity.

On Thu, Jul 28, 2011 at 6:40 PM, Tushar Bindal tushicom...@gmail.comwrote:

 though the code given by siddharth seems to be a bit tough to understand
 due to one long statement, it gives a good idea to run the main loop fron
 2^k -1  to (2^k - 1)*(2^(n-k)) since these rae the only numbers having k
 digits set

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

2011-07-28 Thread KK
@Nikhil: ya true but i dont know wht else was he expecting.

@sunny and Muthu: like suppose u pass 20 then func should return true
with 20% probabily and false otherwise...

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

2011-07-28 Thread sunny agrawal
Okay... i was reading % as Modulus operator :(

did u gave the solution Nikhil posted , i think that should be the answer.

On Thu, Jul 28, 2011 at 9:10 PM, KK kunalkapadi...@gmail.com wrote:

 @Nikhil: ya true but i dont know wht else was he expecting.

 @sunny and Muthu: like suppose u pass 20 then func should return true
 with 20% probabily and false otherwise...

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



Re: [algogeeks] Re: Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
ya me toowas readin % as modulus :)
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*




On Thu, Jul 28, 2011 at 9:13 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 Okay... i was reading % as Modulus operator :(

 did u gave the solution Nikhil posted , i think that should be the answer.


 On Thu, Jul 28, 2011 at 9:10 PM, KK kunalkapadi...@gmail.com wrote:

 @Nikhil: ya true but i dont know wht else was he expecting.

 @sunny and Muthu: like suppose u pass 20 then func should return true
 with 20% probabily and false otherwise...

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


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

2011-07-28 Thread Tushar Bindal
yup
i got it now.
nice code

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

2011-07-28 Thread shubham
A man leaves his office daily at 07:00 PM. His driver arrives with the car 
from home to his office at sharp 07:00 PM. So he doesn't need to wait for 
any transport medium as soon he is free from his work. But today he finished 
his work early and left the office at 05:30 PM. As his driver was not there 
so he started moving towards his home on foot. After moving some distance he 
met the driver on the way (As the driver had no idea so he had started at 
the usual time) and took the car. When he reached his home he found that 
today he reached 20 minutes earlier than usual time. Then tell how much time 
it takes the man to reach his office on the normal day (with the car).

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/gn9AJcWvjuoJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] DirectI -Written Test

2011-07-28 Thread Puneet Gautam
Well, they do ask questions mainly from Linked list, tree traversals
and yes, automata
Also questions on time complexity and algos ..

Every question is given a specified time limit which bases your
scoring on how fast u do it..

Thats all i know..

On 7/28/11, radha krishnan radhakrishnance...@gmail.com wrote:
 Anyone have an idea about DirectI Written test ?
 Thanks in Advance !

 Radhakrishnan,
 CEG,AU,
 Chennai

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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-07-28 Thread Kunal Patil
Insufficient data to calculate what you need to find out !!!

On Thu, Jul 28, 2011 at 9:39 PM, shubham shubh2...@gmail.com wrote:

 A man leaves his office daily at 07:00 PM. His driver arrives with the car
 from home to his office at sharp 07:00 PM. So he doesn't need to wait for
 any transport medium as soon he is free from his work. But today he finished
 his work early and left the office at 05:30 PM. As his driver was not there
 so he started moving towards his home on foot. After moving some distance he
 met the driver on the way (As the driver had no idea so he had started at
 the usual time) and took the car. When he reached his home he found that
 today he reached 20 minutes earlier than usual time. Then tell how much time
 it takes the man to reach his office on the normal day (with the car).

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/gn9AJcWvjuoJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.



  1   2   >