YBTOJ: job evaluation (block)

analysis Think first O ( n m ) O(nm) How to do O(nm). Sweep from left to right, and keep the current value and x ...

Posted by TowerOfPower on Thu, 24 Feb 2022 05:37:27 +0100

CSP2020-J-T3-expression

See you on the topic [CSP-J2020] expression - LuoguKnowledge point analysis: Be able to parse the specified data in the string. This topic requires to parse numbers and logical operators from the string. For ex amp le, x123 only resolves 123 and records it as the 123rd variable. For the convenience of storage, you can save &, |,! Save as a ...

Posted by Calamity-Clare on Thu, 24 Feb 2022 01:49:56 +0100

Leetcode brush questions 05 tree

character string Basic knowledge Definitions and related concepts 1. Linked list and diagram Single linked list: one data field + one pointer field Tree: one data field + multiple pointer fields Figure: vertex set + edge Tree: acyclic connected graph is a special kind of graph. 2. Definition of tree A tree is a finite set of N (N &gt ...

Posted by rosegarden on Wed, 23 Feb 2022 12:59:08 +0100

[data structure] detailed explanation of hash table

1. Concept introduction In order structure and balance tree, there is no corresponding relationship between element key and its storage location. Therefore, when looking for an element, it must be compared many times by key. It depends on the complexity of the search tree (n), that is, the search efficiency is the balance of the search tre ...

Posted by gabriel kent on Wed, 23 Feb 2022 12:29:46 +0100

Plist in Linux -- a two-way linked list with descending priority

plist https://elixir.bootlin.com/linux/v4.9.59/source/include/linux/plist.h#L212 *Descending priority sorted double linked list plist is a list of nodes sorted by priority; The priority of each node is from INT_MIN to INT_MAX (minimum). The time complexity of inserting is O(k), the time complexity of deleting is O(1), and the time complexit ...

Posted by Daggeth on Wed, 23 Feb 2022 10:21:51 +0100

Basic operation of linear table

After learning the data structure roughly, I didn't understand the logic at all. Later, I understood the importance of learning the data structure and planned to use a large period of free time to pick up the learning of the data structure again. I'm still standing at the door of the IT industry. I'm going to climb in step by step and kneel to ...

Posted by jmgarde on Wed, 23 Feb 2022 07:35:36 +0100

PTA -- the team's "food chain" -- the second algorithm exercise of DS&A course practice

1, Title 2, Topic analysis The data structure of the graph needs to be used, and it is a directed graph. It is simpler to use the adjacency table. The adjacency table can be implemented by itself or by STL map+vector. I prefer to use the vector array, which is simple and convenient, but the graph in the question may have repeated direct ...

Posted by lightpace on Wed, 23 Feb 2022 04:33:57 +0100

[algorithm] recursion, search and sorting

1. Recursion Find duplicate Find a way to divideFind recursive formula or equivalent transformation Find change The variable is usually used as a parameter Find boundary Simple basic questions (practice three steps) Find the factorial of n public class demo01 { public static void main(String[] args) { int a = f1(4); System.o ...

Posted by gareh on Tue, 22 Feb 2022 17:43:36 +0100

Binary tree and its traversal method + code

1. Tree structure and basic concepts 1.1 tree structure concept Tree is a nonlinear data structure. It is a set with hierarchical relationship composed of n (n > = 0) finite nodes. It is called a tree because it looks like an upside down tree, that is, it has its roots up and its leaves down. Characteristics of tree structure Subtree ...

Posted by exoduses on Tue, 22 Feb 2022 12:27:22 +0100

[binary tree] Morris traversal -- an traversal method without auxiliary space

preface Traversal of binary tree is an unavoidable problem to solve the related problems of binary tree. Many problems are solved on the basis of traversal. According to different problems, we can use different traversal methods. According to the order of operations on the root node, it can be divided into: Preorder traversal Middle order tra ...

Posted by md7dani on Tue, 22 Feb 2022 09:55:53 +0100