A brief talk on irrotational Treap (based on the balanced tree of literature and art of Luogu P3391)

Let's talk about it. It's really shallow. It's completely based on the following inscription ↓ Luogu P3391 Look at the questions myself. I'm too lazy to stick... analysis In fact, there is nothing to analyze. This is a template problem of Splay tree, which solves the interval maintenance problem that can not be solved by general Treap. ...

Posted by springo on Sun, 22 May 2022 00:51:18 +0300

Simulated annealing algorithm (code)

In practical daily life, people often encounter the following problems: in a given domainInside, find the functionCorresponding optimal value. Here, the minimum value problem is taken as an example (the maximum value problem can be equivalent to the minimum value problem), which is formalized as: IfIf it is a discrete finite value, the optim ...

Posted by mdaoust on Sat, 21 May 2022 21:37:49 +0300

Check if a point is inside a polygon

How to tell if a point is inside a polygon? (1) Area sum discrimination method: determine whether the area sum of the triangle formed by the target point and each side of the polygon is equal to the polygon, and if it is equal, it is inside the polygon. (2) Angle sum discrimination method: judge whether the sum of the angle between the target p ...

Posted by franko75 on Sat, 21 May 2022 21:28:54 +0300

JAVA data structure and algorithm -- single chain surface test questions (Sina, Baidu, Tencent)

Common interview questions of single linked list Find the number of effective nodes in the single linked list Find the penultimate node in the single lin k ed list (Sina) Reversal of single linked list (Tencent) Print the single linked list from end to end (Baidu requires mode 1: reverse traversal. Mode 2: stack stack) Example 1: find the ...

Posted by lin on Sat, 21 May 2022 17:37:32 +0300

Big data Hadoop learning -- page ranking PageRank algorithm

1, Algorithm description PageRank is web page ranking, also known as page ranking (SOCIAL). Some basic concepts: 1. Web page entering the chain: that is, voting. Hyperlinks to other web pages in the web page are used as other web pages entering the chain, which is equivalent to voting for other web pages; 2. Number of links: if a web page ob ...

Posted by mblack0508 on Sat, 21 May 2022 16:13:37 +0300

[Blue Bridge Cup] 2017 Preliminary Round Jumping Grasshopper

Topic description As shown: There are 9 plates arranged in a circle. Eight of the plates contained eight grasshoppers, and one was empty. We number these grasshoppers clockwise from 1 to 8. Each grasshopper can jump into an adjacent empty plate, or with a little more force, jump over an adjacent grasshopper into an empty plate. Please calculat ...

Posted by geon on Sat, 21 May 2022 05:47:10 +0300

Digital statistics DP (338. Counting problem)

Digital statistics DP (338. Counting problem) Given two integers ∼ a ∼ and ∼ b, find the number of occurrences of 0 ∼ 9 in all numbers between ∼ a ∼ and ∼ b. For example, if a=1024 and b=1032, the total number of , 9 , between , a , and , b , is as follows: 1024 1025 1026 1027 1028 1029 1030 1031 1032 Among ...

Posted by artisticre on Fri, 20 May 2022 22:49:00 +0300

"May Training" on the 20th day - binary search tree

foreword This is the 20th day of the May training camp. Today's training content is binary search tree. Problem solving report 1. Force buckle 700 Original title link 700. Searching in Binary Search Trees Topic overview Given a binary search tree (BST) root node root and an integer value val. You need to find the node whose node val ...

Posted by Duncan85 on Fri, 20 May 2022 22:40:36 +0300

Find -- collision pointer

Find – collision pointer Give an integer array nums and return the index values I and j of the two numbers in the array, so that nums[i] + nums[j] is equal to a given target value, and the two indexes cannot be equal. For example: num = [2,7,11,15], target = 9 Return [0,1] Idea: Whether the start array is in order; Is the index calculate ...

Posted by steven21 on Fri, 20 May 2022 16:49:37 +0300

ACwing 257 - detaining criminals (dichotomous answer + dichotomous coloring)

There are two prisons in S City, holding a total of N criminals, numbered 1~N respectively. Naturally, the relationship between them is also extremely disharmonious. Many criminals have even accumulated grievances for a long time. If the objective conditions are met, conflicts may break out at any time. We use "resentment value" (a po ...

Posted by hame22 on Fri, 20 May 2022 15:31:44 +0300