505 Commits

Author SHA1 Message Date
Muhammad Junaid Khalid
0f832b1236
Merge branch 'TheAlgorithms:master' into master 2024-10-07 16:38:06 +05:00
1227haran
cfd6d095f1
Added max_sum_bst.py (#11832)
* Added new algorithm

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

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

* Updated changes

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

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

* Updated filename

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

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

* Updated code

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

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

* Updated the code

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

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

* Updated code

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

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

* Updated the code

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

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

* Updated code

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

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

* Updated the code

* Updated code

* Updated code

* Updated code

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

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

* Updated the code

* Updated code

* Updated code

* Updated code

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

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

* Updated code

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

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

* Updated code

* updated

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

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

* Updated code

* Updated code

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

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

* Updated code

* Updated code

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

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

* Updated code

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

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

* Updated code

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

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

* Apply suggestions from code review

* Update maximum_sum_bst.py

* def max_sum_bst(root: TreeNode | None) -> int:

* def solver(node: TreeNode | None) -> tuple[bool, int, int, int]:

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
2024-10-07 10:36:15 +02:00
Muhammad Junaid Khalid
6f061dab04
Merge branch 'TheAlgorithms:master' into master 2024-10-07 10:59:31 +05:00
1227haran
5a8655d306
Added new algorithm to generate numbers in lexicographical order (#11674)
* Added algorithm to generate numbers in lexicographical order

* Removed the test cases

* Updated camelcase to snakecase

* Added doctest

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

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

* Added descriptive name for n

* Reduced the number of letters

* Updated the return type

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

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

* Updated import statement

* Updated return type to Iterator[int]

* removed parentheses

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-05 10:19:58 -07:00
Muhammad Junaid Khalid
7d701cc066
Merge branch 'TheAlgorithms:master' into master 2024-10-03 11:19:02 +05:00
JeevaRamanathan
40f65e8150
Improve comments, docstrings in next_greatest_element.py (#11685)
* Improve comments in next_greatest_element.py

Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>

* few changes

Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>

* updated descriptions of the functions parameters

Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>

---------

Signed-off-by: JeevaRamanathan <jeevaramanathan.m@infosys.com>
2024-10-02 17:18:01 -07:00
1227haran
918fa8bb8a
Optimized O(n) to O(1) (#11669) 2024-10-02 11:07:07 -07:00
Hardik Pawar
00e9d86224
Improve comments, add doctests in symmetric_tree.py (#11619) 2024-10-01 19:54:12 -07:00
mjk22071998
9a73b0a78e "Fixed typo in class name and added quotes to __repr__ output" 2024-10-02 06:47:20 +05:00
mjk22071998
c290421ba8 Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-02 06:43:08 +05:00
mjk22071998
041da89cab "Rename variable 'nodeData' to 'node_data' in main function" 2024-10-02 06:43:03 +05:00
pre-commit-ci[bot]
7d414b4892 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-02 01:40:17 +00:00
mjk22071998
a3becf3100 Linted the code and doctests changed 2024-10-02 06:39:41 +05:00
pre-commit-ci[bot]
b7fef5c169 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 11:33:13 +00:00
mjk22071998
00086389ad "Updated whitespace and trailing spaces in SortedLinkedList class" 2024-10-01 16:32:38 +05:00
pre-commit-ci[bot]
94d30b9ff3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 11:20:56 +00:00
mjk22071998
c2c9a9e357 "Renamed numNodes to num_nodes and decremented num_nodes in delete function 2024-10-01 16:20:23 +05:00
mjk22071998
7cb36dd997 removed whitespace 2024-10-01 16:13:25 +05:00
mjk22071998
13ae9ce1c0 added newline at end of file 2024-10-01 16:12:00 +05:00
mjk22071998
2d61f2e5bb Fixed missing closing parenthesis in print statement. 2024-10-01 16:11:09 +05:00
mjk22071998
2f9dc7d5b7 "Fixed variable name in conditional statement and removed newline character from print statement." 2024-10-01 16:09:05 +05:00
mjk22071998
44ebb6632b Applied Non safety 2024-10-01 16:07:48 +05:00
mjk22071998
3c76fcef53 Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-01 16:00:06 +05:00
mjk22071998
26b7912d0e Remove unnecessary import and comments from sorted_linked_list.py 2024-10-01 16:00:02 +05:00
pre-commit-ci[bot]
2208f75424 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:59:36 +00:00
mjk22071998
9e92e1e825 removed empty line in the end 2024-10-01 15:58:49 +05:00
mjk22071998
5be1839fc7 "Added two blank lines to sorted_linked_list.py" 2024-10-01 15:58:28 +05:00
mjk22071998
ea5c1194bc Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-01 15:57:03 +05:00
mjk22071998
fa29e39c2a "Updated type hints for Optional[Node] to Node | None in SortedLinkedList class" 2024-10-01 15:56:54 +05:00
pre-commit-ci[bot]
6838bd89ea [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:55:23 +00:00
mjk22071998
15026d88f8 removed trailing whitespace and formatted import section 2024-10-01 15:54:37 +05:00
pre-commit-ci[bot]
5d98fd74dc [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:49:40 +00:00
mjk22071998
3ab0f7e585 Corrected doctests 2024-10-01 15:49:07 +05:00
mjk22071998
36480f4c27 Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-01 15:45:34 +05:00
mjk22071998
4cb8282bd1 "Added import statement for Optional type from typing module." 2024-10-01 15:45:29 +05:00
pre-commit-ci[bot]
0847316786 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:44:26 +00:00
mjk22071998
53bd3be495 Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-01 15:43:52 +05:00
mjk22071998
2389245669 "Added type hints for variables in SortedLinkedList class" 2024-10-01 15:41:31 +05:00
pre-commit-ci[bot]
99baa932fc [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:25:59 +00:00
mjk22071998
3d9263b279 fixed typo 2024-10-01 15:25:04 +05:00
mjk22071998
8334ee6032 Fixed typo in merge function 2024-10-01 15:24:11 +05:00
pre-commit-ci[bot]
57405add11 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 10:23:08 +00:00
mjk22071998
fdbea27d41 updated merge function 2024-10-01 15:22:35 +05:00
mjk22071998
d96cc64ce7 "Updated type hints for Node and SortedLinkedList attributes to include None option" 2024-10-01 14:45:49 +05:00
mjk22071998
13600242ca Updated doctests 2024-10-01 14:42:28 +05:00
mjk22071998
cb0c3a33b6 "Fixed typo in class name in docstrings" 2024-10-01 14:34:07 +05:00
mjk22071998
5535759e99 "Fixed typo in class name 'SortedLinedList' to 'SortedLinkedList' in doctests." 2024-10-01 14:17:10 +05:00
mjk22071998
47f5c05bc7 Merge branch 'master' of https://github.com/mjk22071998/Python 2024-10-01 14:12:22 +05:00
mjk22071998
807ceada2e "Removed type hints for None in Node and SortedLinkedList classes." 2024-10-01 14:12:15 +05:00
pre-commit-ci[bot]
2a10afe217 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-10-01 09:10:41 +00:00