Stack
What is a stack?
Stack is a kind of linear table.
It only allows the insertion and deletion of elements at the fixed end.
The one end for data insertion and deletion is called the top of the stack and the other end is called the bottom of the stack.
Therefore, the stack addition and deletion elements have what we often call last ...
Posted by beboo002 on Fri, 20 May 2022 00:43:56 +0300
CF 1405E Fixed Point Removal
Meaning:
Given the sequence \ (A \) with length \ (n \), the number of \ (A_i = i \) (i.e. the value is equal to its subscript) can be deleted in each operation, and then the remaining arrays are spliced together to ask how many can be deleted at most
\(q \) independent inquiries. Set the number of the first \ ...
Posted by bakigkgz on Thu, 19 May 2022 08:38:13 +0300
The first is matrix multiplication
#include<stdio.h>
#include<stdlib.h>
/**
*Dynamic two-dimensional array
*/
typedef struct TwoDArray{
int rows;
int columns;
int **elements;
} TwoDArray, *TwoDArrayPtr;
/**
*Static two-dimensional array
*/
typedef struct TwoDStaticArray{
int rows;
int columns;
int elements[4][5];
} ...
Posted by g00bster on Thu, 19 May 2022 00:09:30 +0300
1. The number of exchanges in each round of bubble sorting is equal to N - x, and X is the number of numbers that meet the following conditions: there is no larger number in front of this number We say that this number does not participate in the exchange in the current round of bubble sorting
2. The total number of rounds of bubble sort exc ...
Posted by moboter on Tue, 17 May 2022 23:30:21 +0300
foreword
I was asked this question in the interview, and the answer was terrible, so I record it here.
The answer at that time was to use the while loop to judge whether it is empty when reading. If so, sleep for a period of time, and then judge again. If it is not empty, read and return. When inserting, use the while loop to judge whether it ...
Digital problem
9. Number of palindromes
Algorithm idea: 1. First, judge whether x is a negative number. If it is a negative number, it directly returns false without conversion 2. Assign the palindrome number y according to the flashback until Y > = X. at this time, if x = = y | x = = Y / 10, it is the palindrome number, otherwise it ...
Posted by elwadhos on Tue, 17 May 2022 18:01:13 +0300
Reverse the order of strings, taking the string abcdef as an example
1. With additional arrays
#include <stdio.h>
#include <string.h>
int main() {
char str[] = "abcdef";
//Find the size of the string, including '\ 0'
int sz = strlen(str) + 1;
//Dynamic memory allocation, apply for a character array of sz size
...
Posted by zechdc on Tue, 17 May 2022 03:07:02 +0300
Red black tree
The concept of red black tree
Red black tree
, is a kind of
Binary search tree
, but
Add a storage bit on each node to represent the color of the node, which can be
Red
or
Black
. By limiting the coloring method of each node on any path from root to leaf, the red black tree ensures that no path will be two longer ...
Posted by Easter Bunny on Tue, 17 May 2022 02:24:17 +0300
What is joint search set
In computer science, the union query set is a tree data structure, which is used to deal with the merging and query of some Disjoint Sets. A union find algorithm defines two operations for this data structure:
Find: determines which subset the element belongs to. It can be used to determine whether two elements belong ...
Posted by Revan on Mon, 16 May 2022 04:03:36 +0300