Draw a program flow graph for the function below
int binsearch(int x,int v[],int n) { int low,high,mid; low=0; high=n-1; while(low<high) { mid = ( low + high ) / 2; if( x < v[mid]) high = mid - 1; else if ( x > v[mid]) low = mid + 1; else return mid; } return -1; }
The Program Flow Graph is provided below. In order to draw the Flow Graph the programming statements should be labelled as 1,2,3 etc. Please see the labelling of the statements and the Flow Graph below.
Get Answers For Free
Most questions answered within 1 hours.