int Search_Bin(SSTable ST, KeyType key) { int low=1; int high=ST.length; while(low<=high) { int mid=(low+high)/2; if(key==ST.elem[mid].key) return mid; else if(key<ST.elem[mid].key) high=mid-1; else low=mid+1; } return 0; }用中文画出代码程序框图
时间: 2024-02-14 20:16:20 浏览: 76
好的,以下是该程序的程序框图:
```
+-------------------------------------------+
| |
| Search_Bin函数 |
| |
+-------------------------------------------+
|
| 接收SSTable ST和KeyType key
|
V
+-------------------------------------------+
| |
| 初始化处理框(low=1) |
| |
+-------------------------------------------+
|
V
+-------------------------------------------+
| |
| while循环处理框(low<=high) |
| |
+-------------------------------------------+
|
| 每轮循环执行以下处理框:
|
V
+-------------------------------------------+
| |
| 比较处理框(mid=(low+high)/2) |
| |
+-------------------------------------------+
|
V
+-------------------------------------------+
| |
| 如果key等于ST.elem[mid].key |
| 返回mid |
| |
+-------------------------------------------+
|
| 否则,执行以下处理框之一:
|
V
+-------------------------------------------+
| |
| 如果key小于ST.elem[mid].key,则更新high=mid-1|
| |
+-------------------------------------------+
|
V
+-------------------------------------------+
| |
| 如果key大于ST.elem[mid].key,则更新low=mid+1 |
| |
+-------------------------------------------+
|
V
+-------------------------------------------+
| |
| 更新处理框(low或high的值已改变) |
| |
+-------------------------------------------+
|
V
+-------------------------------------------+
| |
| 返回处理框(return 0) |
| |
+-------------------------------------------+
```
阅读全文