一、 填空题(每小题2分,共80分) 1. A node in a tree that does not have any children is called (a) a leaf; (b) an internal node; (c) a root; (d) an empty node; 2. 对于一棵深度为2的二叉树,它的总节点数: (a) 至多7个 (b)至多2个 (c) 节点数不限 (d) 至多4个 3. 下面的伪码是对二叉树操作算法的片段: print( node ) { if( there is a left child ) print( left child ); print data; if( there is a right child ) print( right child ); } 这个算法是: (a)折半查找; (b)前序遍历; (c)中序遍历; (d)后序遍历; 4. 下面哪个序列不是折半查找(二分查找)所访问的数值序列 (a) 10, 20, 30, 40, 50; (b) 50, 40, 30, 20, 10; (c) 10, 20, 30, 15, 18; (d) 30, 50, 40, 45, 42 5. 递归函数可以调用自身多少次? (a) 只多1次; (b) 任意次数; (c) 0 次; (d) 至多2次; 6. 分析下面函数: int f( int n ) { if( n = = 0 ) return 0; if( (n & 1) = = 0 ) return f(n/2); return f(n/2) + 1; } 调用函数f(10)的返回值是: (a) 1; (b) 3; (c) 5; (d) 2; 7. 假如n,m>=0,那么下面函数的功能是: 8. 给定长 |
中科院早期试题
最新推荐文章于 2024-07-11 22:07:49 发布