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
circular_linked_list.py
deque_doubly.py
doubly_linked_list.py
from_sequence.py
has_loop.py
is_palindrome.py
middle_element_of_linked_list.py
print_reverse.py Hacktoberfest: Update Linked List - print_reverse method (#2792) 2020-10-05 19:08:57 +08:00
singly_linked_list.py
skip_list.py
swap_nodes.py