Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/luizfelipelopes/findmedian

Find Median (Problem resolved in Hacker Rank)
https://github.com/luizfelipelopes/findmedian

algorithm algorithm-challenges algorithms hackerrank hackerrank-solutions javascript

Last synced: about 2 months ago
JSON representation

Find Median (Problem resolved in Hacker Rank)

Awesome Lists containing this project

README

        

# Find Median (Hacker Rank)

The median of a list of numbers is essentially its middle element after sorting. The same number of elements occur after it as before. Given a list of numbers with an odd number of elements, find the median.

### Example

*arr = [5, 3, 1, 2, 4];*

The sorted array *arr' = [1, 2, 3, 4, 5]*. The middle element and the median is **3**.

### Function Description

findMedian has the following parameter(s):

* int arr[n]: an unsorted array of integers

### Returns

int: the median of the array

### Constraints
* *1 <= n <= 1000001*
* ***n*** is odd
* *-10000 <= arr[i] <= 10000*