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

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

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

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

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

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

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

[algogeeks] adobe interview

2012-09-13 Thread Ayush Kapoor
There was a question in written round that there is a global static variable ‘lock’ initially set to 0 and there was a code segment given. while(lock); lock = 1; //Critical section lock = 0; Does this solve critical section problem. -- You received this message because you are subscribed to

Re: [algogeeks] adobe interview

2012-09-13 Thread bharat b
No... say process 1 set lock variable to 1 and gets pre-empted .. process2 executes the same code and comes to critical section and gets pre-empted.. now process1 resumed.. NOW BOTH ARE IN CRITICAL SECTION .. On Thu, Sep 13, 2012 at 7:14 PM, Ayush Kapoor ayush21011...@gmail.comwrote: There

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

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

Re: [algogeeks] Adobe interview question

2012-06-27 Thread rahul sharma
*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

Re: [algogeeks] Adobe interview question

2012-06-27 Thread himanshu kansal
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

Re: [algogeeks] Adobe interview question

2012-06-24 Thread himanshu kansal
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

Re: [algogeeks] Adobe interview question

2012-06-23 Thread rahul sharma
*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 class

[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

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

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

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

Re: [algogeeks] Adobe interview question

2012-06-22 Thread himanshu kansal
. -- *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

Re: [algogeeks] Adobe Interview - 20/08/2011

2011-08-22 Thread saurabh agrawal
How did u solved : 3) There is a list containing the checkin and checkout time of every person in a party . The checkin time is in ascending order while the checkout is random . Eg: Check_inCheck_out Person 1 8.00 9.00

Re: [algogeeks] Adobe Interview - 20/08/2011

2011-08-22 Thread Jagannath Prasad Das
i think find max and min of all time-stamps respectively On Mon, Aug 22, 2011 at 12:44 PM, saurabh agrawal saurabh...@gmail.comwrote: How did u solved : 3) There is a list containing the checkin and checkout time of every person in a party . The checkin time is in ascending order while the

Re: [algogeeks] Adobe Interview - 20/08/2011

2011-08-22 Thread sagar pareek
@saurabh pls post ur solutions too On Mon, Aug 22, 2011 at 12:48 PM, Jagannath Prasad Das jpdasi...@gmail.comwrote: i think find max and min of all time-stamps respectively On Mon, Aug 22, 2011 at 12:44 PM, saurabh agrawal saurabh...@gmail.comwrote: How did u solved : 3) There is a list

Re: [algogeeks] Adobe Interview - 20/08/2011

2011-08-22 Thread Jagannath Prasad Das
for the stick prob is the stick length required? On Mon, Aug 22, 2011 at 12:48 PM, Jagannath Prasad Das jpdasi...@gmail.comwrote: i think find max and min of all time-stamps respectively On Mon, Aug 22, 2011 at 12:44 PM, saurabh agrawal saurabh...@gmail.comwrote: How did u solved : 3)

Re: [algogeeks] Adobe Interview - 20/08/2011

2011-08-22 Thread Decipher
Sticks length not required . Think in coordinate geometry in 3D . Also for Checkin and Checkout question - Make a flag array associated with each element of the list and initialize the every element to *{1}* and traverse the checkout list (checkout[i]) . Now do binary search for an entry in

[algogeeks] Adobe Interview - 20/08/2011

2011-08-21 Thread Decipher
Hi, This is my Adobe interview experience for freshers : *Written Test:* Engineering – 45 Minutes - Data Structures, Algorithms, Operating Systems C/C++ – 45 Minutes - C/C++ Fundamentals Coding Aptitude– 45 Minutes –

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

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

[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

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

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

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

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

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

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

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,

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

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

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

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

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

[algogeeks] Adobe Interview

2011-01-14 Thread bittu
You have N computers and [Ca, Cb] means a is connected to b and this connectivity is symmetric and transitive. then write a program which checks this Regards Shashank -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] Adobe Interview

2011-01-14 Thread radha krishnan
Floyd Warshall ? On Fri, Jan 14, 2011 at 6:45 PM, bittu shashank7andr...@gmail.com wrote:  You have N computers and [Ca, Cb] means a is connected to b and this connectivity is symmetric and transitive. then write a program which checks this Regards Shashank -- You received this message

[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

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

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

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

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,

[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

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

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