1600. Order of succession to the throne - daily question
1, Title
in a kingdom lived the king, his children, his grandchildren and so on. At every point in time, someone in the family is born and someone dies.
this kingdom has a clearly defined order of succession to the throne, and the first heir is always the king himself. We define the recursive function success (x, curorder). Give ...
Added by joebarker99 on Fri, 28 Jan 2022 07:30:43 +0200
Data structure - [ advanced level of graph ]
catalogue
Directed graph
Directed graph API design
Realization of directed graph
Topological sorting
Topological sorting
Detecting rings in directed graphs
Vertex sorting based on depth first
Directed graph
Definition of directed graph and related termsDefinition: A directed graph is a directional graph, which is composed of a group o ...
Added by greencoin on Fri, 28 Jan 2022 03:51:52 +0200
[algorithm note] stack and queue
Basic knowledge
Stack
The stack provides interfaces such as push and pop, and all elements must comply with the first in and last out rule. Therefore, the stack does not provide access function or iterator. Stacks in STL are often not classified as containers, but as container adapter s.The bottom implementation of stack can be vector, deque ...
Added by stndrdsnz on Fri, 28 Jan 2022 00:47:34 +0200
Daily supplementary record II
2045. Second short time to destination
Cities are represented by a two-way connected graph, in which there are n nodes, numbered from 1 to n (including 1 and N). The edges in the figure are represented by a two-dimensional integer array edges, where each edge [i] = [ui, vi] represents a two-way connected edge between node ui and node VI. Each ...
Added by sbinkerd1 on Thu, 27 Jan 2022 19:51:01 +0200
Interval maintenance (block method + card constant)
Title Description:
Title portal
Problem solving ideas:
First, we ignore the title of the topic (tree array template), and let's try a new algorithm - blocking.
Block thought
Blocking is a beautiful violence (by DFT). His core idea is to maintain an interval (length:
n
...
Added by tsabar on Thu, 27 Jan 2022 12:41:35 +0200
Depth first entry? Let's look at the maze first
What is depth first
What is depth, that is, down, depth first, that is, down first, go to the end at one breath, go to the end, and go back when you find there is no way.In terms of algorithm implementation, depth first can be considered as a pronoun of recursion, and depth first search must use the idea of recursion.Some people may say that ...
Added by andy666 on Thu, 27 Jan 2022 11:45:53 +0200
Force deduction brush question notes
LeetCodeSelf use notesarray27. Remove elementsGive you an array num and a value val. you need to remove all elements with a value equal to Val in place and return the new length of the array after removal.Instead of using extra array space, you must use only O(1) extra space and modify the input array in place.The order of elements can be chang ...
Added by thereo on Thu, 27 Jan 2022 07:49:27 +0200
Detailed explanation of balance tree (fhq tree)
preface
You don't need to learn tree first!
introduce
Example:( Luogu P3369 [template] common balance tree)
You need to write a data structure to maintain some numbers, which needs to provide the following operations: 1. Insert
x
x
x number 2. De ...
Added by johnnyk on Thu, 27 Jan 2022 03:09:38 +0200
Data structure: JavaScript language description
list
When you don't need to find or sort elements in a long sequence.
Abstract data type definition of list
A list is an ordered set of data. (whether the data itself is in order or the index is in order) Each data item in the list is called an element. Any data type can be in the list. The number of elements in the list is limited by the pr ...
Added by stevenm187 on Thu, 27 Jan 2022 02:35:01 +0200
2022-1-26 traversal DFS BFS of data structure diagram
Traversal of Graphs
concept
Depth first traversal
The specific method of DFS (depth first search) algorithm is: go deep from a certain point. When you can't go down, go back to the previous step until you find the solution or finish all the points.
When implementing this sequential access order, the idea of operation action storage ...
Added by auddog on Wed, 26 Jan 2022 23:59:04 +0200