we can also use dynamically allocated array where they contain the digits of number and than apply the operation it is a better option i think as we can go to any index in 0(1) time.
On Sun, Jul 17, 2011 at 5:19 PM, Harshal <hc4...@gmail.com> wrote: > thanks sourabh :) > > On Sun, Jul 17, 2011 at 5:17 PM, sourabh jakhar > <sourabhjak...@gmail.com>wrote: > >> 10 c output question . >> questions were moderate type >> but negative marking >> +3 and -2.(30 min) >> >> coding round.(45 min) >> 1.array simple question d.p >> 2.test cases of notepad >> 3.Design Big Int class in C or c++ >> >> On Sun, Jul 17, 2011 at 5:14 PM, Harshal <hc4...@gmail.com> wrote: >> >>> @manish, >>> can you please tell other questions asked by ms today? >>> >>> >>> On Sun, Jul 17, 2011 at 4:53 PM, Piyush Sinha >>> <ecstasy.piy...@gmail.com>wrote: >>> >>>> It can be done using one extra array only that is the output array out[] >>>> >>>> *int out = (int *)malloc(sizeof(n)); //n is the number of elements in a >>>> int i,temp = 1; >>>> >>>> for(i=0;i<n;i++) >>>> { >>>> out[i] = temp; >>>> temp*=a[i]; >>>> } >>>> temp =1; >>>> for(i=n-1;i>=0;i--) >>>> { >>>> out[i] *= temp; >>>> temp*=a[i]; >>>> }* >>>> >>>> >>>> >>>> On Sun, Jul 17, 2011 at 4:43 PM, manish patel >>>> <manispatel...@gmail.com>wrote: >>>> >>>>> thanx!!!! the question was asked by MS today in MNNIT. >>>>> >>>>> On Sun, Jul 17, 2011 at 4:35 PM, Anurag Aggarwal < >>>>> anurag19aggar...@gmail.com> wrote: >>>>> >>>>>> take two extra arrays b[] and c[] >>>>>> in b[] store the following thing >>>>>> b[0]=1; >>>>>> b[i]=b[i-1]*a[i-1]; >>>>>> >>>>>> >>>>>> in c[] store following things >>>>>> c[n-1]=1; >>>>>> c[i]=c[i+1]*a[i+1] (i>n-1) >>>>>> fill the c[] array in reverse order i.e. start from n-1 then go to 0; >>>>>> >>>>>> now output[] would be >>>>>> output[i]=b[i]*c[i]; >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Sun, Jul 17, 2011 at 4:28 PM, geek forgeek >>>>>> <geekhori...@gmail.com>wrote: >>>>>> >>>>>>> given an array a[0......n-1] .required to find the output array out >>>>>>> [0.........n-1] such that out [i] is the product of all the numbers >>>>>>> a[0] to >>>>>>> a[n-1] excluding a[i] >>>>>>> for ex out[2]=a[0]*a[1]*a[3]*a[4]....a[n-1] >>>>>>> constraint is not using division operator >>>>>>> >>>>>>> how to do this in 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. >>>>>>> >>>>>> >>>>>> >>>>>> Anurag Aggarwal >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>>> To unsubscribe from 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 >>>>> >>>>> Manish Patel >>>>> BTech 2nd Year >>>>> Computer Science And Engineering >>>>> National Institute of Technology -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. >>>>> >>>> >>>> >>>> >>>> -- >>>> *Piyush Sinha* >>>> *IIIT, Allahabad* >>>> *+91-7483122727* >>>> * <https://www.facebook.com/profile.php?id=100000655377926> "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. >>>> >>> >>> >>> >>> -- >>> Best Regards, >>> Harshal Choudhary >>> 7th Semester, CSE Dept. >>> NIT Surathkal, 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. >>> >> >> >> >> -- >> SOURABH JAKHAR,(CSE)(3 year) >> ROOM NO 167 , >> TILAK,HOSTEL >> 'MNNIT ALLAHABAD >> >> The Law of Win says, "Let's not do it your way or my way; let's do it the >> best way." >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Best Regards, > Harshal Choudhary > 7th Semester, CSE Dept. > NIT Surathkal, 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. > -- SOURABH JAKHAR,(CSE)(Final year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD The Law of Win says, "Let's not do it your way or my way; let's do it the best way." -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.