Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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)
- Host: GitHub
- URL: https://github.com/luizfelipelopes/findmedian
- Owner: luizfelipelopes
- Created: 2024-02-27T03:48:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-27T03:57:40.000Z (11 months ago)
- Last Synced: 2024-02-27T04:43:23.430Z (11 months ago)
- Topics: algorithm, algorithm-challenges, algorithms, hackerrank, hackerrank-solutions, javascript
- Language: CSS
- Homepage: https://stackblitz.com/edit/vitejs-vite-npxxkt
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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*