tags:

views:

619

answers:

3

What is Median of Sorted Arrays in O(log n) complexity ?

+1  A: 

Do anything you want for O(log n), then finish by returning the value in O(1)?

return array[array.length / 2];

Edit: this is not fully complete:

  • It's not proper language syntax (since it's an algorithm problem)
  • It doesn't address an even number of array elements
280Z28
+2  A: 
if array length is odd
  take element # (length+1)/2
else
  take average of element # length/2 and # length/2 - 1
Ben Alpert
+3  A: 

What is Median of Sorted Arrays in O(log n) complexity ?

Median

Sorting

Array

Big O Notation

Logarithms

Complexity

Graphics Noob
The fact that this answer was chosen as the accepted answer is a testament to the question's rediculousness. The OP is just a question pump.
Ether