折半查找與猜數字遊戲

1.折半查找spa #include<stdio.h> int main() { int arr[] = {1,2,3,4,5,6,7,8,9,10}; int key = 7; int left = 0; int right = sizeof(arr)/sizeof(arr[0])-1; while(left<=right) { int mid = left+(right-left)/2; if
相關文章
相關標籤/搜索