* updated code for find triplets with 0 sum
Signed-off-by: Skyad <777.sunnykumar@gmail.com>
* extra line added at the end of file
Signed-off-by: Sunny Kumar <sunny.kumar09@ad.infosys.com>
* extra line added at the end of file
Signed-off-by: Skyad <777.sunnykumar@gmail.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* file updated with comments
Signed-off-by: Skyad <777.sunnykumar@gmail.com>
* updated the comments as suggested by community
Signed-off-by: Sunny Kumar <sunny.kumar09@ad.infosys.com>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* file updated according to community comments
Signed-off-by: Skyad <777.sunnykumar@gmail.com>
* Update find_triplets_with_0_sum.py
---------
Signed-off-by: Skyad <777.sunnykumar@gmail.com>
Signed-off-by: Sunny Kumar <sunny.kumar09@ad.infosys.com>
Co-authored-by: Sunny Kumar <sunny.kumar09@ad.infosys.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>
* Added doctest to heap.py
* Added doctest to hash_map.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update hash_map.py
* Added doctest to hash_map.py
* Added doctest to hash_map.py
* Added doctest to detecting_english_programmatically.py
* Update detecting_english_programmatically.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* added serialize and desrialize bin tree
* format files
* added type hints
* added type hints
* Use dataclass .__eq__(), .__iter__(), and .__repr__()
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added doctest to heap.py
* Added doctest to hash_map.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update hash_map.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create monotonic_array.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update monotonic_array.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add new algorithm index_2d_array_in_1d
* Add doctest for iter function
* The power of dataclasses
* Update index_2d_array_in_1d.py
---------
Co-authored-by: Christian Clauss <cclauss@me.com>
* neha3423
* neha3423
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha323
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* neha3423
* neha3423
* neha3423
* neha3423
* Added test case for tuple
* Update kth_largest_element.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Improved Equilibrium Index of an Array.
This is the modifications made to the original code:
1. Create Doctest Instructions: Python "doctest" can be executed by running the following command: python -m doctest -v equilibrium_index.py.
2. Deleted Argument {size}: Deleted the `size` argument because `len(arr)} allows the array's length to be determined inside the function, simplifying and improving the readability of the function signature.
3. Used {enumerate}: To improve code readability and indicate that we're working with element-index pairs, we iterated through the array using both elements and their indices using the `enumerate` function.
4. Optimized the Loop: To prevent pointless additions, the loop was improved by initializing {left_sum} with the value of the first element (arr[0]). Furthermore, since the beginning and last items (0 and size - 1) cannot be equilibrium indices, there is no need to check them, saving further computations.
* [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>
* Add `Invert a Binary Tree` solution
* Add type
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `doctest`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `test` to `get_tree_inorder`
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add `test` changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix lint errors
* Fix precommit errors
* Update and rename invert_binary_tree.py to mirror_binary_tree.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added doctests to the swap_nodes file under linkedlist data structure
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Added doctests to the swap_nodes file under linkedlist data structure
* Update swap_nodes.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Create Sudoku_Solver
Each of the digits 1-9 must occur exactly once in each row.
Each of the digits 1-9 must occur exactly once in each column.
Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid.
The '.' character indicates empty cells.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Rename Sudoku_Solver to sudoku_solver.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update sudoku_solver.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>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Added an algorithm transfrom bst to greater sum tree
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update and rename transform_bst_sum_tree.py to is_sum_tree.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* earliest deadline first scheduling algo added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* earliest deadline first scheduling algo added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ceil and floor and bst
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ceil and floor and bst 2
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* ceil and floor and bst 3
* Update and rename floor_ceil_in_bst.py to floor_and_ceiling.py
* Delete scheduling/shortest_deadline_first.py
---------
Co-authored-by: ArunSiva <Arunsiva003@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>
* Added code to find diameter of given binary tree
* Modified diameter_of_binary_tree file
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update diameter_of_binary_tree.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update diameter_of_binary_tree.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Update basic_binary_tree.py
* Update basic_binary_tree.py
* [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>
* Create sparse_table.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Descriptive names for variables
* Fix ruff check error
* Update sparse_table.py
* Add comments, change variable names
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix typo
* Update sparse_table.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* added implementing stack using two queues
* Update Stack using two queues
* Update stack_using_two_queues.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update stack_using_two_queues.py
* Update stack_using_two_queues.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update stack_using_two_queues.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update stack_using_two_queues.py
* Update stack_using_two_queues.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* added power_of_4
* deleted power_of_4
* added pairs_with_given_sum
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* updated the comment
* updated return hint
* updated type hints
* updated the variable
* updated annotation
* updated code
* updated code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added the problem link and used defaultdict
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* corrected import formatting
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update pairs_with_given_sum.py
* Update data_structures/arrays/pairs_with_given_sum.py
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix bug and edit doctests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add type hints, raiseError and other minor adjustments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Cleaning code
* [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>
* Add doctests, exceptions, type hints and fix bug for infix_to_prefix_conversion.py
Add doctests
Add exceptions for expressions with invalid bracket positions
Add type hints for functions
Fix a bug on line 53 (57 in PR)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Change type hints in infix_to_prefix_conversion.py
* Remove printing trailing whitespace in the output table
* Fix type hint errors
* Fix doctests
* Adjust table convention in output and doctests
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add doctests for infix_2_postfix()
* Update print_width
* Update print_width
* Fix the doctests
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
* add doctest ut
* test complete
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* format
* ruff update
* cover line 154
* Update data_structures/linked_list/is_palindrome.py
Co-authored-by: Christian Clauss <cclauss@me.com>
* use dataclass
* pre-commit fix
* Fix mypy errors
* use future annotations
---------
Co-authored-by: Harsha Kottapalli <skottapalli@microsoft.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>
* equilibrium index in an array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* equilibrium index in an array
* equilibrium index in an array
* equilibrium index in an array removed type in docstring
---------
Co-authored-by: ArunSiva <Arunsiva003@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* symmectric tree
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* removed trailing spaces
* escape sequence fix
* added return type
* added class
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* wordings fix
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* added static method
* added type
* added static method
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* wordings fix
* testcase added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* testcase added for mirror function
* testcase added for mirror function
* made the requested changes
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* made the requested changes
* doc test added for symmetric, asymmetric
* Update symmetric_tree.py
---------
Co-authored-by: jeevaramanthan.m <jeevaramanathan.m@infosys.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>
* fix the edge case of the double ended queue pop the last element
* refactoring doc
---------
Co-authored-by: Jiang15 <weijiang@weijiangs-MacBook-Pro.local>
* add median of two sorted array
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix syntax
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix syntax
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* improve code
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* add documentation
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* update
* [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>
* infix to prefix missing feature added
* infix to prefix missing feature added
* infix to prefix missing feature added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* infix to prefix missing feature added (comments)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* infix to prefix missing feature added (comments)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* newly updated infix_to_prefix
* newly updated infix_to_prefix_2
* newly updated infix_to_prefix_3
* from the beginning
* Created flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py (space added)
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py space added
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Update flatten_binarytree_to_linkedlist.py
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* flatten binary tree to linked list - 1
* flatten binary tree to linked list final
* flatten binary tree to linked list final
* review updated
* Update flatten_binarytree_to_linkedlist.py
* Update .pre-commit-config.yaml
* Update flatten_binarytree_to_linkedlist.py
* Update flatten_binarytree_to_linkedlist.py
---------
Co-authored-by: ArunSiva <Arunsiva003@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>