Skip to content

[mypy] Fix type annotations in data_structures/binary_tree #5518

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@

## Electronics
* [Carrier Concentration](https://github.com/TheAlgorithms/Python/blob/master/electronics/carrier_concentration.py)
* [Coulombs Law](https://github.com/TheAlgorithms/Python/blob/master/electronics/coulombs_law.py)
* [Electric Power](https://github.com/TheAlgorithms/Python/blob/master/electronics/electric_power.py)
* [Ohms Law](https://github.com/TheAlgorithms/Python/blob/master/electronics/ohms_law.py)

Expand Down
2 changes: 1 addition & 1 deletion data_structures/binary_tree/binary_search_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def inorder(self, arr: list, node: Node):

def find_kth_smallest(self, k: int, node: Node) -> int:
"""Return the kth smallest element in a binary search tree"""
arr = []
arr: list = []
self.inorder(arr, node) # append all values to list using inorder traversal
return arr[k - 1]

Expand Down
4 changes: 3 additions & 1 deletion data_structures/binary_tree/merge_two_binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"""
from __future__ import annotations

from typing import Optional


class Node:
"""
Expand All @@ -19,7 +21,7 @@ def __init__(self, value: int = 0) -> None:
self.right: Node | None = None


def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Node:
def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Optional[Node]:
"""
Returns root node of the merged tree.

Expand Down