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
1, Mybatis cache
Like most ORM tier frameworks, Mybatis naturally provides support for L1 and L2 caching. The following is the role and definition of L1 cache and L2 cache.
1. The first level cache is the sqlSession level cache. When operating the database, you need to construct sqlSession object, in which there is a (memory area) data st ...
Posted by ladokha on Sun, 15 May 2022 22:48:08 +0300
Concept of string
String: a finite sequence of zero or more characters, also known as a string
Some strings
Empty string( null string),It is zero in length and can be directly represented by two pairs of quotation marks ""
The so-called sequence shows that the adjacent characters of the string have the relationship between ...
Posted by AcousticJames on Sun, 15 May 2022 11:32:02 +0300