Help me to make flowchart for my python code.
Help me to make flowchart for my python code.
##############################
import random
def binary_search(arr, low, high, m):
----if high >= low:
--------mid = (high + low) // 2
--------if arr[mid] == m:
------------return mid
--------elif arr[mid] > m:
------------return binary_search(arr, low, mid - 1, m)
--------else:
------------return binary_search(arr, mid + 1, high, m)
----else:
--------return -1
L = []
a = random.randint(5,10)
b = random.randint(5,10)
for i in range (0,a):
----L.append('D')
for i in range(0,b):
----L.append('R')
output = binary_search(L,0,len(L)-1,'R')
if output != -1:
----print("index of the first visitor", str(output))
else:
----print("index of the others visitor")
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images