Skip to content

Conversation

@deepakmeenax
Copy link

No description provided.

@deepakmeenax
Copy link
Author

@CloudAEye analyze-tests

@cloudaeye-devprod
Copy link

Test Run Report

❌ test_binary_search

CloudAEye

Root Cause

The logs indicate that a RecursionError was raised due to exceeding the maximum recursion depth. The recent code changes modified the mid-point calculation in the 'binary_search_recur' function, changing it from 'mid = low + (high - low)//2' to 'mid = (low + (high-low))//2', which can lead to more recursive calls than necessary if the range is not halved properly.

Suggested Fix

To resolve the recursion error, revert the mid-point calculation to properly halve the search range, which prevents excessive recursive calls.

algorithms/search/binary_search.py

@@ -46,7 +46,7 @@
     if low > high:       
         return -1
     # Change the below to inject fault : mid = (low + (high-low))//2   #This mid will not break integer range
-    mid = (low + (high-low))//2   #This mid will not break integer range
+    mid = low + (high-low)//2   #This mid will not break integer range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants