Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

NAME:

REG NO:
BRANCH: BIOTECHNOLOGY

HOME ASSIGNMENT - 5

PROBLEM-1:
PROBLEM-2:

PROBLEM 3:
PROBLEM 4:

Algorithm- main

Step 1: start

Step 2: read mid, low, high, search,n

Step 3: GET n, search

Step 4: assign low=0, high=n-1, mid=(low+high)/2

Step 5: call ‘binary_search(mid,low,high,search)

Step 6: stop

Algorithm for binary_search module

Step 1: start

Step 2: if (low<=high) is false, goto step 8

Step 3: if (mid==search) is false, goto step 4

Step 3.1: put ‘search is found’


Step 4: if(mid<search) is false, goto step 5

Step 4.1: low=mid+1

Step 5: if(mid>search)

Step 5.1: high=mid-1

Step 6: mid=(low+high)/2

Step 7: goto Step 3

Step 8: PUT ‘number is not found’

Step 9: stop

You might also like