mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
96df906e7a
* 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> |
||
---|---|---|
.. | ||
binary_tree | ||
data_structures/heap | ||
disjoint_set | ||
hashing | ||
heap | ||
linked_list | ||
queue | ||
stacks | ||
trie |