Summary of "output binary tree by level" to "solving binary tree Depth"

Source: Internet
Author: User
Tags lenovo

This article is in the study summary, welcome reprint but please specify Source: http://write.blog.csdn.net/postedit/41964669


Recently in the Brush Lettcode algorithm problem, found a lot of problem solving ideas are generally consistent, and even there will be a solution to multiple problems, perhaps on the one hand the reason is that I brush are simple questions, on the other hand may be the site is intended to improve our confidence and Lenovo ability. For example, the problem of solving the maximum depth of the binary tree and solving the minimum depth of the binary tree, there are also the questions of judging whether the two trees are exactly the same and judging whether the two trees are symmetrical or not, and the problem of outputting each layer of elements from the root of the tree and the output of each layer from the bottom to the root.


Yesterday answered the hierarchy from the root of the output of each layer of elements of the topic, and today happened to encounter a similar three topics, not I deliberately take these several topics to speak, but I think the idea is interlinked between the algorithm, and is not isolated, from one algorithm can be transformed into another algorithm, may only need to add some simple conditions, So I think if we simply to do the problem, although we can improve their algorithm level, but can not extrapolate, if we do a problem can be more Lenovo, think about some other possible ways, over time, our ability to think and analyze problems will be improved. Take my own words, have never done any algorithmic problems, in addition to the school data structure class to learn some knowledge. Just start to do lettcode on the simple problem algorithm, feel very difficult, a question to want to half a day or even one, because before the algorithm related training, thinking process is not so flexible, but I insist on each of their own thinking, analysis of each problem, regardless of their algorithm write how Rotten, As long as it is right, it is not necessary for such a novice to start asking so high. After slowly insisting on brushing more than 20 simple questions, I found that my thinking is no longer so rigid, I will be through a problem linked to some other related questions. I think each algorithm question will certainly correspond to a certain problem, corresponding to an application scenario, or no one to ask questions, there is no need to solve it. I will continue to persist, from simple to difficult problems, from easy to hard, adhere to brush the existing 166 questions. This process may be the process of growth, do not need a perfect result, just insist on themselves, do what they want to do, and constantly improve themselves, from the simple beginning, starting from the foundation, slowly surpass themselves, improve themselves.


Share this short time in the brush problem of some experience:

(1) Don't be too ambitious. From the simple to start, or why the topic is divided into simple, medium, difficult, lofty high-rise from the ground up.

(2) Keep going. Every two days I will take time to do a problem, although the work is very busy, seize the dark time around, and soon you will find a different self.

(3) Independent thinking. Do not think for a moment on Baidu, oneself think out of forever also forget, try to think, improve their thinking ability.

(4) share. To write down their own ideas, to share, the knowledge of the share of the return is not a simple knowledge of the addition, but linear or even point of magnitude.


I hope to be of some help to you. Thank you.



Summary of "output binary tree by level" to "solving binary tree Depth"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.