Storage structure and basic algorithm design of sparse matrix triplet

Experimental content 1. Assuming that the sparse matrix A of n*n is represented by a triple, a program ex6-1.cpp is designed to achieve the following functions: (1) the triples a and b of the following two sparse matrices are generated. { 1 0 3 0 {3 0 0 0 0 1 0 0 0 4 0 0 0 0 1 0 ...

Added by cutups on Fri, 01 Nov 2019 01:21:08 +0200

[PostgreSQL] prefix fuzzy query level optimization

Pre match blur Using B-Tree to speed up matching fuzzy query before optimization Tectonic data Create a new product table and insert 10 million pieces of data. create table goods(id int, name varchar); insert into goods select generate_series(1,10000000),md5(random()::varchar); Query the product name of "123%" when the index is not ...

Added by DaPrince on Thu, 31 Oct 2019 22:46:18 +0200

Data structure -- decomposing a single chain table with a leading node into two single chain tables

1. Problem description The design algorithm decomposes the single chain table L1 of a leading node into two chain tables L2 and L3 with the same structure, in which the node of L2 table is the node whose median value is less than zero in L1 table, and the node of L3 table is the node whose median value is greater than ...

Added by etones on Thu, 31 Oct 2019 22:15:46 +0200

Algorithm note 4.5.2 bisection extension: maximum radius of circumscribed circle of convex polygon

Algorithm note 4.5.2 bisection extension: maximum radius of circumscribed circle of convex polygon Finding the maximum radius of circumscribed circle by dichotomy Title Description Train of thought: The code is as follows Finding the maximum radius of circumscribed circle by dichotomy ...

Added by rajivgonsalves on Thu, 31 Oct 2019 09:58:13 +0200

Redis optimizes high and fast performance

Content of this article Using Redis to optimize interface performance in high concurrency scenarios Database optimistic lock With the approaching of the double 11, all kinds of promotional activities began to become popular, and the mainstream ones are seckill, coupons, and so on. The main scenarios involving high concurrency competing for th ...

Added by nOw on Tue, 29 Oct 2019 12:06:26 +0200

JAVA makes wheels - generate distributed global unique ID

Note: the content of this code comes from Internet reprint and arrangement. SnowFlake algorithm is an open-source distributed id generation algorithm of Twitter. 1. twitter's SnowFlake generation ID can be generated in order according to time 2. The result of id generated by SnowFlake algorithm is a 64 bit integer. 3. Duplicate IDS will not b ...

Added by msarefin on Tue, 29 Oct 2019 04:57:07 +0200

Problem solving [BZOJ1922] continental hegemony

Problem surface analysis First, according to Kruskal algorithm, We can know, When an edge with a weight of \ (w \) is added, All edges with weights less than \ (w \) have been added to the tree (except for the linked ones). Therefore, we can save the connected block of each edge's endpoint before joining the spanning tree. Sort the sides of the ...

Added by sn0n on Mon, 28 Oct 2019 16:46:15 +0200

Non recursive merge sort

Non recursive merge sort Diagram Explain Code Diagram Explain Algorithms are recursive. Here is a simple non recursive implementation. That is, 2, 2 merge and sort, and then 4, 4 merge and sort until it is finished. Do not group recursively. Note that some code implementations on the Inter ...

Added by digitallookout on Mon, 28 Oct 2019 16:10:50 +0200

RabbitMQ introduction series 4 -- message confirmation mechanism

1 problem introduction When using RabbitMQ, we may encounter such a problem that the producer does not know whether the message has arrived at the server after sending the message, which is a mystery to the producer. By default, the producer does not receive any response. So if we want to know where t ...

Added by gin on Mon, 28 Oct 2019 05:20:21 +0200

Detailed explanation of Volley source code

I. overview Volley is a lightweight Android asynchronous network request framework and image loading framework launched by Google. Released at Google I/O 2013. Its applicable scenario is the network operation with small amount of data and frequent communication. Main features: (1) strong expansibi ...

Added by jonabomer on Sun, 27 Oct 2019 13:27:00 +0200