Hash table and hash bucket of data structure (including code implementation)
catalogue
1. Basic concept of Hassi Watch
Bihasi function
2.1 direct setting method
2.2 division and remainder method
2.3 several less commonly used methods
III. Hassi conflict
Four open address method
4.1 linear detection
4.2 secondary detection
Five zipper method
1. Basic concept of Hassi Watch
Hash table (Hash tabl ...
Posted by jh21236 on Mon, 07 Mar 2022 06:05:50 +0100
Linked list classic problem
Reverse linked list
There are two methods to reverse the linked list: iterative method and recursive method.
Iterative method
There are two ideas. One is to move the next node of the head node to the first one at a time until the head node becomes the last one; The second is to move the first node to the back of the tail node in turn until t ...
Posted by Chas267 on Sun, 06 Mar 2022 16:21:09 +0100
Simple implementation of vector in C + +
vector
Vectors are sequence containers that represent arrays that can be resized.
Like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to their elements and are as efficient as arrays. But unlike arrays, their size can change dynamically, ...
Posted by neville on Sun, 06 Mar 2022 16:00:57 +0100
Learning algorithm idea I
Bank robbery days – 2100 – medium
This problem uses the idea of prefix and
For convenience, let nn be the length of securitysecurity.
According to the definition of "days suitable for bank robbery" in the question, first of all, we can determine that the answer falls within the range of [time, n - time)[time,n − t ...
Posted by scheols on Sun, 06 Mar 2022 15:29:05 +0100
Bubble algorithm of C language, sorting data and library function, use and Simulation of qsort function
Bubble algorithm of C language, sorting data and library function, use and Simulation of qsort function Bubble algorithm for data sorting
Article catalogue
Bubble algorithm sorting integer arrayThe use of c language library function qsortAnalog implementation of qsort function
1, Bubble algorithm sorting integer data
1. ...
Posted by joe_C_nice on Sun, 06 Mar 2022 12:56:28 +0100
Summary of double finger needling -- Taking LeetCode 27, 977, 15 and 18 as examples
The initial brush force deduction starts from the foundation, and the double pointer method is widely used in basic problems.
LeetCode 27, 977, 15 and 18 are the problems I have done in recent days, which can be well solved by double pointer method:
27:
It is equivalent to dividing the array into two parts: the first part is the valid p ...
Posted by reinmedia on Sat, 05 Mar 2022 13:45:24 +0100
Time complexity of algorithm
The time of the algorithm is complex
1. Time complexity
[] the concept of time complexity[~] time complexity rule (representation of big O)[~] common time complex calculations
(1) The concept of time complexity: The time complexity of the algorithm is a function, which describes the operation time of the algorithm. The time spent by an algor ...
Posted by ggkfc on Sat, 05 Mar 2022 12:51:38 +0100
Talk about C language bit field / bit segment
catalogue
1. Concepts and definitions
2. Examples
When doing embedded development, we often encounter such code:
struct
{
unsigned int widthValidated : 1;
unsigned int heightValidated : 1;
} status;
What does it mean to define structure variables in this way?
The main reason is that when some information is stored, it only needs to o ...
Posted by drummerboy on Sat, 05 Mar 2022 12:21:25 +0100
LeetCode -- string (python language)
LeetCode -- string (python language)
1, String
1.1 string definition
A string is a concatenation of a series of characters. The string can be traversed, and each traversal is a character.
1.2 string matching
First, we call the string to be matched (long) as the main string, and the string to be matched (short) as the sub string (pattern st ...
Posted by deadimp on Sat, 05 Mar 2022 11:50:54 +0100
LeetCode problem brushing -- dynamic programming (python language)
LeetCode problem brushing -- dynamic programming (python language)
1, Dynamic programming
1.1 basic concepts
Dynamic programming algorithms are usually used to solve problems with some optimal properties. In such problems, there may be many feasible solutions. Each solution corresponds to a value. We want to find the solution with the optima ...
Posted by Thomisback on Sat, 05 Mar 2022 11:46:18 +0100