All suggeted changes within additional time limit tests (#1815) · unconnect/TheAlgorithmsInPython@96df906 · GitHub
Skip to content

Commit 96df906

Browse files
All suggeted changes within additional time limit tests (TheAlgorithms#1815)
* With all suggested changes ✅ 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 <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-Authored-By: Christian Clauss <cclauss@me.com> * 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 <cclauss@me.com>
1 parent ac664df commit 96df906

1 file changed

Lines changed: 75 additions & 13 deletions

File tree

Lines changed: 75 additions & 13 deletions

0 commit comments

Comments
 (0)