Python/data_structures/linked_list
Sherman Hui 477b2c24b8
Hacktoberfest: Update Linked List - print_reverse method (#2792)
* chore: update print_reverse helper method

Use a generator expression instead of slicing
`elements_list` to improve the space and time complexity
of `make_linked_list` to O(1) space and O(n) time
by avoiding the creation a shallow copy of `elements_list`.

* fix: add type checking and argument typing

Add argument typing to all methods in `print_reverse`

Add doctest to helper function `make_linked_list` and
basic edge case tests to `print_reverse`

* test: add `print_reverse` test

Fix doctest syntax and remove edge case tests that are covered
by typed arguments.

Add `print_reverse` test that expects the correct values are printed
out by adding a `test_print_reverse_output` helper function.

* format code

Co-authored-by: shellhub <shellhub.me@gmail.com>
2020-10-05 19:08:57 +08:00
..
__init__.py data_structures/linked_list: Add __len__() function and tests (#2047) 2020-05-31 11:37:45 +02:00
circular_linked_list.py Updated circular_linked_list (#2483) 2020-09-26 22:57:09 +08:00
deque_doubly.py Fix imports for all namespace packages (#2506) 2020-09-28 23:41:04 +02:00
doubly_linked_list.py Fix doubly linked list algorithm (#2062) 2020-08-02 23:55:18 +08:00
from_sequence.py GitHub Action formats our code with psf/black (#1569) 2019-11-14 19:59:43 +01:00
has_loop.py Contains loops.py add (#2442) 2020-09-18 22:53:50 +02:00
is_palindrome.py #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
middle_element_of_linked_list.py Tighten up psf/black and flake8 (#2024) 2020-05-22 08:10:11 +02:00
print_reverse.py Hacktoberfest: Update Linked List - print_reverse method (#2792) 2020-10-05 19:08:57 +08:00
singly_linked_list.py Fixed linked list bug (#2481) 2020-09-25 18:08:57 +02:00
skip_list.py from __future__ import annotations (#2464) 2020-09-23 13:30:13 +02:00
swap_nodes.py Create codespell.yml (#1698) 2020-01-18 13:24:33 +01:00