[template] zhinai sauce's static array maintenance problem polynomial (multiple difference array - polynomial processing)

subject Original question link Problem description thinking The advantage of differential array is that it can move the whole body by pulling one hair. By processing one position, the values of subsequent positions can be changed. The operation we are facing at this time is to process the interval, and the processing is not simply ad ...

Posted by Ruiser on Fri, 25 Feb 2022 09:12:05 +0100

Daily practice LeetCode: M1706 Where does the ball fall

Write in front Today, I found a very interesting little girl named "BugNotFoundException", which is very interesting. Bug s are an indispensable part of a programmer's life. They spend quite a long time with you, and even you have to lose your hair v_v Looking at the data, college students have done so many questions. How did I find ...

Posted by yashvant on Fri, 25 Feb 2022 08:40:38 +0100

LeeCode 190. Reverse binary

190. Reverse binary Simple difficulty Inverts the binary bits of a given 32-bit unsigned integer. Tips: Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be specified as signed integer types and should not affect your implementation, because the internal binary representat ...

Posted by networkguy on Fri, 25 Feb 2022 08:38:30 +0100

Algorithm problem push domino simulation, queue and black magic

Push domino simulation, queue and dark magic subject Arrange n dominoes in a row and erect each dominoes vertically. At the beginning, push some dominoes to the left or right at the same time. Every second, the dominoes that fall to the left push the adjacent dominoes to the left. Similarly, a domino upside down to the right will push th ...

Posted by DavidT on Fri, 25 Feb 2022 05:43:40 +0100

The classical "poor cow" problem is described in C language

The classical "poor cow" problem is described in C language subject Problem description Farmer John has n (n ≤ 10000) cows. However, because they produced too little milk, the farmer was very dissatisfied with them and decided to make the least milk into beef jerky every day. But still a little reluctant, John plans to be mercif ...

Posted by broann on Fri, 25 Feb 2022 02:36:48 +0100

[sort] select sort and insert sort

Sorting algorithm related interface Sorting focuses on array elements (random access is supported). Each element has a key value. The key value can be arranged (i.e. sorted) in some way. A sorting algorithm needs to implement the following interfaces: class SortFunc { public: void sort(Comparables a); private: bool less(const Co ...

Posted by napier_matt on Thu, 24 Feb 2022 17:49:36 +0100

[sword finger Offer 54. The k-th node of binary search tree]

Title Description: Source: LeetCode Link: https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof Given a binary search tree, please find the value of the k-largest node. Example: Example 1: input: root = [3,1,4,null,2], k = 1 3 / \ 1 4 \ 2 output: 4 Example 2: input: root = [5,3,6,2,4,null, ...

Posted by straycat on Thu, 24 Feb 2022 16:41:52 +0100

[learning record of the third week of February] data structure and algorithm Wang Zhuo - Chapter 2 linear table - single linked table (function definition)

catalogue 1. Storage structure and definition of single linked list storage structure Function definition Example: Student transcript 2. Function definition 2.1 initialization function 2.2 empty judgment function 2.3 destruction function 2.4 emptying function 2.5 finding table length function 2.6 search function by location 2.7} fi ...

Posted by dvwhi on Thu, 24 Feb 2022 14:31:42 +0100

Leetcode notes -- Introduction to greedy algorithm

Catalogue of series articles I Array type problem solving method 1: dichotomy II Array type problem solving method 2: Double finger needle method III Array type problem solving method 3: sliding window IV Array type problem solving method 4: simulation V The basic operation and classic topics of the linked list Vi Classic title of hash tab ...

Posted by hopelessX on Thu, 24 Feb 2022 13:02:34 +0100

faiss dense vector retrieval framework

faiss is a framework that provides efficient similarity search and clustering for dense vectors. The following is the demo provided on the official website # 1. First, build training data and test data import numpy as np d = 64 # dimension nb = 100000 # database size nq = 10000 # nb of queries np.random.seed(1024) # make reproduciable xb ...

Posted by mvleus on Thu, 24 Feb 2022 07:16:21 +0100