All suggeted changes within additional time limit tests (#1815)
* With all suggested changes :white_check_mark: possibly covered all the recommended guidelines * Updated with both slow and faster algorithms possibally covered all the recomendations * removed the time comparision part! * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <[email protected]> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <[email protected]> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <[email protected]> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <[email protected]> * Add benchmark using timeit https://docs.python.org/3/library/timeit.html The performance delta between these two implementation is quite small... ``` next_greatest_element_slow(): 1.843442126 next_greatest_element(): 1.828941414 ``` * Optimize slow() to create fast() - Three algorithms in the race Three algorithms in the race * Use a bigger test array with floats, negatives, zero * Setup import next_greatest_element_fast Co-authored-by: Christian Clauss <[email protected]>
V
Vaibhav Singh committed
96df906e7a99fc6bcf20da97702a9642dde1d37c
Parent: ac664df
Committed by GitHub <[email protected]>
on 3/27/2020, 7:16:07 AM