1003 emergency (three solutions of Dijkstra, Bellman Ford and SPFA)

catalogue 1. Dijkstra solution 2. Bellman Ford solution 3. SPFA solution 4. Dijkstra solution AC code 5. Bellman Ford solution AC code 6. Non full score (19 / 25) code of SPFA solution 1. Dijkstra solution This problem involves not only the basic solution, but also the second standard (cumulative number of troops) and recording the numb ...

Posted by leeroy1 on Tue, 21 Dec 2021 11:15:58 +0100

Closed pair of points using divide and conquer algorithm

Basic learning notes of algorithm toolbox [excerpt from exercises in the fourth week] close pair of points using divide and conquer algorithm 1. Problem Statement 1.1. Task In this problem, your goal is to find the closest pair of points in a given point. This is a basic principle of computational geometry, which is applied in ...

Posted by eyeself on Tue, 21 Dec 2021 09:23:04 +0100

Data structure and algorithm -- sparse array

Data structure and algorithm -- sparse array (the learning content is the JAVA data structure and algorithm of Mr. Han Shunping of shangsilicon Valley) 1. What is a sparse array: When most elements in an array are 0 or an array with the same value, you can use a sparse array to save the array. 2. Processing method of sparse array: How many ro ...

Posted by generic88 on Tue, 21 Dec 2021 09:18:17 +0100

Basic algorithm of binary tree

Binary tree definition:Binary tree (English: binary tree) is a tree structure with at most two branches per node (i.e. there are no nodes with branching degree greater than 2). Branches are usually called "left subtree" or "right subtree". The branches of binary tree have left-right order and cannot be reversed at will. For ...

Posted by alext on Tue, 21 Dec 2021 07:18:10 +0100

Hard core dry goods! Java cultivation of Qi building foundation (continuously updated)

Because I'm still deeply impressed by the sky breaking of natural potatoes, So take the protagonist Xiao Yan for example. The stage of Qi training and foundation building is very important. Only when the foundation is firmly laid, can we cut through thorns and thorns all the way and fight higher and higher! Similarly, for fresh contact Jav ...

Posted by Dilb on Tue, 21 Dec 2021 02:00:06 +0100

Two single linked lists generate an additive linked list

[title] assuming that the value of each node is between 0 and 9, the whole linked list can represent an integer. For example, 9 - > 3 - > 7 can represent an integer 937. Given the header nodes head1 and head2 of the two linked lists, please generate a result representing the added value of the two integers [example] [note] first find th ...

Posted by vishal99 on Tue, 21 Dec 2021 00:55:38 +0100

Sliding window -- double pointer idea with the same direction

The general idea is as follows: Given a sequence, define two pointers left and right, and define the measurement index F before the interval [left,right], such as interval sum, product and others according to the meaning of the question. At the beginning, left=right=0, calculate the index F. left remains unchanged first, right moves to the rig ...

Posted by sidney on Mon, 20 Dec 2021 23:26:00 +0100

Software designer's improved pattern matching algorithm - KMP algorithm (examples, formulas, codes), a lot of content, you can bear it~~

First of all, let's take a look at the textbook (the textbook is very tall, it doesn't matter if you don't understand it, just continue to look down): Then the textbook gives an example: If you don't understand the above content, it's OK to look down from here~ In fact, this example can be understood sentence by sentence in combination with ...

Posted by oneski on Mon, 20 Dec 2021 21:01:22 +0100

Load balancing algorithm

Summarize the video of up main IT brother from b station summary Common load balancing algorithms include random, weighted random, polling, weighted polling, smooth weighted polling and consistent hash algorithm Server IP public class ServerIps { public static final List<String> LIST = Arrays.asList( "A", ...

Posted by hiberphoptik on Mon, 20 Dec 2021 18:39:50 +0100

iOS LeetCode ☞ maximum number of splices

Given two arrays of length m and N, their elements are composed of 0 - 9, representing the numbers on each bit of two natural numbers. Now select k (k < = m + n) numbers from the two arrays and splice them into a new number. The numbers taken from the same array are required to maintain their relative order in the original array. Find the m ...

Posted by immanuelx2 on Mon, 20 Dec 2021 17:33:42 +0100