Title: fix(QuickSort): use low instead of hardcoded 0 in left recursive call by omprashantjain · Pull Request #2 · Complete-Coding/DSA_using_Java · GitHub
Open Graph Title: fix(QuickSort): use low instead of hardcoded 0 in left recursive call by omprashantjain · Pull Request #2 · Complete-Coding/DSA_using_Java
X Title: fix(QuickSort): use low instead of hardcoded 0 in left recursive call by omprashantjain · Pull Request #2 · Complete-Coding/DSA_using_Java
Description: Fixes #1 The left recursive call in quickSort used a hardcoded 0 as the lower bound instead of low: quickSort(nums, 0, partitionIndex - 1); // before quickSort(nums, low, partitionIndex - 1); // after Every left-partition call re-sorted the array from index 0 rather than from the start of the current sub-problem. The output stayed correct (the [0, low-1] prefix is already in place), but recursion work blew up to O(n²). On a descending array of 2000 elements the buggy version makes 1,001,001 quickSort invocations vs 3,999 after the fix — which is what can drive the reported StackOverflowError on large inputs. Validated by compiling and running the sort on several arrays (including descending and a 2000-element descending case); all sort correctly, and recursion depth is back to expected. Thanks to @UsaaryanByte07 for the clear report and root-cause trace.
Open Graph Description: Fixes #1 The left recursive call in quickSort used a hardcoded 0 as the lower bound instead of low: quickSort(nums, 0, partitionIndex - 1); // before quickSort(nums, low, partitionIndex - 1); // ...
X Description: Fixes #1 The left recursive call in quickSort used a hardcoded 0 as the lower bound instead of low: quickSort(nums, 0, partitionIndex - 1); // before quickSort(nums, low, partitionIndex - 1); // ...
Opengraph URL: https://github.com/Complete-Coding/DSA_using_Java/pull/2
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4dc3464c-fac5-5d22-7dd6-0a672de538a6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ADAA:39E9A3:3F2F50:594212:6A59DC14 |
| html-safe-nonce | 5fbb746458dc1ec06c8d23211ceb003eda981b4577c6a3ab40005379e2ff1f25 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREFBOjM5RTlBMzozRjJGNTA6NTk0MjEyOjZBNTlEQzE0IiwidmlzaXRvcl9pZCI6IjgyMjE3NTA4NTAyMDY5NDgzNzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 01cebdc51919c7e589ca9845a903a7635135160c23b3132731514f09decfaf0c |
| hovercard-subject-tag | pull_request:3907245312 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/Complete-Coding/DSA_using_Java/pull/2/files |
| twitter:image | https://avatars.githubusercontent.com/u/102736197?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/102736197?s=400&v=4 |
| og:image:alt | Fixes #1 The left recursive call in quickSort used a hardcoded 0 as the lower bound instead of low: quickSort(nums, 0, partitionIndex - 1); // before quickSort(nums, low, partitionIndex - 1); // ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/Complete-Coding/DSA_using_Java git https://github.com/Complete-Coding/DSA_using_Java.git |
| octolytics-dimension-user_id | 147902612 |
| octolytics-dimension-user_login | Complete-Coding |
| octolytics-dimension-repository_id | 488878540 |
| octolytics-dimension-repository_nwo | Complete-Coding/DSA_using_Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 488878540 |
| octolytics-dimension-repository_network_root_nwo | Complete-Coding/DSA_using_Java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26f17126414f953984d8ae42f57c0db48e7dbde3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width