Commit Graph

318 Commits

Author SHA1 Message Date
Caeden Perelli-Harris
9bba42eca8
refactor: Indent ... for visual purposes (#7744) 2022-10-27 19:42:30 +02:00
Shubham Kondekar
3448ae5cec
[Binary Tree] Different views of binary tree added (#6965)
* Different views of binary tree added

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* mypy errors resolved

* doc test for remaining functions

* Flake8 comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Example moved in if block

* doctest cases added

* Cases from if block removed

* Update data_structures/binary_tree/diff_views_of_binary_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/binary_tree/diff_views_of_binary_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* PR Comments resolved

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* flake8 warning resolved

* Changes revered

* flake8 issue resolved

* Put the diagrams just above the doctests

* Update diff_views_of_binary_tree.py

* Update diff_views_of_binary_tree.py

* I love mypy

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-17 22:30:01 +02:00
CenTdemeern1
04698538d8
Misc fixes across multiple algorithms (#6912)
Source: Snyk code quality
Add scikit-fuzzy to requirements

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 10:55:38 +05:30
Caeden
c94e215c8d
types: Update binary search tree typehints (#7197)
* types: Update binary search tree typehints

* refactor: Don't return `self` in `:meth:insert`

* test: Fix failing doctests

* Apply suggestions from code review

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-16 00:51:23 +02:00
Caeden
a652905b60
Add Flake8 comprehensions to pre-commit (#7235)
* ci(pre-commit): Add ``flake8-comprehensions`` to ``pre-commit`` (#7233)

* refactor: Fix ``flake8-comprehensions`` errors

* fix: Replace `map` with generator (#7233)

* fix: Cast `range` objects to `list`
2022-10-15 19:29:42 +02:00
Caeden
98a4c24878
feat: Binary tree node sum (#7020) (#7162)
* feat: Binary tree node sum (#7020)

* feat: Sum of all nodes in binary tree explanation (#7020)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/binary_tree_node_sum.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Change replace method with `__iter__` overriding (#7020)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-15 14:58:09 +02:00
Caeden
6e69181d1f
refactor: Replace list() and dict() calls with literals (#7198) 2022-10-15 06:37:03 +05:30
Caeden
2058775005
refactor: Make code more understandable (#7196)
* refactor: Make code more understandable

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-15 00:25:15 +02:00
Md Mahiuddin
26fe4c6539
Remove extra Semicolon (#7152) 2022-10-14 09:20:40 +02:00
Caeden
4d0c830d2c
Add flake8 pluin flake8 bugbear to pre-commit (#7132)
* ci(pre-commit): Add ``flake8-builtins`` additional dependency to ``pre-commit`` (#7104)

* refactor: Fix ``flake8-builtins`` (#7104)

* fix(lru_cache): Fix naming conventions in docstrings (#7104)

* ci(pre-commit): Order additional dependencies alphabetically (#7104)

* fix(lfu_cache): Correct function name in docstring (#7104)

* Update strings/snake_case_to_camel_pascal_case.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 digital_image_processing/index_calculation.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update graphs/prim.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update hashes/djb2.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* refactor: Rename `_builtin` to `builtin_` ( #7104)

* fix: Rename all instances (#7104)

* refactor: Update variable names (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ci: Create ``tox.ini`` and ignore ``A003`` (#7123)

* revert: Remove function name changes (#7104)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename tox.ini to .flake8

* Update data_structures/heap/heap.py

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>

* refactor: Rename `next_` to `next_item` (#7104)

* ci(pre-commit): Add `flake8` plugin `flake8-bugbear` (#7127)

* refactor: Follow `flake8-bugbear` plugin (#7127)

* fix: Correct `knapsack` code (#7127)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 18:03:06 +02:00
Caeden
d5a9f649b8
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003`

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
2022-10-13 19:53:59 +05:30
GURNEET SINGH
e661b98829
Binary Search Tree Inorder Traversal Algorithm (#6840)
* Binary Search Tree Inorder Traversal

* updating DIRECTORY.md

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Binary Search Tree Inorder Traversal v2

* Binary Search Tree Inorder Traversal

* Binary Search Tree Inorder Traversal

* Update inorder_tree_traversal_2022.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update inorder_tree_traversal_2022.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update inorder_tree_traversal_2022.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/inorder_tree_traversal_2022.py

* Update data_structures/binary_tree/inorder_tree_traversal_2022.py

* Updated

* Updated

* Update inorder_tree_traversal_2022.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update inorder_tree_traversal_2022.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update data_structures/binary_tree/inorder_tree_traversal_2022.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Updated and removed print statement

removed the print from inorder function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-13 14:09:01 +02:00
Caeden
07e991d553
Add pep8-naming to pre-commit hooks and fixes incorrect naming conventions (#7062)
* ci(pre-commit): Add pep8-naming to `pre-commit` hooks (#7038)

* refactor: Fix naming conventions (#7038)

* Update arithmetic_analysis/lu_decomposition.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(lu_decomposition): Replace `NDArray` with `ArrayLike` (#7038)

* chore: Fix naming conventions in doctests (#7038)

* fix: Temporarily disable project euler problem 104 (#7069)

* chore: Fix naming conventions in doctests (#7038)

Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-13 00:54:20 +02:00
Saksham Chawla
e272b9d6a4
Add typing to data_structures/queue/queue_on_pseudo_stack.py (#7037)
* Add typing

hacktoberfest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-12 18:44:08 +02:00
Saksham Chawla
aeb933bff5
Add typing to data_structures/hashing/hash_table.py (#7040)
* Update hash_table.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update hash_table.py

* Update hash_table.py

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-12 18:37:00 +02:00
Saksham Chawla
d15bf7d492
Add typing to data_structures/heap/heap_generic.py (#7044)
* Update heap_generic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update heap_generic.py

* Update heap_generic.py

* Update heap_generic.py

* Update heap_generic.py

* Update heap_generic.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-12 18:35:31 +02:00
pre-commit-ci[bot]
756bb268eb
[pre-commit.ci] pre-commit autoupdate (#6629)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.6.0 → 22.8.0](https://github.com/psf/black/compare/22.6.0...22.8.0)
- [github.com/asottile/pyupgrade: v2.37.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.37.0...v2.38.2)
- https://gitlab.com/pycqa/flake8https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.9.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/3.9.2...5.0.4)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.981)
- [github.com/codespell-project/codespell: v2.1.0 → v2.2.1](https://github.com/codespell-project/codespell/compare/v2.1.0...v2.2.1)

* Fix a long line

* Update sol1.py

* Update sol1.py

* lambda_

* Update multi_level_feedback_queue.py

* Update double_ended_queue.py

* Update sequential_minimum_optimization.py

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-10-03 22:00:45 +02:00
C21
81e30fd33c
Fix Max Fenwick Tree (#6328) 2022-09-14 09:24:55 +01:00
AmirMohammad Hosseini Nasab
f31fa4ea7e
Fenwick Tree (#6319)
* Enhance fenwick_tree.py

* Change update to add in fenwick_tree.py

* Some changes

* Fix bug

* Add O(N) initializer to FenwickTree

* Add get method to Fenwick Tree

* Change tree in Fenwick Tree

* Add rank query to FenwickTree

* Add get_array method to FenwickTree

* Add some tests

* Update data_structures/binary_tree/fenwick_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/binary_tree/fenwick_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update data_structures/binary_tree/fenwick_tree.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* change `List` to `list`

Co-authored-by: Christian Clauss <cclauss@me.com>
2022-08-16 19:38:33 +02:00
AmirMohammad Hosseini Nasab
f46ce47274
Add Max Fenwick Tree (#6298)
* Add `MaxFenwickTree`

* Reformat code style

* Fix type hints

* Fix type hints again

* Complete docstring

* Complete docstring

* Fix typo in file name

* Change MaxFenwickTree into 0-based indexing

* Fix Bugs

* Minor fix
2022-08-12 11:12:58 +02:00
Nikos Giachoudis
f7c58e4c4b
Unify primality checking (#6228)
* renames prime functions and occurances in comments

* changes implementation of primality testing to be uniform

* adds static typing as per conventions

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-07-11 22:36:57 +08:00
Christian Clauss
b75a7c77f8
pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 (#6245)
* pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0

* pre-commit run --all-files
2022-07-11 10:19:52 +02:00
Vardhaman
2d5dd6f132
MAINT: Updated f-string method (#6230)
* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2022-07-07 16:34:07 +02:00
Omkaar
dbee5f072f
Improve code on f-strings and brevity (#6126)
* Update strassen_matrix_multiplication.py

* Update matrix_operation.py

* Update enigma_machine2.py

* Update enigma_machine.py

* Update enigma_machine2.py

* Update rod_cutting.py

* Update external_sort.py

* Update sol1.py

* Update hill_cipher.py

* Update prime_numbers.py

* Update integration_by_simpson_approx.py
2022-05-13 20:51:44 +08:00
Shuangchi He
e1ec661d4e
Fix some typos (#6113)
* Fix some typos.

* Update volume.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-05-01 18:44:23 +08:00
varopxndx
10d0e4ecbf
docs: Fix quicksort & binary tree traversal doc (#4878)
* Fix quicksort doc

* add binary tree traversals doc

* Add link to the reference

* Fix job

* Change url

* Update binary_tree_traversals.md

* Update normal_distribution_quick_sort.md

* Update normal_distribution_quick_sort.md

Co-authored-by: John Law <johnlaw.po@gmail.com>
2022-04-29 01:05:21 +08:00
Christian Clauss
1ae5abfc3c
Replace typing.optional with new annotations syntax (#5829)
* Replace typing.optional with new annotations syntax

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-11-17 04:43:02 +01:00
Dylan Buchi
e7381b513b
[mypy] Fix type annotations in data_structures/stacks/next_greater_element.py (#5763)
* Fix type annotations in next_greater_element.py

* Refactor next_greater_element.py
2021-11-05 20:45:37 +01:00
Dylan Buchi
7a605766fe
[mypy] Fix type annotations in data_structures/binary_tree/red_black_tree.py (#5739)
* [mypy] Fix type annotations in red_black_tree.py

* Remove blank lines

* Update red_black_tree.py
2021-11-04 16:38:43 +01:00
Dylan Buchi
331fe6d3bc
[mypy] Fix type annotations in data_structures/binary_tree/lowest_common_ancestor.py (#5757)
* Fix type annotations in lowest_common_ancestor.py

* Refactor line 53 in lowest_common_ancestor.py
2021-11-03 21:34:08 +01:00
Dylan Buchi
24731b078c
[mypy] fix type annotations in data_structures/queue/circular_queue_linked_list.py (#5749)
* [mypy] fix type annotations in circular_queue_linked_list

* Remove 10 blank lines

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-11-02 11:09:46 +01:00
Edward Nuno
94f38dd88c
[mypy] Fix type annotations for linked_stack.py (#5576)
* Fix type annotations for linked_stack.py

* Replace Optional with inline union type

* Rename linked_stack to stack_with_singly_linked_list

* Rename stack_using_dll to stack_with_doubly_linked_list

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-31 17:03:03 +01:00
Dylan Buchi
7488c5070e
Fix type annotations in randomized_heap.py (#5704) 2021-10-31 11:49:34 +01:00
Dylan Buchi
99983c91ca
[mypy] Add/fix type annotations in data_structures/heap/skew_heap.py (#5634)
* Add abstract base class Comparable

* [mypy] Fix type annotations (strict mode)

* Fix a typo

* Remove Comparable class and set bound to bool
2021-10-31 09:38:24 +01:00
Dylan Buchi
678535b5c8
[mypy] Fix type annotations in non_recursive_segment_tree (#5652) 2021-10-30 21:43:48 +02:00
Dylan Buchi
0590d736fa
[mypy] Fix type annotations in wavelet_tree.py (#5641)
* [mypy] Fix type annotations for wavelet_tree.py

* fix a typo
2021-10-28 22:53:02 +02:00
Christian Clauss
477cc3fe59
Add pyupgrade to pre-commit (#5638)
* Add pyupgrade to pre-commit

* Remove unused imports

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-28 16:45:59 +02:00
Víctor A. Rodríguez
70368a757e
Implement Circular Queue using linked lists. Fixes TheAlgorithms#5361 (#5587)
* CircularQueueLinkedList: empty list, trivial implementation TheAlgorithms#5361

* CircularQueueLinkedList: single element list TheAlgorithms#5361

* CircularQueueLinkedList: refactor, no que empty attribute TheAlgorithms#5361

* CircularQueueLinkedList: refactor TheAlgorithms#5361

* CircularQueueLinkedList: changed internal data structure to use double linked list TheAlgorithms#5361

* CircularQueueLinkedList: enqueue test cases added TheAlgorithms#5361

* CircularQueueLinkedList: track full queue TheAlgorithms#5361

* CircularQueueLinkedList: adding functions description TheAlgorithms#5361

* CircularQueueLinkedList: type hints TheAlgorithms#5361

* CircularQueueLinkedList: algorithm explanation TheAlgorithms#5361

* CircularQueueLinkedList: missing type hints TheAlgorithms#5361

* CircularQueueLinkedList: more missing type hints TheAlgorithms#5361

* Update data_structures/queue/circular_queue_linked_list.py

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-28 22:43:24 +08:00
Dylan Buchi
bf6db32ec2
[mypy] Fix type annotations for binary tree traversals in data structures (#5556)
* [mypy] Fix type annotations for binary tree traversals in data structures

* Change variable name and update level_order_1 to use a deque

Using a deque instead of a list here, because since we are removing from the beginning of the list, the deque will be more efficient.

* remove duplicate function

* Update data_structures/binary_tree/binary_tree_traversals.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* fix function name at line 137

* Update data_structures/binary_tree/binary_tree_traversals.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Update data_structures/binary_tree/binary_tree_traversals.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Remove type alias and use the new syntax

* Update data_structures/binary_tree/binary_tree_traversals.py

Co-authored-by: John Law <johnlaw.po@gmail.com>

* Remove prints inside functions and return lists

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-28 22:05:31 +08:00
Dylan Buchi
8285913e81
[mypy] Fix and add type annotations (#5618) 2021-10-27 11:45:33 +08:00
Edward Nuno
9a03919052
[mypy] Fix type annotations for stack_using_dll.py (#5577)
* Fix mypy annotations for stack_using_dll.py

* Replace Optional with inline union type
2021-10-26 21:12:46 +02:00
Edward Nuno
c0ed031b3f
Fix type annotations for stack.py (#5566) 2021-10-26 20:33:08 +02:00
Limbad Yash
80a885c975
Update pop function (#5544)
* Updated Pop function

Added underflow condition

* Update Pop Function

Added condition to check underflow of stack

* Update stack.py

* if not self.stack: raise StackUnderflowError

* Add doctests

* StackUnderflowError

* ..., not ....

* Update stack.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-10-23 15:18:09 +02:00
Dylan Buchi
20e09c3ec2
[mypy] Add type annotations for linked queue in data structures (#5533)
* [mypy] Add/fix type annotations for linked queue in data_structures

* add return type annotation to __iter__

* Add more readable syntax
2021-10-23 11:56:58 +02:00
Edward Nuno
11ec2fd3fb
[mypy] Fix type annotations for trie.py (#5022)
* Fix type annotations for trie.py

* Add strict type annotations to trie.py

Annotate return type for all functions and type for "nodes"

* updating DIRECTORY.md

* Format trie.py

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-23 01:21:41 +08:00
Sherman Hui
629848e372
[mypy] Fix type annotations in data_structures/binary_tree (#5518)
* fix: fix mypy errors

Update binary_search_tree `arr` argument to be typed as a list
within `find_kth_smallest` function

Update return type of `merge_two_binary_trees` as both inputs can
be None which means that a None type value can be returned from
this function

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-10-22 16:07:05 +02:00
Sherman Hui
b373c991f6
[mypy] fix: fix mypy error in trie.py(#5516) 2021-10-22 11:40:17 +08:00
Sherman Hui
9153db2d27
[mypy] fix: fix mypy error in singly_linked_list.py (#5517)
The list comprehension shortcut was implicitly expecting a return
value causing a mypy error since `insert_tail` doesn't return a value
2021-10-22 11:39:18 +08:00
Benjamín García Roqués
2e955aea46
Replace double_ended_queue.py (#5429)
* Add deque_from_scratch.py

* added deque_from_scratch.py

* add extend, extendleft and make comparison

* updated operations list

* fix doctest on Deque.__iter__

* pre-commit fix

* time complexity comments, change type hints

* pre-commit fix

* added more doctests
2021-10-21 11:38:04 +08:00
Immiel
2e2e1b656c
singly_linked_list: Added additional documentation, type hints and test cases (#4988)
This is a followup to https://github.com/TheAlgorithms/Python/pull/4973#issuecomment-933117382

As per given suggestion, I've added type hints to certain methods that don't have them.  I have also added documentation and example doctests as a usage example for (most of) those that don't have them.

I have also added another test case following the previous test case's format. I noticed that the existing test case from previous pull request might be redundant with the ones I've made, so I decided to create a specific situation where the linked list would have to keep different kinds of data types for each node, in `test_singly_linked_list_2` test function.

Some minor changes in strings has been done to keep things consistent with other parts of the document. If it is undesirable, please let me know.
2021-10-20 16:08:39 +08:00