Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tobiazamo/weighted-median
A linear time complexity algorithm that determines the weighted median from a series of positive rational numbers
https://github.com/tobiazamo/weighted-median
Last synced: about 2 months ago
JSON representation
A linear time complexity algorithm that determines the weighted median from a series of positive rational numbers
- Host: GitHub
- URL: https://github.com/tobiazamo/weighted-median
- Owner: tobiazamo
- Created: 2022-07-14T14:10:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-07-14T14:19:29.000Z (over 2 years ago)
- Last Synced: 2024-02-14T17:57:27.091Z (12 months ago)
- Language: Java
- Size: 266 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# weighted-median
A linear time complexity algorithm that determines the weighted median from a series of positive rational numbers.
This algorithm takes as input a sequence of positive rational numbers w1, ..., wn ∈ Q+ (excluding zero) separated by a comma and ending with a period. The output of this algorithm will be the element that, among those passed in as input, satisfies the definition of a weighted lower median; this element will be written to terminal.To find the weighted median, if the total number of occurrences (let's call it 'n', i.e. the sum of the frequencies / the total number of students) is odd, then the median is the ((n+1) / 2)-th value. If n is even, then the median is the average of the (n/2)-th and the ((n/2) + 1)-th value.
The project and the report (relazione.pdf) describing the problem, approach, solution and time complexity are in Italian.
To compile use the following commands in the teminal:
> javac Progetto.java> java Progetto < input.txt > output.txt