Python/data_structures
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
..
binary_tree Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
disjoint_set Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
hashing Fix imports for all namespace packages (#2506) 2020-09-28 23:41:04 +02:00
heap Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
linked_list Hacktoberfest: Update Linked List - print_reverse method (#2792) 2020-10-05 19:08:57 +08:00
queue Fix imports for all namespace packages (#2506) 2020-09-28 23:41:04 +02:00
stacks Updated Stack (#2414) 2020-09-13 13:56:03 +02:00
trie Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00
__init__.py Add __init__.py files in all the directories (#2503) 2020-09-28 19:42:36 +02:00