1. Typographical Error in Doxygen Comment
In the Doxygen comment at the beginning of the file, "Merege Sort" should be corrected to "Merge Sort".
2. Merging Logic
In the merge function, the merging logic can lead to out-of-bounds access if both sub-arrays have been completely traversed. The condition in the while loop should ensure that you only access elements of L and R if they are within bounds:
3. Memory Management
Using new and delete[] for the temporary arrays (L and R) is fine, but you can also use std::vector from the C++ Standard Library to simplify memory management:
4. Input Validation
You should consider adding input validation when reading the number of elements and the actual elements to avoid undefined behavior.
5. Main Function Improvements
You can also enhance the main function by encapsulating the input logic in a separate function, improving readability.
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update fibonacci_fast.cpp
Modify the fibonacci_fast.cpp to fit the project style requirements.
* Update fibonacci_fast.cpp to meet the revision suggestions.
* Update fibonacci_fast.cpp to try to pass some CI test
* Update fibonacci_fast.cpp
* Update fibonacci_fast.cpp to meet the coding style requirements
* Update fibonacci_fast.cpp
* Update fibonacci_fast.cpp
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* ci: make compile add warnings to file
* chore: use cpp-linter instead of inhouse linter
* chore: use abinoda instead of pullreminders for label-when-approved
* fix: permissions awesome-ci
* fix: permission issue for github action
* ci: make compile add warnings to file
* chore: use cpp-linter instead of inhouse linter
* chore: use abinoda instead of pullreminders for label-when-approved
* fix: permissions awesome-ci
* ci: make compile add warnings to file
* chore: use cpp-linter instead of inhouse linter
* chore: use abinoda instead of pullreminders for label-when-approved
* Create non_preemptive_sjf_scheduling.cpp
* Update non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* added a vector to store and print the final result
* Update non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Create non_preemptive_sjf_scheduling.cpp
I have done the necessary changes.
The test function will generate 10 different testcases in which it will print the before and after the SJF scheduling.
@realstealthninja Kindly review the PR and please accept it.
* Delete non_preemptive_sjf_scheduling.cpp
* Update cpu_scheduling_algorithms/non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update non_preemptive_sjf_scheduling.cpp
* Update non_preemptive_sjf_scheduling.cpp
* Update cpu_scheduling_algorithms/non_preemptive_sjf_scheduling.cpp
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Update non_preemptive_sjf_scheduling.cpp
* Update non_preemptive_sjf_scheduling.cpp
* clang-format and clang-tidy fixes for 57e670c2
* chore: remove spaces
* Update dynamic_programming/unbounded_0_1_knapsack.cpp
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* chore: add cache and build comment to git ignore
* fix: add cmakelists to dynamic programming
* fix: add cmakelists to greedy_algorithms
* fix: add cmakelists to operations_on_datastructures
* fix: add cmakelists to range_queries
* fix: add `dynamic_programmin`, `greedy_algorithms`, `range_queries` and `operations_on_datastructures` subdirectories to cmakelists.txt
* fix: init of transform_reduce in dynamic_programming
* fix: add an include for functional in catalan_numbers
* chore: bump CXX standard to 20
* revert: bump CXX standard to 20
* chore: bump c++ version to 17 and add justification
Arm supports c++ 17
Esp32 supports c++ 23
decision was made to be 17 because it seemed to offer the best combatability
* fix: compilation error in catalan numbers
* fix: add <set> header to longest increasing subsequence nlogn
* fix: add cmath & algorithm header to mo.cpp
* fix: remove register key word from fast integer
* fix: replace using namespace std with std::cin and std::cout
* docs: typo in c++17
* fix: memory leak in bellman_ford
* fix: typo in bellman_ford
* fix: typo in word_break
* fix: dynamic array in coin_change
* fix dynamic array in egg_dropping puzzle
* chore: remove unnecessary comment
* fix: add vla to be an error
* chore: add extra warnings
* fix: use add_compile options instead of set()
* fix: compile options are not strings
* fix: vla in floyd_warshall
* fix: vla in egg_dropping_puzzel
* fix: vla in coin_change
* fix: vla in edit_distance
* fix: vla in floyd_warshall
* feat: remove kadane and replace it with kadane2
* fix: vla in longest_common_subsequence
* fix: int overflow in floyd_warshall
* fix: vla in lisnlogn
* fix: use const vector& instead of array
* fix: use dynamic array instead of vla in knapsack
* fix: use of and in msvc is unsupported by default adding permissive flag fixes it
* test: make executables the tests themselves
* Revert "test: make executables the tests themselves"
This reverts commit 7a16c31c4e.
* fix: make dist constant in print
* fix: namespace issue in unbounded_0_1
* fix: include cstdint to fix compilation
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Longest Increasing subsequence using binary search most optimal approach for this problem (Modified)
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Longest Increasing subsequence using binary search most optimal approach for this problem(done)
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Floyd warshall
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Longest Increasing subsequence using binary search most optimal approach for this problem
* Longest Increasing subsequence using binary search most optimal approach for this problem
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* Create Longest_Substring_Without_Repeating_Characters.cpp
* I would like to contribute for sliding window algorithm and this one is one of the famous problem that is asked in interviews.
* Thank you!!.
* Update and rename Longest_Substring_Without_Repeating_Characters.cpp to sliding-window/Longest_Substring_Without_Repeating_Characters.cpp
* This is my contribution towards the sliding window algorithm/s and this is one of the famous problems.
* Thank you.
* Update Longest_Substring_Without_Repeating_Characters.cpp
* I would like to contribute towards the sliding window algorithm in which this is one of the famous problem asked in interviews.
* Thank you.
* Update Longest_Substring_Without_Repeating_Characters.cpp
* Updated certain changes in documentation, this is my contribution towards sliding window algorithm this is one of the famous interview problem.
* Thank you.
* Update Longest_Substring_Without_Repeating_Characters.cpp
* Well documented and tested code for sliding window algorithm.
* Thank you.
* Update and rename Longest_Substring_Without_Repeating_Characters.cpp to Longest_Substring_Without_Repeating_Characters.cpp
* So,I did a small change I added the problem into the others section I think this works fine I guess.
* I would be glad if this can be tagged as hackoctoberfest
* Thank you.
* Update and rename Longest_Substring_Without_Repeating_Characters.cpp to longest_substring_without_repeating_characters.cpp
* I hope I have done the required changes.
* Update longest_substring_without_repeating_characters.cpp
* Added specific edge cases and tests as void tests() and followed the guidelines.
* Update longest_substring_without_repeating_characters.cpp
* I hope I have made the necessary changes required.
* If there are any changes to make I can do that.
* Thank you.
* Update longest_substring_without_repeating_characters.cpp
* I have done the required changes for the include part.
* Thank you.
* Update longest_substring_without_repeating_characters.cpp
added author name
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* added recursive insertion sort algorithm
* Modified the main function and removed user interaction as requested
* Deleted previous file
* Updated insertion_sort.cpp to its original code
* Created insertion_sort_recursive.cpp file
* Updated documentation and structure in insertion_sort_recursive.cpp
* Updated documentation in insertion_sort_recursive.cpp
* chore: remove redundant comment
* chore:Removed unnecssary whitespace
* doc: ease the brief of test
* doc: remove redundant lines from main
* chore:Removed redundant whitespace
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
* feat: add lfu cache
* docs: add comments and explanation to class LFUCache
* test: add tests for class lfu cache
* docs: document namespace and classes
* test: modify tests to check negative numbers
* docs: document template params and class data members
* test: make test func static and move tests in the same func
---------
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>