Data structure day 8 - two dimensional array and matrix multiplication, and transpose of compressed matrix

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

Data Structure Chapter 6 Graph Study Notes

content 1. Figure 6.1 Definition of graph 6.2 Basic terminology of graphs 6.3 Graph storage structure 6.3.1 Lead matrix 6.3.2 Adjacency List 6.4 Traversal of graphs 6.4.1 Depth-First Search (DFS) 6.4.2 Breadth-First Search (BFS) 6.5 Applications of graphs 6.5.1 Minimum Spanning Tree 6.5.2 Shortest path 6.5.3 Topolog ...

Posted by Ramtree on Wed, 18 May 2022 01:04:31 +0300

P6186 bubble sort (tree array + thinking)

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

Interview question: How to design a blocking queue?

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 ...

Posted by Jude on Tue, 17 May 2022 18:42:01 +0300

Data structure and program design of leetcode in the direction of postgraduate entrance examination (miscellaneous articles such as number and stack, including train of thought solutions)

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

String reverse order - multiple methods

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

Detailed explanation of red and black trees

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

Summary of UnionFind skills

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

Redis implements the secondary cache of Mybatis

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

Data structure - < naive matching algorithm and optimized KMP matching algorithm >

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