Tree arrays are data structures that solve dynamic prefixes and problems. Larks always associate ST tables, tree arrays, and segment trees, which are all methods to solve dynamic interval problems.
A tree array is a second-order prefix and array of two. Like a tree, as shown in the diagram, the prefix and length of each location I are lowbit ...
Posted by cityguru on Wed, 17 Aug 2022 22:30:29 +0300
Sequential implementation of queues
typedef struct{
int data[MaxSize];
int front,rear;
} SqQueue;
For the initialization of the sequence queue, front points to the queue head element, and rear points to the next position of the queue tail element, that is, the next position that should be inserted.
void Init(SqQueue q){
q.front=0 ...
Posted by natbrazil on Fri, 01 Jul 2022 21:46:43 +0300
Spoiler: ArrayList's insertion and query operations are much faster than LinkedList
ArrayList
characteristic
The bottom layer is realized by array, with fast query speed and slow addition, deletion and modification speed (in theory)
Thread unsafe
Common methods of ArrayList
import java.util.ArrayList;
import java.util.Iterator;
import jav ...
Posted by cyrixware on Wed, 25 May 2022 15:49:26 +0300
In this article, I try to use popular words to describe the difference between the two zval. The summary is at the end.
Official start
Structure of zval:
type
value
refcount: this parameter is used several times (including references). The garbage collection mechanism also judges this value, int
is_ref: whether it is referenced, true|false
...
Posted by exploo on Wed, 25 May 2022 11:04:37 +0300
Establishment and traversal of binary tree (1) Establishment of binary tree Establish a binary tree by traversing in the first order and in the second order: In the pre order traversal sequence of binary tree, the first element is always the value of the root node of the tree. In the middle order traversal sequence, the value of the node of the ...
Posted by Brandon_R on Wed, 25 May 2022 06:18:05 +0300
sParentOf(...)
isParentOf(child: Cell | null): boolean
Returns whether the current node is the parent node of the specified Cell.
parameter
nametypeMandatory Default valuedescribechildCell | null✓
isChildOf(...)
isChildOf(parent: Cell | null): boolean
Returns whether the current node / edge is a child node / edge of the specified node.
p ...
Posted by 2tonejoe on Wed, 25 May 2022 05:35:03 +0300
When we search for an integer among n dynamic integers, there are several methods
① Using dynamic arrays, the average time complexity is O(n)
② Using an ordered dynamic array and binary search method, although its worst time complexity is only O(logn), its average time complexity of addition and depth is too high, which is O(n).
③ Using a link ...
Posted by nonexist on Wed, 25 May 2022 04:01:05 +0300
Linked List: Singly Linked List
1. Introduction to linked list
A linked list is an ordered list, but it is stored in memory as follows:
The summary is as above:
1) The linked list is stored in the form of nodes, which is chain storage
2) Each node contains data field, next field: points to the next node
3) As shown in the figure: It is found t ...
Posted by Mr Camouflage on Wed, 25 May 2022 02:04:36 +0300
The first question of LeetCode brushing questions, the use of the sum of two numbers and the hash table
Topic description
Given an integer array nums and a target value target, please find the two integers in the array whose sum is the target value, and return their array indices.
You can assume that there will only be one answer for each input ...
Posted by 8ta8ta on Tue, 24 May 2022 17:54:50 +0300
Leetcode79 medium\color{#FF4500}{medium}medium
Click to enter the original question link: Word Search
Related topics: word search II word search II
[tag] backtracking search, C++ ASCII
subject
Discription
Given a 2D board and a word, find if the word exists in the grid.
The word can be constructed from letters of sequentially adjacent cell ...
Posted by snaack on Tue, 24 May 2022 01:57:25 +0300