Subjective Question 3: Memory not allocated to char *. Interview Questions:
1] As you mentioned, can be done in log n. Modified Binary Search. 2] You calculate n factorial once and store it in PROD. O(n) You loop through 1 to n-1, divide PROD by a[i] and multiply it be (a[i]+1). Check and set for max. O(n) On Fri, Sep 9, 2011 at 11:56 PM, ravi maggon <maggonr...@gmail.com> wrote: > written 25 question 45 min > Data structures and algoosss need to be strong > heap > bst > sorted and unsorted array > paging concept frm OS > deadlocks > trashing > > > > > subjective test > 1. find the output of > main() > { > int tmp; > for(i=0;i<9;i++) > { > tmp=fork(); > if(tmp>0) > break; > printf("Hello"); > } > } > > 2. swap two strings > 3. find the error > main() > { > char *str1,*str2; > strcpy(str1,"hello"); > strcpy(str2,"world"); > } > > 4. write some code in c but don't use new where I commited mistake > 5. Learn sql and diff between corelating query & joint queries > 6. rest few ques on error and outputs of good level involving various concepts > 7. learn about p_thread in c > > interview was based on ur written score and the concept u applied in > subjective test. > > > Interview > > 1. suppose u have the following list > a1, a2, a3....., an in ascending order > because of virus this list got corrupted and u have this list now > ak, ak+1,.....an, a1, a2, ...... ak-1 > > find the position where a1 is coming to recover the list. Don't use brute > force and do this in log(n) complexity. > > 2. suppose u have this list > a1, a2, a3, .....an > u need to find > max((a1+1)*a2*a3....*an,a1*(a2+1)*a3*......*an,........,a1*a2*........*(an+1)) > give the algo for the same. > -- > > Regards > Ravi Maggon > Final Year, B.E. CSE > Thapar University > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Anup Ghatage -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.