Page 76 - PYTHON-12
P. 76

print ('Number Found at %d location'% (i+1))


                           break

                   if fl==0 :

                        print ('Number Not Found')


               #-------------------------------------------------------------------------------------------------------------------------
               ----------------

               def binary_search():


                   x=int(input('Enter the Number you want to search : '))

                   fl=0

                   low=0


                   heigh=len(arr)

                   while low<=heigh :

                       mid=int((low+heigh)/2)


                       if arr[mid]==x :

                           fl=1

                           print ('Number Found at %d location'% (mid+1))


                           break

                       elif arr[mid]>x :

                           low=mid+1


                       else :

                           heigh=mid-1




                   if fl==0 :

                       print ('Number Not Found')


               #-------------------------------------------------------------------------------------------------------------------------
               ----------------

               def min_number():
   71   72   73   74   75   76   77   78   79   80   81