九度 二叉排序树
来源:互联网 发布:电脑分区数据恢复 编辑:程序博客网 时间:2024/05/17 04:19
题目链接 : 点击打开链接
答案:
#include <bits/stdc++.h>
#define MAX 100<<2+10
int bt[MAX];
int Insert_Tree(int pos,int v){
if (bt[pos] == 0){
bt[pos] = v;
if (pos != 1)
return bt[pos/2];
else
return -1;
}else{
if (v>bt[pos]){
Insert_Tree(pos*2+1 , v);
}else{
Insert_Tree(pos*2 , v);
}
}
}
int main(){
int n ;
while (~scanf("%d",&n)){
memset(bt,0,sizeof(bt));
for(int i = 1 ; i <= n ; i++){
int a ;
scanf("%d",&a);
printf("%d\n",Insert_Tree(1,a));
}
}
return 0;
}
1 0
- 九度 二叉排序树
- 九度OJ_1201:二叉排序树
- 九度oj 1201:二叉排序树
- 九度OJ 1201 二叉排序树
- 九度题目1201:二叉排序树
- 九度题目1201:二叉排序树
- 九度题目1201:二叉排序树
- 题目1201:二叉排序树 -九度
- 九度OJ 1467 二叉排序树
- 九度OJ-1201-二叉排序树
- 九度OJ 1467 二叉排序树
- 九度oj-1467-二叉排序树
- 九度OJ - 1201 - 二叉排序树
- 九度OJ - 1467 - 二叉排序树
- 【九度】题目1201:二叉排序树
- 九度OJ-1201-二叉排序树
- 九度 题目1467:二叉排序树
- 九度OJ 1201 二叉排序树
- R4 欧氏空间Schmidt正交化方法
- python的内建函数(BIF)range(start, stop, step)
- 【开源项目】编程博客Android客户端——CodeBlog
- Reaml起始篇
- jsp 实现文本文件上传
- 九度 二叉排序树
- 客户端存储
- Android应用程序架构
- Linux树状结构文件详解
- leetcode Permutations II
- atoi 和itoa用法
- js day43 Jquery入门(回顾js,Jquery选择器,dom操作)
- 堆排序的代码实现与思考
- griadview刷新