Decoration pattern & prototype pattern of design pattern

1, Decoration mode: 1. Basic theory: Decoration pattern: dynamically add some additional responsibilities to an object. In terms of adding functions, decoration pattern is more flexible than generating subclasses Decoration mode summary: A way to dynamically add more functions to existing functions. When the system needs new functionality, ...

Added by tyler on Sat, 01 Jan 2022 15:34:51 +0200

Basic explanation of topology sorting

Topology sort (TopSort) August 5, 2021 1. Algorithm principle 1.1 one question In daily life, some of our actions need to be in order. For example, you need to wear socks before shoes, pick up your watch before wearing it. The order cannot be changed. Similarly, in a project, the work of each step needs to be in order, and the completi ...

Added by jcoones on Sat, 01 Jan 2022 13:17:32 +0200

105 construct binary tree from preorder and inorder traversal sequences & & 106 construct binary tree from inorder and postorder traversal sequences (recursion + hash)

introduction These two questions are mainly to investigate the mastery of binary tree traversal, that is, the original binary tree is derived from the front order and middle order, and the original binary tree is derived from the back order and middle order. Let's talk about the derivation process first; Preorder and middle order Know the preo ...

Added by iarp on Sat, 01 Jan 2022 04:29:54 +0200

Business practice training of design mode

Business practice training of design mode This paper summarizes how to combine the business and implement it in the whole business project by putting the commonly used design patterns into practice. Some come from real business scenarios, some from large factories, and some from classic cases in the open source framework. It's just fo ...

Added by mojodojo on Sat, 01 Jan 2022 01:45:39 +0200

Agent model of structured model

summary For some reason, an object needs to be provided with a proxy to control access to the object. At this time, the access object is not suitable or can not directly reference the target object. The proxy object acts as an intermediary between the access object and the target object. Agents in Java can be divided into static agents and dy ...

Added by tariel on Sat, 01 Jan 2022 01:37:10 +0200

Computer experiment of data structure (Chapter II) IV

Computer experiment of data structure (Chapter II) III 12. In an incrementally ordered linear table, there are elements with the same value. If the storage method is a single linked list, remove the elements with the same value so that there are no duplicate elements in the table. void DeleteEle(LinkList &L) { LNode* p = L->next, *q; ...

Added by Beatnik on Sat, 01 Jan 2022 00:54:08 +0200

Data structure and algorithm

1. * * * the sum of the two numbers is the specified value Given an integer array, can you find two numbers so that their sum is a specified value? Example: if the input array is {1, 5, 7, 3} and the specified value is 10, we can find two numbers 3 and 7, and the sum is equal to 10. # The function call format is as follows # -*- coding: UTF ...

Added by notsleepy on Fri, 31 Dec 2021 09:55:38 +0200

A quick look at the categories of machine learning (Python code)

Serial article: Last Vernacular machine learning concepts 1, Machine learning category Machine learning can be divided into supervised learning, unsupervised learning, semi supervised learning and reinforcement learning according to the difference of learning data experience, that is, the difference of label information of training data. 1.1 ...

Added by ToonMariner on Fri, 31 Dec 2021 05:52:18 +0200

Data structure -- LeetCode special exercise Day3

350. Intersection of two arrays II Given two arrays, write a function to calculate their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [4,9]   explain: The number of occurrences of each element in the output result shall be consistent with the m ...

Added by LoStEdeN on Fri, 31 Dec 2021 03:22:10 +0200

LeetCode algorithm problem collection - linked list

Linked list basic algorithm problem Definition of linked list (java) //Definition of single linked list public class ListNode{ int val; ListNode next; //Point to next node ListNode(){}; //Nonparametric structure ListNode(int val){ this.val=val; } ListNode(int val,ListNode next){ this.val=val; this.next=next; } } 1. Remove linked list e ...

Added by UQKdk on Fri, 31 Dec 2021 02:53:26 +0200