描述 编写Search_Bin函数,实现在一个递增有序数组ST中采用折半查找法确定元素位置的算法. Input 第一行:元素个数n 第二行:依次输入n个元素的值(有序) 第三行:输入要查找的关键字key的值 Output 输出分两种情形: 1.如果key值存在,则输出其在表中的位置x(表位置从0开始),格式为The element position is x. 2.如果key值不存在输出:"The element is not exist." Sample Input 6 1 3 5 7 9
动态共享库中函数名: void Bubble_Sort(int a[],int len);/*冒泡排序*/ void Select_Sort(int a[], int len);/*选择排序*/ void Insertion_Sort(int a[], int len);/*插入排序*/ int Binary_Search(int a[], int start,int end, int key);/*折半查找*/ 用gcc与main函数 一起链接,即可调用库中函数!
Descr iption 编写Search_Bin函数,实现在一个递增有序数组ST中采用折半查找法确定元素位置的算法. 输入格式 第一行:元素个数n 第二行:依次输入n个元素的值(有序) 第三行:输入要查找的关键字key的值 输出格式 输出分两种情形: 1.如果key值存在,则输出其在表中的位置x(表位置从0开始),格式为The element position is x. 2.如果key值不存在输出:"The element is not exist."