abilash.s.90
BAN USER- -1of 1 vote
AnswersThere 3 arrays A, B and C, all of equal length. C is the resultant array found using both A and B.
- abilash.s.90 in India for UI
Suppose the size of the array is 3, then we need to find out the following.
c[0] = a[0] * b[1] * b[2]
c[1] = a[1] * b[0] * b[3]
c[2] = a[2] * b[0] * b[2]
I know the answer is pretty easy when it comes to brute force. But the wanted to know the answer with time complexity O(2n) and O(log n)
Note: O(n^2) is not acceptable.| Report Duplicate | Flag | PURGE
Symphony Services Applications Developer Data Structures
and another correction... the third equation is,
c[2] = a[2] * b[0] * b[1]
sorry its b[2] i made a mistake there
- abilash.s.90 October 02, 2012Yes the answer is Insertion Sort... For people who think otherwise, please take a look a MIT open course ware Algorithm videos on YouTube...
- abilash.s.90 September 03, 2012Use divide and conquer guys.
divide 'b' by 2 recursively so that u have computed a^(b/2) once and u can multiply the same thing again to get the final value... if 'b' is a odd value subtract 1 from 'b' and do the same thing and multiply 'a' again to get the final value
Need to be more specific to get an answer for this
- abilash.s.90 September 02, 2012They are literally asking you to build a search engine...
- abilash.s.90 September 01, 2012
He's only asking for Nth number in the sequence. I suppose we can do this by using LCM
- abilash.s.90 November 25, 2013