期末考复习
Question 12
In the context of the declarations that have been provided, write a function
int sum_tree(tree_t *t);
that applies another function
int get_int(data_t *d)
to each data item stored in the tree, and calculates and returns the sum of the integer values generated by the calls to get_int()
, added up over all of the data_t
elements stored in the tree. If t
is empty then sum_tree(t)
should return zero. You do not need to write get_int()
, and may call it without knowing anything about its operation.
Include a comment prior to each main block of code to indicate your intentions.
Be sure to select "Preformatted" for the LMS text box before you enter each answer, and (if necessary) again after you have typed your answer. You will need to use spaces for indentation, as tabs cannot be typed into the LMS text box.
malloc tree struct typedef
公众号:AI悦创【二维码】
AI悦创·编程一对一
AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh
C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh
方法一:QQ
方法二:微信:Jiabcdefh
- 0
- 0
- 0
- 0
- 0
- 0