文件名称:java_code
- 所属分类:
- JSP源码/Java
- 资源属性:
- [Java] [源码]
- 上传时间:
- 2017-11-01
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- 苏***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
构造数组的最大MaxTree
时间复杂度O(N) 额外空间复杂度O(N)(* establish the tree with the following principles:
* 1. the father of each number is the first larger number on its left and the smaller one on its right, the first one larger than it
* 2. if a number is infinite on the left, it's not on the right. That is to say, this number is the maximum in the entire number
* * /
How / / as soon as possible to find out each one on both sides of the first larger number? Using stack
Find / left, from left to right through each number, keep the descending order of the stack, the new data kept by the pop from the top of the stack, the stack until the new number or number ratio
Find / right, from right to left traverse each number, keep the descending order of the stack, the new data kept by the pop from the top of the stack, the stack until the new number or number ratio)
时间复杂度O(N) 额外空间复杂度O(N)(* establish the tree with the following principles:
* 1. the father of each number is the first larger number on its left and the smaller one on its right, the first one larger than it
* 2. if a number is infinite on the left, it's not on the right. That is to say, this number is the maximum in the entire number
* * /
How / / as soon as possible to find out each one on both sides of the first larger number? Using stack
Find / left, from left to right through each number, keep the descending order of the stack, the new data kept by the pop from the top of the stack, the stack until the new number or number ratio
Find / right, from right to left traverse each number, keep the descending order of the stack, the new data kept by the pop from the top of the stack, the stack until the new number or number ratio)
相关搜索: 构建数组的最大MaxTree
(系统自动生成,下载前可以参看下载内容)
下载文件列表
java_code
java_code\MaxTree.java
java_code\MaxTree.java