mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-24 02:23:10 +08:00
feat: Reworked/updated sorting/selection_sort.cpp. (#1613)
* Reworked selection_sort.cpp with fixes. * Added Recursive implementation for tree traversing * Fix #2 * Delete recursive_tree_traversals.cpp * Update selection_sort.cpp * Changes done in selection_sort_iterative.cpp * updating DIRECTORY.md * clang-format and clang-tidy fixes for4681e4f7* Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update selection_sort_iterative.cpp * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update sorting/selection_sort_iterative.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes forca2a7c64* Finished changes requested by ayaankhan98. * Reworked on changes. * clang-format and clang-tidy fixes forf79b79b7* Corrected errors. * Fix #2 * Fix #3 * Major Fix #3 * clang-format and clang-tidy fixes for79341db8* clang-format and clang-tidy fixes for9bdf2ce4* Update selection_sort_iterative.cpp * clang-format and clang-tidy fixes for9833d7a7* clang-format and clang-tidy fixes forb7726460Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
This commit is contained in:
@@ -144,7 +144,7 @@ void update(std::vector<int64_t> *segtree, std::vector<int64_t> *lazy,
|
||||
* @returns void
|
||||
*/
|
||||
static void test() {
|
||||
int64_t max = static_cast<int64_t>(2 * pow(2, ceil(log2(7))) - 1);
|
||||
auto max = static_cast<int64_t>(2 * pow(2, ceil(log2(7))) - 1);
|
||||
assert(max == 15);
|
||||
|
||||
std::vector<int64_t> arr{1, 2, 3, 4, 5, 6, 7}, lazy(max), segtree(max);
|
||||
@@ -172,7 +172,7 @@ int main() {
|
||||
uint64_t n = 0;
|
||||
std::cin >> n;
|
||||
|
||||
uint64_t max = static_cast<uint64_t>(2 * pow(2, ceil(log2(n))) - 1);
|
||||
auto max = static_cast<uint64_t>(2 * pow(2, ceil(log2(n))) - 1);
|
||||
std::vector<int64_t> arr(n), lazy(max), segtree(max);
|
||||
|
||||
int choice = 0;
|
||||
|
||||
Reference in New Issue
Block a user