/* Recursive and non-Recursive Algorithms for Binary Search */# include <iostream> # include <cstdio> using namespace STD; bool bisrch (INT low, int high, int V, int * Text) // recursive statement {int I, mid; Mid = (low + high)/2; If (low> high) return false; if (V = text [Mid]) return true; else if (v <text [Mid]) return bisrch (low, mid-1, V, text ); else return bisrch (Mid + 1, high, V, text);} bool bisrch (INT low, int high, int V, int * text) // non-recursive writing {int I, mid; while (low <= High) {mid = (low + high)/2; If (Text [Mid] = V) return true; else if (v <text [Mid]) high = mid-1; else low = Mid + 1;} return false;} int main () {int text [10]; int I; for (I = 0; I <10; I ++) Text [I] = I; cout <"recursive Syntax:" <Endl; for (I = 0; I <20; I ++) {If (bisrch (0, 9, I, text) cout <"found! "<Endl; else cout <" not found! "<Endl ;}cout <" non-recursive Syntax: "<Endl; for (I = 0; I <20; I ++) {If (bisrut, i, text) cout <"found! "<Endl; else cout <" not found! "<Endl;} return 0 ;}