摘要: #ifndef ST_CLASS#define ST_CLASS#include <iostream>using namespace std;class ST{ public: ST(int maxN) { head=0;} int search(int v) { return searchR(head, v); } int insert(int x) { insertR(head, x); } void show() ... 阅读全文
posted @ 2012-11-13 11:08 wouldguan 阅读(301) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>//not find will return -1//find will return the indexint searchR(int a[], int l, int r, int key){ if(l>r) return -1; int m=(l+r)/2; if(a[m] == key) return m; if(l==r) return -1; if(key < a[m]) return searchR(a, l, m-1, key); else return searchR(a, m+... 阅读全文
posted @ 2012-11-13 10:21 wouldguan 阅读(166) 评论(0) 推荐(0) 编辑