数据结构(陈越)PAT练习题 第四周:树(下)

04-1. Root of AVL Tree

时间限制
100 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property. Figures 1-4 illustrate the rotation rules.

  
  

Now given a sequence of insertions, you are supposed to tell the root of the resulting AVL tree.

Input Specification:

Each input file contains one test case. For each case, the first line contains a positive integer N (<=20) which is the total number of keys to be inserted. Then N distinct integer keys are given in the next line. All the numbers in a line are separated by a space.

根据引用,数据结构PAT练习题中包含了关于的题目。其中有一道题目将二叉看作图,并对它作图的深度优先遍历,与原二叉的结果是相同的。答案选项包括前序遍历、中序遍历、后序遍历和层次序遍历。 根据引用和引用,数据结构PAT练习题还包含了测试各种排序算法的题目。这些题目旨在测试不同排序算法在不同数据情况下的表现。测试数据包括只有1个元素、11个不相同的整数、随机整数、顺序整数、逆序整数、基本有序的整数和随机正整数等。 综上所述,数据结构PAT练习题涉及到的遍历和排序算法的应用。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [数据结构习题-Dijkstra](https://download.youkuaiyun.com/download/li_guizhen/2853501)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [数据结构陈越PAT练习题 第七周:排序(上)](https://blog.youkuaiyun.com/ustcfdm/article/details/43671249)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值