摘要:
int n; array<int, 100>sav; //后序遍历 :左 右 根 // void f(int m) { if ( m > n ) return; f(2 * m);//先读入左节点 f((2 * m + 1));//读入右节点 cin >>sav[m];//读入根节点 } int m 阅读全文
摘要:
核心:完全二叉树第i个节点的左节点,对应的下标一定是2*i,右节点一定是2*i+1。 用num表示这个节点应该有的下标(虽然不用数组储存,以1开始),如果以构建完全二叉树的方式去构建树。若建树过程中,num大于节点数n,则不是完全二叉搜索树,否则是; 搜索树的构建: int n; int cnt = 阅读全文
摘要:
#include <iostream> using namespace std; struct waimai { char a[100]; int weight; int hao; int price; }en[150]; int i; int main() { bool pan(waimai a, 阅读全文
摘要:
C 和 C++ 中的 void 指针之间的区别? 看以下例子; voidp; chars; p=s; s=p; //this is wrong ,should do s=(char*)p; 即是 s=p; //this is wrong ,should do s=(char*)p; 在 C++ 中, 阅读全文