Re: [algogeeks] Adobe Interview Question

2012-12-16 Thread manish untwal
file redirection!! i did that too i was finding myself helplessi
tried every thing!! as a result, i missed on this question

On Wed, Dec 12, 2012 at 8:53 AM, saurabh singh saurab...@gmail.com wrote:

 I would have replied back with I am doing it with C programming language
 only. the read function that we use is not an actual system call. It is a
 *wrapper to a system call*. Any other function that we use usually ends
 up in calling some system call. The actual system call is called by low
 level routines.
 If he still disagreed I would have given him this solution:

 #includestdio.h
 int main()
 {
 int ch;
 while((ch=getchar())!=-1) putchar(ch);
 return 0;
 }

 Would have run this as *./a.out  file_to_read*
 *
 *
 If he still disagreed I would have walked out :P


 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Tue, Dec 11, 2012 at 11:23 PM, manish untwal 
 manishuntw...@gmail.comwrote:

 i answered with the...system call too..but he said...do it in C
 programming language only don't use...system call here!!

 On Tue, Dec 11, 2012 at 10:32 PM, saurabh singh saurab...@gmail.comwrote:

 stdin is a file pointer.
 freopen returns a file pointer..
 I suggest using read system call.

 For the second question it would be simply
 (len)!/((frequency_0)!*(frequency_1)!*(frequency_2)!...)

 However this will also contains permutations which begin with 0. So
 subtract the number of permutations that begin with 0 from this number.

 Since any factorial in the denominator part will be less than or equal
 to (len)! we can calculate and store them while calculating len! Hence the
 overall operation will take O(len) time which would be O(log n) where n is
 the number.

 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Tue, Dec 11, 2012 at 11:02 AM, amrit harry 
 dabbcomput...@gmail.comwrote:

 1st:

 freopen(filename,r,stdin);

 while(scanf(%s,str)!=-1)
 {
 printf(%s\n,str);
 }


 On Sun, Dec 9, 2012 at 3:22 PM, manish untwal 
 manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was
 not able to answer properly
 1) how to print the content of file in C without using the file
 pointer.
 2) count the total number of permutation of a number in order O(n)

 --






 --
 Thanks  Regards
 Amritpal singh

  --




  --






 --
 With regards,
 Manish kumar untwal
 Indian Institute of Information Technology
 Allahabad (2009-2013 batch)

  --




  --






-- 
With regards,
Manish kumar untwal
Indian Institute of Information Technology
Allahabad (2009-2013 batch)

-- 




Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread amrit harry
1st:

freopen(filename,r,stdin);

while(scanf(%s,str)!=-1)
{
printf(%s\n,str);
}


On Sun, Dec 9, 2012 at 3:22 PM, manish untwal manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was not
 able to answer properly
 1) how to print the content of file in C without using the file pointer.
 2) count the total number of permutation of a number in order O(n)

 --






-- 
Thanks  Regards
Amritpal singh

-- 




Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread saurabh singh
stdin is a file pointer.
freopen returns a file pointer..
I suggest using read system call.

For the second question it would be simply
(len)!/((frequency_0)!*(frequency_1)!*(frequency_2)!...)

However this will also contains permutations which begin with 0. So
subtract the number of permutations that begin with 0 from this number.

Since any factorial in the denominator part will be less than or equal to
(len)! we can calculate and store them while calculating len! Hence the
overall operation will take O(len) time which would be O(log n) where n is
the number.

Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Tue, Dec 11, 2012 at 11:02 AM, amrit harry dabbcomput...@gmail.comwrote:

 1st:

 freopen(filename,r,stdin);

 while(scanf(%s,str)!=-1)
 {
 printf(%s\n,str);
 }


 On Sun, Dec 9, 2012 at 3:22 PM, manish untwal manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was not
 able to answer properly
 1) how to print the content of file in C without using the file pointer.
 2) count the total number of permutation of a number in order O(n)

 --






 --
 Thanks  Regards
 Amritpal singh

  --




-- 




Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread manish untwal
i answered with the...system call too..but he said...do it in C programming
language only don't use...system call here!!

On Tue, Dec 11, 2012 at 10:32 PM, saurabh singh saurab...@gmail.com wrote:

 stdin is a file pointer.
 freopen returns a file pointer..
 I suggest using read system call.

 For the second question it would be simply
 (len)!/((frequency_0)!*(frequency_1)!*(frequency_2)!...)

 However this will also contains permutations which begin with 0. So
 subtract the number of permutations that begin with 0 from this number.

 Since any factorial in the denominator part will be less than or equal to
 (len)! we can calculate and store them while calculating len! Hence the
 overall operation will take O(len) time which would be O(log n) where n is
 the number.

 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Tue, Dec 11, 2012 at 11:02 AM, amrit harry dabbcomput...@gmail.comwrote:

 1st:

 freopen(filename,r,stdin);

 while(scanf(%s,str)!=-1)
 {
 printf(%s\n,str);
 }


 On Sun, Dec 9, 2012 at 3:22 PM, manish untwal manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was not
 able to answer properly
 1) how to print the content of file in C without using the file pointer.
 2) count the total number of permutation of a number in order O(n)

 --






 --
 Thanks  Regards
 Amritpal singh

  --




  --






-- 
With regards,
Manish kumar untwal
Indian Institute of Information Technology
Allahabad (2009-2013 batch)

-- 




Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread manish untwal
i think, i replied with the same answer and he was not convinced

On Tue, Dec 11, 2012 at 11:02 AM, amrit harry dabbcomput...@gmail.comwrote:

 1st:

 freopen(filename,r,stdin);

 while(scanf(%s,str)!=-1)
 {
 printf(%s\n,str);
 }


 On Sun, Dec 9, 2012 at 3:22 PM, manish untwal manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was not
 able to answer properly
 1) how to print the content of file in C without using the file pointer.
 2) count the total number of permutation of a number in order O(n)

 --






 --
 Thanks  Regards
 Amritpal singh

  --






-- 
With regards,
Manish kumar untwal
Indian Institute of Information Technology
Allahabad (2009-2013 batch)

-- 




Re: [algogeeks] Adobe Interview Question

2012-12-11 Thread saurabh singh
I would have replied back with I am doing it with C programming language
only. the read function that we use is not an actual system call. It
is a *wrapper
to a system call*. Any other function that we use usually ends up in
calling some system call. The actual system call is called by low level
routines.
If he still disagreed I would have given him this solution:

#includestdio.h
int main()
{
int ch;
while((ch=getchar())!=-1) putchar(ch);
return 0;
}

Would have run this as *./a.out  file_to_read*
*
*
If he still disagreed I would have walked out :P


Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com



On Tue, Dec 11, 2012 at 11:23 PM, manish untwal manishuntw...@gmail.comwrote:

 i answered with the...system call too..but he said...do it in C
 programming language only don't use...system call here!!

 On Tue, Dec 11, 2012 at 10:32 PM, saurabh singh saurab...@gmail.comwrote:

 stdin is a file pointer.
 freopen returns a file pointer..
 I suggest using read system call.

 For the second question it would be simply
 (len)!/((frequency_0)!*(frequency_1)!*(frequency_2)!...)

 However this will also contains permutations which begin with 0. So
 subtract the number of permutations that begin with 0 from this number.

 Since any factorial in the denominator part will be less than or equal to
 (len)! we can calculate and store them while calculating len! Hence the
 overall operation will take O(len) time which would be O(log n) where n is
 the number.

 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Tue, Dec 11, 2012 at 11:02 AM, amrit harry dabbcomput...@gmail.comwrote:

 1st:

 freopen(filename,r,stdin);

 while(scanf(%s,str)!=-1)
 {
 printf(%s\n,str);
 }


 On Sun, Dec 9, 2012 at 3:22 PM, manish untwal 
 manishuntw...@gmail.comwrote:

 I gave this interview in August this year, two of the question i was
 not able to answer properly
 1) how to print the content of file in C without using the file pointer.
 2) count the total number of permutation of a number in order O(n)

 --






 --
 Thanks  Regards
 Amritpal singh

  --




  --






 --
 With regards,
 Manish kumar untwal
 Indian Institute of Information Technology
 Allahabad (2009-2013 batch)

  --




-- 




[algogeeks] Adobe Interview Question

2012-12-10 Thread manish untwal
I gave this interview in August this year, two of the question i was not 
able to answer properly
1) how to print the content of file in C without using the file pointer.
2) count the total number of permutation of a number in order O(n)

-- 




Re: [algogeeks] Adobe interview question

2012-07-10 Thread Bhaskar Kushwaha
@himanshu making constructor protected is okay because even for abstract
base class u cannot create objects in derived class

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

2012-07-10 Thread Bhaskar Kushwaha
If the constructor is made protected u cannot make object of that class
anywhere

On Tue, Jul 10, 2012 at 3:10 PM, Bhaskar Kushwaha 
bhaskar.kushwaha2...@gmail.com wrote:

 @himanshu making constructor protected is okay because even for abstract
 base class u cannot create objects in derived class




-- 
regards,
Bhaskar Kushwaha
Student
Final year
CSE
M.N.N.I.T.  Allahabad

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



Re: [algogeeks] Adobe interview question

2012-06-27 Thread rahul sharma
@himanshu...i didnt read full question.got it now...

On Mon, Jun 25, 2012 at 9:12 AM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 @rahul: the ques itself says that we have to implement abstract class*without
 * using pure virtual function...


 On Sun, Jun 24, 2012 at 12:00 AM, rahul sharma rahul23111...@gmail.comwrote:

 yeah use pure virtual fxn..


 On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 i told the interviewer...bt he said thn the constt would not be
 accessible to derived class alsohe told me dt u shld make the constt.
 protecteddats why i ws confused...


 On Fri, Jun 22, 2012 at 2:38 PM, raghavan M 
 peacelover1987...@yahoo.co.in wrote:

 Make all constructors private.


   --
 *From:* himanshu kansal himanshukansal...@gmail.com
 *To:* Algorithm Geeks algogeeks@googlegroups.com
 *Sent:* Friday, 22 June 2012 1:44 PM
 *Subject:* [algogeeks] Adobe interview question

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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




 --

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.


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


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

2012-06-27 Thread himanshu kansal
So, i think there is no way to implement abstract class without using pure
virtual functions since
1. if we make the constructor private then derived classes cannot be
instantiatedthey too become abstract class.
2. if we make constructor protected, then derived class will be able to
create (instantiate ) objects of base classwhich is ofcourse we dont
want

any other way would be highly appreciated


On Wed, Jun 27, 2012 at 11:16 PM, rahul sharma rahul23111...@gmail.comwrote:

 @himanshu...i didnt read full question.got it now...


 On Mon, Jun 25, 2012 at 9:12 AM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 @rahul: the ques itself says that we have to implement abstract class*without
 * using pure virtual function...


 On Sun, Jun 24, 2012 at 12:00 AM, rahul sharma 
 rahul23111...@gmail.comwrote:

 yeah use pure virtual fxn..


 On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 i told the interviewer...bt he said thn the constt would not be
 accessible to derived class alsohe told me dt u shld make the constt.
 protecteddats why i ws confused...


 On Fri, Jun 22, 2012 at 2:38 PM, raghavan M 
 peacelover1987...@yahoo.co.in wrote:

 Make all constructors private.


   --
 *From:* himanshu kansal himanshukansal...@gmail.com
 *To:* Algorithm Geeks algogeeks@googlegroups.com
 *Sent:* Friday, 22 June 2012 1:44 PM
 *Subject:* [algogeeks] Adobe interview question

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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




 --

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.


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


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

2012-06-24 Thread himanshu kansal
@rahul: the ques itself says that we have to implement abstract class*without
* using pure virtual function...

On Sun, Jun 24, 2012 at 12:00 AM, rahul sharma rahul23111...@gmail.comwrote:

 yeah use pure virtual fxn..


 On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 i told the interviewer...bt he said thn the constt would not be
 accessible to derived class alsohe told me dt u shld make the constt.
 protecteddats why i ws confused...


 On Fri, Jun 22, 2012 at 2:38 PM, raghavan M 
 peacelover1987...@yahoo.co.in wrote:

 Make all constructors private.


   --
 *From:* himanshu kansal himanshukansal...@gmail.com
 *To:* Algorithm Geeks algogeeks@googlegroups.com
 *Sent:* Friday, 22 June 2012 1:44 PM
 *Subject:* [algogeeks] Adobe interview question

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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




 --

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.


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

2012-06-23 Thread rahul sharma
yeah use pure virtual fxn..

On Fri, Jun 22, 2012 at 3:41 PM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 i told the interviewer...bt he said thn the constt would not be accessible
 to derived class alsohe told me dt u shld make the constt.
 protecteddats why i ws confused...


 On Fri, Jun 22, 2012 at 2:38 PM, raghavan M peacelover1987...@yahoo.co.in
  wrote:

 Make all constructors private.


   --
 *From:* himanshu kansal himanshukansal...@gmail.com
 *To:* Algorithm Geeks algogeeks@googlegroups.com
 *Sent:* Friday, 22 June 2012 1:44 PM
 *Subject:* [algogeeks] Adobe interview question

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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




 --

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.


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

2012-06-22 Thread himanshu kansal
How will u implement an abstract class in c++ w/o using pure virtual
function???

will making all the constructors and assignment operators protected
suffice???
i doubt since the derived classes will be able to create objects of
that classand according to definition of abstract class, no object
of it should be created...


any other way??

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



Re: [algogeeks] Adobe interview question

2012-06-22 Thread raghavan M
Make all constructors private.




 From: himanshu kansal himanshukansal...@gmail.com
To: Algorithm Geeks algogeeks@googlegroups.com 
Sent: Friday, 22 June 2012 1:44 PM
Subject: [algogeeks] Adobe interview question
 
How will u implement an abstract class in c++ w/o using pure virtual
function???

will making all the constructors and assignment operators protected
suffice???
i doubt since the derived classes will be able to create objects of
that classand according to definition of abstract class, no object
of it should be created...


any other way??

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

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



Re: [algogeeks] Adobe interview question

2012-06-22 Thread Amitesh Singh
It can done using pure virtual destructor.

struct A
{
//your implementation ..
..
..
virtual ~A() = 0;
};
A::~A()
{
}


-- 
Amitesh




On Fri, Jun 22, 2012 at 1:44 PM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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



Re: [algogeeks] Adobe interview question

2012-06-22 Thread Amitesh Singh
a pure virtual function does not have definition. Since pure virtual
destructor has a definition so its only for not allowing the object
instantiation, although it does not have any other abstract functions.


-- 
Amitesh




On Fri, Jun 22, 2012 at 1:51 PM, Amitesh Singh singh.amit...@gmail.comwrote:

 It can done using pure virtual destructor.

 struct A
 {
 //your implementation ..
 ..
 ..
 virtual ~A() = 0;
 };
 A::~A()
 {
 }


 --
 Amitesh




 On Fri, Jun 22, 2012 at 1:44 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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




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



Re: [algogeeks] Adobe interview question

2012-06-22 Thread himanshu kansal
i told the interviewer...bt he said thn the constt would not be accessible
to derived class alsohe told me dt u shld make the constt.
protecteddats why i ws confused...

On Fri, Jun 22, 2012 at 2:38 PM, raghavan M
peacelover1987...@yahoo.co.inwrote:

 Make all constructors private.


   --
 *From:* himanshu kansal himanshukansal...@gmail.com
 *To:* Algorithm Geeks algogeeks@googlegroups.com
 *Sent:* Friday, 22 June 2012 1:44 PM
 *Subject:* [algogeeks] Adobe interview question

 How will u implement an abstract class in c++ w/o using pure virtual
 function???

 will making all the constructors and assignment operators protected
 suffice???
 i doubt since the derived classes will be able to create objects of
 that classand according to definition of abstract class, no object
 of it should be created...


 any other way??

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



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




-- 

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

2011-08-15 Thread Anika Jain
i m sorry i cant understand the question.. if there are n no. steps to cross
and he can take only one step at a time.. then suppose n=3 then obviously
doesnt he need to take step 1 first then step 2 then step 3.. ?? m confused!

On Sun, Aug 14, 2011 at 12:38 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:

 typo in above code..find t(n+1)


 On Sun, Aug 14, 2011 at 12:37 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 if steps are between banks then try dis.
 if n=3 steps
 then find t(n+2)
 and use the fibonacci formula t(n)=t(n-1)+t(n-2)
 t(1)=1;
 t(2)=2;
 now this will work ...


 On Sun, Aug 14, 2011 at 12:34 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 i am sorry.i misinterpret the question...i dint c that the steps are
 between   banks..


 On Sun, Aug 14, 2011 at 12:26 AM, ankit tyagi ankittya...@gmail.comwrote:

 seems fine..


 On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel mohitgoel291...@gmail.com
  wrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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




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




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


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

2011-08-15 Thread manish patel
actually here jumping of steps mean it can jump over 1 step at max. like if
it is at step no 1 he can jump to 3 as well as 2 but not to 4.
Soln is Fibonacci eqn.
t(n)=t(n-1)+t(n-2);
where t(1)=2 and t(2)=3

On Mon, Aug 15, 2011 at 6:06 PM, Anika Jain anika.jai...@gmail.com wrote:

 i m sorry i cant understand the question.. if there are n no. steps to
 cross and he can take only one step at a time.. then suppose n=3 then
 obviously doesnt he need to take step 1 first then step 2 then step 3.. ?? m
 confused!


 On Sun, Aug 14, 2011 at 12:38 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 typo in above code..find t(n+1)


 On Sun, Aug 14, 2011 at 12:37 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 if steps are between banks then try dis.
 if n=3 steps
 then find t(n+2)
 and use the fibonacci formula t(n)=t(n-1)+t(n-2)
 t(1)=1;
 t(2)=2;
 now this will work ...


 On Sun, Aug 14, 2011 at 12:34 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 i am sorry.i misinterpret the question...i dint c that the steps are
 between   banks..


 On Sun, Aug 14, 2011 at 12:26 AM, ankit tyagi ankittya...@gmail.comwrote:

 seems fine..


 On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel 
 mohitgoel291...@gmail.com wrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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




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




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


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


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

2011-08-13 Thread Decipher


There is a river and there are n number of steps between two banks of the 
river to cross the river.

A frog wants to cross the river with the condition that he can jump max one 
step. Find the number of ways he can cross the river?


For e.g. if there are 3 steps in between, frog can go from paths: _123_, 
_2_, _13_ so there are 3 different ways frog can cross the river (in the 
example _ is two ends of the river)


Can this question be done using Dynamic Programming ? If yes, please tell 
how .

-- 
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/-/4HJq5yRGXboJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Adobe Interview Question

2011-08-13 Thread Akash Mukherjee
dp problem, refer to dp from AFI

On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote:

 There is a river and there are n number of steps between two banks of the
 river to cross the river.

 A frog wants to cross the river with the condition that he can jump max one
 step. Find the number of ways he can cross the river?


 For e.g. if there are 3 steps in between, frog can go from paths: _123_,
 _2_, _13_ so there are 3 different ways frog can cross the river (in the
 example _ is two ends of the river)


 Can this question be done using Dynamic Programming ? If yes, please tell
 how .

 --
 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/-/4HJq5yRGXboJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


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

2011-08-13 Thread aseem garg
The soln is nth term of fibonacci sequence...isnt it?

Aseem



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

 dp problem, refer to dp from AFI


 On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote:

 There is a river and there are n number of steps between two banks of the
 river to cross the river.

 A frog wants to cross the river with the condition that he can jump max
 one step. Find the number of ways he can cross the river?


 For e.g. if there are 3 steps in between, frog can go from paths: _123_,
 _2_, _13_ so there are 3 different ways frog can cross the river (in the
 example _ is two ends of the river)


 Can this question be done using Dynamic Programming ? If yes, please tell
 how .

 --
 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/-/4HJq5yRGXboJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


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


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

2011-08-13 Thread Kamakshii Aggarwal
yes nth term of fibonacci series.
.t(n)=t(n-1)+t(n-2);
where
t(1)=1;
t(2)=2;


On Sat, Aug 13, 2011 at 10:11 PM, aseem garg ase.as...@gmail.com wrote:

 The soln is nth term of fibonacci sequence...isnt it?

 Aseem



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

 dp problem, refer to dp from AFI


 On Sat, Aug 13, 2011 at 9:01 PM, Decipher ankurseth...@gmail.com wrote:

 There is a river and there are n number of steps between two banks of the
 river to cross the river.

 A frog wants to cross the river with the condition that he can jump max
 one step. Find the number of ways he can cross the river?


 For e.g. if there are 3 steps in between, frog can go from paths: _123_,
 _2_, _13_ so there are 3 different ways frog can cross the river (in the
 example _ is two ends of the river)


 Can this question be done using Dynamic Programming ? If yes, please tell
 how .

 --
 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/-/4HJq5yRGXboJ.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


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


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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Decipher
How did you know that ?

-- 
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/-/GMle2k9i73wJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Adobe Interview Question

2011-08-13 Thread Kamakshii Aggarwal
coz i have tried a similar question like dis...also u can check it also...

On Sat, Aug 13, 2011 at 10:47 PM, Decipher ankurseth...@gmail.com wrote:

 How did you know that ?

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

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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Piyush Kapoor
what does step refer to in this case???
Please explain the example...

On Sat, Aug 13, 2011 at 10:47 PM, Decipher ankurseth...@gmail.com wrote:

 How did you know that ?

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

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




-- 
*Regards,*
*Piyush Kapoor,*
*2nd year,CSE
IT-BHU*

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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread ankit tyagi
HI,
   for n=3 there are 4 possibility
1  _123_
2  _13_
2   _23_
4  _2_

but according to kamakshi it should be 3. please explain


On Sat, Aug 13, 2011 at 11:05 PM, Piyush Kapoor pkjee2...@gmail.com wrote:

 what does step refer to in this case???
 Please explain the example...


 On Sat, Aug 13, 2011 at 10:47 PM, Decipher ankurseth...@gmail.com wrote:

 How did you know that ?

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

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




 --
 *Regards,*
 *Piyush Kapoor,*
 *2nd year,CSE
 IT-BHU*

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


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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Mohit Goel
there are 5 possibilities ..5th one is_12_..other as specified by
ankit...


t(1) =2  (it can directly jump to anathor bank)
t(2) =3 ( _2_,_1_,_12_)

t(3) =5...
thats how fibonnaci goes on plz correct if wrong...

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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread ankit tyagi
seems fine..

On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel mohitgoel291...@gmail.comwrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Kamakshii Aggarwal
i am sorry.i misinterpret the question...i dint c that the steps are between
  banks..

On Sun, Aug 14, 2011 at 12:26 AM, ankit tyagi ankittya...@gmail.com wrote:

 seems fine..


 On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel mohitgoel291...@gmail.comwrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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




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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Kamakshii Aggarwal
if steps are between banks then try dis.
if n=3 steps
then find t(n+2)
and use the fibonacci formula t(n)=t(n-1)+t(n-2)
t(1)=1;
t(2)=2;
now this will work ...

On Sun, Aug 14, 2011 at 12:34 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:

 i am sorry.i misinterpret the question...i dint c that the steps are
 between   banks..


 On Sun, Aug 14, 2011 at 12:26 AM, ankit tyagi ankittya...@gmail.comwrote:

 seems fine..


 On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel 
 mohitgoel291...@gmail.comwrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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




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



Re: [algogeeks] Adobe Interview Question

2011-08-13 Thread Kamakshii Aggarwal
typo in above code..find t(n+1)

On Sun, Aug 14, 2011 at 12:37 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:

 if steps are between banks then try dis.
 if n=3 steps
 then find t(n+2)
 and use the fibonacci formula t(n)=t(n-1)+t(n-2)
 t(1)=1;
 t(2)=2;
 now this will work ...


 On Sun, Aug 14, 2011 at 12:34 AM, Kamakshii Aggarwal 
 kamakshi...@gmail.com wrote:

 i am sorry.i misinterpret the question...i dint c that the steps are
 between   banks..


 On Sun, Aug 14, 2011 at 12:26 AM, ankit tyagi ankittya...@gmail.comwrote:

 seems fine..


 On Sun, Aug 14, 2011 at 12:13 AM, Mohit Goel 
 mohitgoel291...@gmail.comwrote:

 there are 5 possibilities ..5th one is_12_..other as specified by
 ankit...


 t(1) =2  (it can directly jump to anathor bank)
 t(2) =3 ( _2_,_1_,_12_)

 t(3) =5...
 thats how fibonnaci goes on plz correct if wrong...


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


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




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




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



[algogeeks] Adobe Interview Question

2011-01-10 Thread shady
Given an array of numbers : a1, a2, a3. an
(a)divide them in such a way that every alternate segment is given to
two persons john and mary, equally the number of segments made should be
minimum...
eg
for input
1 4 5 6 2 2 2 2 4 5 6 1 1 7 8 8 1 7
segments :
(John)1 4 5 6 2 2 - (Mary)2 2 4 5 6 1 --- (john) 1 7 8 -- (Mary) 8 1
7
minimum cuts made are 3

(b)Divide the numbers in such a way that both recieve same sum of
numbers.
If input
3 4 5 7 2 5 2
segments
(john) 3 4 5 - (mary) 7 2 5 - (john) 2
minimum cuts are 2

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



Re: [algogeeks] Adobe Interview Question

2010-12-21 Thread dinesh bansal
If we rewrite question in terms of Probability, call to foo2() depends on
two events:
1. (E1) A  B, probablity 75%.
2. (E2) C  D, again probability 75%.

Probability (E) = Prob(E1) * Prob(E2) = 75/100 * 75/100 * 5000 = 2812.50
times.

Correct me if wrong.
- Dinesh Bansal

On Wed, Dec 15, 2010 at 12:36 AM, bittu shashank7andr...@gmail.com wrote:


 void foo1()
 {
  if(AB)
Then {_/* */}
  else
   if(CD)
 then foo2()
 }

 How many time foo2() would get called given
 AB 25% of the times and CD 75% of the times and foo1() is called
 5000 times

 although i had diff...solution..but i wants to confirm wid others..so
 hav a look

 Regards
 Shashank Mani
 BIT Mesra

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




-- 
Dinesh Bansal
The Law of Win says, Let's not do it your way or my way; let's do it the
best way.

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



Re: [algogeeks] Adobe Interview Question

2010-12-20 Thread Ashish Goel
you can't find...

are these mutually exclusive or independent? think twice, draw venn diag

there would be cases when AB as well as CD, in such cases foo2 will NOT be
called



Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Wed, Dec 15, 2010 at 12:36 AM, bittu shashank7andr...@gmail.com wrote:


 void foo1()
 {
  if(AB)
Then {_/* */}
  else
   if(CD)
 then foo2()
 }

 How many time foo2() would get called given
 AB 25% of the times and CD 75% of the times and foo1() is called
 5000 times

 although i had diff...solution..but i wants to confirm wid others..so
 hav a look

 Regards
 Shashank Mani
 BIT Mesra

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



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



Re: [algogeeks] Adobe Interview Question

2010-12-20 Thread Naveen Kumar
I second Ashish,

These two events are independent

On Tue, Dec 21, 2010 at 10:57 AM, Ashish Goel ashg...@gmail.com wrote:

 you can't find...

 are these mutually exclusive or independent? think twice, draw venn diag

 there would be cases when AB as well as CD, in such cases foo2 will NOT
 be called



 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Wed, Dec 15, 2010 at 12:36 AM, bittu shashank7andr...@gmail.comwrote:


 void foo1()
 {
  if(AB)
Then {_/* */}
  else
   if(CD)
 then foo2()
 }

 How many time foo2() would get called given
 AB 25% of the times and CD 75% of the times and foo1() is called
 5000 times

 although i had diff...solution..but i wants to confirm wid others..so
 hav a look

 Regards
 Shashank Mani
 BIT Mesra

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


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




-- 
Cheers
Naveen Kumar

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



Re: [algogeeks] Adobe Interview Question

2010-12-20 Thread Utkarsh Srivastava
Yeah, the events are independent .. But the statements (if/then) are
not independent !! The second else executes when the first if fails.


Utkarsh Srivastava ,
Final Year, Under Grad Student
B.Tech, Computer Science  Engineering
Indian Institute of Technology, Guwahati,India



On Tue, Dec 21, 2010 at 11:07 AM, Naveen Kumar
naveenkumarve...@gmail.com wrote:
 I second Ashish,

 These two events are independent

 On Tue, Dec 21, 2010 at 10:57 AM, Ashish Goel ashg...@gmail.com wrote:

 you can't find...
 are these mutually exclusive or independent? think twice, draw venn diag
 there would be cases when AB as well as CD, in such cases foo2 will NOT
 be called


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Wed, Dec 15, 2010 at 12:36 AM, bittu shashank7andr...@gmail.com
 wrote:

 void foo1()
 {
  if(AB)
    Then {_/* */}
  else
   if(CD)
     then foo2()
 }

 How many time foo2() would get called given
 AB 25% of the times and CD 75% of the times and foo1() is called
 5000 times

 although i had diff...solution..but i wants to confirm wid others..so
 hav a look

 Regards
 Shashank Mani
 BIT Mesra

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


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



 --
 Cheers
 Naveen Kumar

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


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



[algogeeks] Adobe Interview Question

2010-12-14 Thread bittu

void foo1()
{
  if(AB)
Then {_/* */}
  else
   if(CD)
 then foo2()
}

How many time foo2() would get called given
AB 25% of the times and CD 75% of the times and foo1() is called
5000 times

although i had diff...solution..but i wants to confirm wid others..so
hav a look

Regards
Shashank Mani
BIT Mesra

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



Re: [algogeeks] Adobe Interview Question

2010-12-14 Thread Amir hossein Shahriari
2812.5

On Tue, Dec 14, 2010 at 10:36 PM, bittu shashank7andr...@gmail.com wrote:


 void foo1()
 {
  if(AB)
Then {_/* */}
  else
   if(CD)
 then foo2()
 }

 How many time foo2() would get called given
 AB 25% of the times and CD 75% of the times and foo1() is called
 5000 times

 although i had diff...solution..but i wants to confirm wid others..so
 hav a look

 Regards
 Shashank Mani
 BIT Mesra

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



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



[algogeeks] adobe interview question

2009-09-01 Thread yash

Given a chessboard in which u dont know how the black and white boxes
are arranged but this is sure that there will 32 black squares and 32
white squares.You have to find the least possible disatnce between any
two sqaures of same colour ...

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