finding middle element of an array
Posted
by
senthil
on Stack Overflow
See other posts from Stack Overflow
or by senthil
Published on 2011-01-09T14:36:15Z
Indexed on
2011/01/09
14:53 UTC
Read the original article
Hit count: 158
algorithm
|interview-questions
Hi all, I came cross a question in my interview.
Question:
Array of integers will be given as the input and you should find out the middle element when sorted , but without sorting.
For Example.
Input: 1,3,5,4,2
Output: 3
When you sort the given input array, it will be 1,2,3,4,5 where middle element is 3.
You should find this in one pass without sorting.
Any solutions for this?
© Stack Overflow or respective owner