ivanleoncz / Data-Capture-Challenge

Code challenge of obtaining statistical data from a list of numbers.
GNU General Public License v3.0
0 stars 0 forks source link

Issue 1 : Improve Input Validation and Time Complexity #2

Open ivanleoncz opened 11 months ago

ivanleoncz commented 11 months ago

issue

Intro

The following PR provides a handful of modifications, from documentation and input validation in order to provide more safety to DataCapture runtime, also fixing data calculations.

About Time Complexity...

It was mentioned that the prior definition of build_stats() was O(2n) instead of O(1n), but which part of the code specifically was establishing such Time Complexity magnitude, is unknown.

To my understanding, the method has a Time Complexity equivalent to O(n) - linear, happening in separate moments: - sort over self.numbers, which is linear + iteration over self.numbers, which is still linear

There's no recursion [O(2n)] or even of a quadratic magnitude [O(n^2)] taking place.

between() method is not O(n) anymore :+1: :