IOS design mode-combination design mode and ios Design Mode Combination
This blog article will show you the knowledge of "What is a tree structure", "What is a combination mode", and "what can be solved by a combination mode" in software development.
Content outline:
1. Tree Structure
2. Combination Mode
3. Write a folder System
1. Tree Structure (a great god or a good computer foundation can be skipped,Implementation with object-oriented codeIs worth reading)
Before introducing the composite design model, it is necessary to briefly talk about the tree structure. Baidu looks at the "Tree Structure" and you can easily find the basic concepts related to the tree structure:
The tree structure is a layered nested structure. The outer and inner layers of a tree structure have similar structures. Therefore, such structures can be recursively expressed.
The tree charts in the classic data structure are typical tree structures. A tree can be simply represented as a root, left subtree, and right subtree. The left and right subtree have their own subtree.
The tree structure is easy to understand, just like the inverted big tree. Then there is a root node. Through the root node, we can get the child nodes associated with the root node, through the subnode, we can get the subnode:
Back to the basic concept of "Tree Structure" copied from Baidu, it mentions that the tree structure has a hierarchical nested structure. Let's look at the figure below, because the tree structure is a hierarchical nested structure,
Therefore, from the perspective of the whole and part, the outer layer and the inner layer have similar structures, which can be expressed by recursive algorithms in the algorithm data structure,
Recursion is a process-oriented language statement, because the essence of recursion is also considered in the execution process of code logic.
In addition, it also adds a mathematical graphics theory: fragment. This is also the content of the fragment graph theory.