-
-
Notifications
You must be signed in to change notification settings - Fork 47k
Numerous significant improvements Beta #12811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lighting9999
wants to merge
137
commits into
TheAlgorithms:master
Choose a base branch
from
lighting9999:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+898
−680
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your change:
butterfly_pattern.py
local_weighted_learning.py
shuffled_shift_cipher.py
(position - self.__shift_key) % -len(self.__key_list)
to(position - self.__shift_key) % key_len
__passcode_creator
return type from list to string__str__
method: Simplifiedreturn "".join(self.__passcode)
toreturn self.__passcode
temp_list.extend(i)
totemp_list.append(i)
key_len = len(self.__key_list)
in encrypt/decrypti
tochar
for readability''.join()
to convert list to stringpascal_triangle.py
List
→list
everywhereList[List[int]]
→list[list[int]]
typing
module importCallable
import source:typing
→collections.abc
collections.abc
beforetimeit
elif
→if
where possibleabove_to_left_elt
→above_left
above_to_right_elt
→above_right
sum_of_digits.py
minimum_spanning_tree_kruskal2.py
Generic
andTypeVar
imports since they're no longer needed[T]
T = TypeVar("T")
as it's now redundantlru_cache.py
TypeVar
definitions forT
andU
since they're no longer neededclass DoubleLinkedListNode(Generic[T, U])
→class DoubleLinkedListNode[T, U]
class DoubleLinkedList(Generic[T, U])
→class DoubleLinkedList[T, U]
class LRUCache(Generic[T, U])
→class LRUCache[T, U]
lfu_cache.py
DoubleLinkedListNode
,DoubleLinkedList
,andLFUCache
to use modern Python 3.12+ generic syntax.class ClassName(Generic[T, U])
with cleanerclass ClassName[T, U]
.stack_with_doubly_linked_list.py
Generic
import andTypeVar
declaration[T]
syntax instead of subclassingGeneric[T]
skew_heap.py
T
T
withAny
type throughout the implementationcomp
to constructorlambda a, b: a < b
for min-heap behaviorX | None
syntaxtest_digital_image_processing.py
array()
withnp.array()
: Due to removal offrom numpy import array
uint8
withnp.uint8
: Due to removal offrom numpy import uint8
minimum_spanning_tree_prims2.py
for
loop syntaxOptional[T]
toT | None
dict.fromkeys()
items()
matrix_class.py
__hash__
type conflict with base class@final
decorator to mark class as unhashable__hash__
assignmentadd_row()
methodadd_column()
method@final
decorator__future__
annotationsbinary_search_tree.py
diff_views_of_binary_tree.py
avl_tree.py
Fixed Problems
Fixed root turning red after deletion
tree.remove(30)
→ Ensures root remains blackRepaired miscalculation in leaf node handling
tree.black_height()
→ Now returns consistent valuesResolved indentation and syntax issues in property checks
check_color_properties()
→ Passes all syntax validationCorrected documentation examples
>>> tree.check_color_properties()
→ Returns True as documentedFixed method signatures and type annotations
def black_height() -> int | None:
→ Clear return typesNew Features
tree.floor(25)
→ Returns largest value ≤25tree.ceil(25)
→ Returns smallest value ≥25node.grandparent
→ Direct grandparent accessnode.sibling
→ Immediate sibling referencetest_insertion_speed()
→ 300,000 inserts in O(log n) timecheck_color_properties()
→ Full RB tree validationtree.verify()
→ Alias for comprehensive checktree.insert(1).insert(2).remove(1)
→ Single-line modificationslist(tree.preorder_traverse())
→ [root, left, right] sequencelist(tree.postorder_traverse())
→ [left, right, root] sequenceAuto-repairs left-left/right-right imbalances
tree.insert(10).insert(5).insert(1)
→ Auto-balancesHandles complex red-black-red cases
tree.remove(20)
→ Maintains color balanceIntegrated doctests → Self-validating documentation
>>> tree.get_min()
→ Auto-verifies during testsdef insert(label: int) -> RedBlackTree:
→ Clear signaturesExpanded suite → Rotation/deletion/query validation
test_floor_ceil()
→ Range query verificationProper None child treatment →
black_height()
accuracyAuto-blackens root post-deletion →
_remove_repair()
final stepConsistent path checking →
black_height()
recursiontree.check_coloring()
→ False on consecutive red nodesChecklist: