![](https://lstatic.shangxueba.com/jiandati/pc/images/pc_jdt_tittleico.png)
key university 意思为:
![](https://lstatic.shangxueba.com/jiandati/pc/images/jdt_panel_vip.png)
解决问题的一种方法是使用2-d树。2-d树类似于二叉搜索树,不同之处在于:
◇偶数层用keyl来比较:在该层上每一结点的keyl都大于共左子树中任一结点的key1,都不大于其右子树中任一结点的keyl。
◇奇数层用key2来比较:在该层上每一结点的key2都大于其左子树中任一结点的key2,都不大于其右子树中任一结点的key2.
◇树的根结点处于第0层。每次插入或搜索都从根结点出发,逐层比较。新结点应作为叶结点插入,
臂如,可以将不同人的姓和名(假设没有同名同姓者)分别为keyl和key2,建立一棵2-d树.作为例子,图7-27就是将清华大学的历任校长,按共任职年代的先后次序(周白齐、唐国安、周春、金邦正、曹云祥、严鹤龄、罗家伦、梅贻琦、叶企孙、蒋南翔、高景德、张孝文、王大中、顾秉林),顺序插人而形成的一棵2-d树。
(1)若命名树结点的类名为kdTNode,树的类名为kdTrce,关键码keyl的数据类型为T1,关键码key2的数据类型为T2,试写出2-d树的模板类结构定义,包括构造函数、复制构造函数、求树高、按给定值搜索、查找左子女、查找右子女、查找父结点、插人、删除等函数。此外,还要定义对树结点私有数据成员的存取函数(只要求写出函数的原型,不必给出代码实现)。
(2)基于上述定义,写出其中一个成员函数的实现代码:从根开始搜索关键码keyl和
key2与给定值vall和val2匹配的结点。函数的形式为:
若搜索成功,则函数返回true值,同时引用参数pt指向搜索到的结点,另引用参数pr指向结点*pt的父结点。此时,若树中只有一个结点,pr为NULL。
若搜索不成功或树为空,则函数返回false值,同时参数pt为NULL,在树非空时,pr则指向搜索失败前指针pt最后到达的结点;当树为空时,pr为NULL。
B.University of London
C.University of Edinburgh
D.University of Cambridge
B.To participate in a student exchange program
C.To attend a smaller university than the one he was at before
D.To benefit from Central University ’s international reputation.
Sig ns are another great way to inform. your community.Post them in places where people gather, such as stores and community centers.Some businesses have a central bulletin board (布告栏), which is the best place to advertise.Other places to post are at the loc al college or university campus.This is especially helpful if your sale is happening in August or early September when students have returned to school and are looking for cheap finds.
Post signs around your neighborhood.You should also place both ads a nd direction signs, especially if you're located on a side street without a major presence.Signs will attract and direct people.Just make sure you print in bold letters and use large direction signs so people can read the information from the front seat of their car.
1.The best way of getting out the news of your garage sale is to ().
A.publish the news online
B.visit people door-to-door
C.advertise in the local newspaper
D.make phone calls to your neighbors
2.You should place an ad at least two days before the sale so that people can ().
A.get enough cash for the sale
B.compare prices of the items
C.select the items they will buy
D.decide on their route in advance
3.Why should signs be po sted in a community center?()
A.Schools are nearby
B.There are many stores
C.Students often meet there
D.More people gather there
4.What advice is given for printing the signs according to the last paragraph?()
A.Colored signs are preferred
B.Bold letters should be used
C.Large pictures should be included
D.Phone numbers should be provided
5.The best title for the passage might be ().
A.Advertising Garage Sales
B.Advanta ges of Garage Sales
C.Importance of Garage Sales
D.Printing Ads for Garage Sales
B.To get information about hosting an exchange student.
C.To find out if there are any jobs available on Campus
D.To find out the hours of the computer lab
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!