PAT grade B exercise 1034 four operations of rational numbers

Title: Enter two fractional rational numbers in the form of A1 / B1 and A2 / B2 in one line, where the numerator and denominator are all integers within the integer range, the negative sign can only appear in front of the numerator, and the denominator is not 0. Output format: Output the sum, difference, product and quotient of two rational ...

Posted by stopblackholes on Tue, 07 Sep 2021 13:36:26 -0700

K-nearest neighbor algorithm for Python machine learning

KNN(K-Nearest Neighbors) generally refers to K-nearest neighbor algorithm, which is a common classification algorithm in machine learning The purpose of this paper is to quickly teach you an intuitive understanding of KNN algorithm. At the same time, in order to facilitate you to implement the algorithm, the model involved in this paper is deve ...

Posted by bob1660 on Tue, 07 Sep 2021 11:46:09 -0700

Data structure string

1. DS string application - KMP algorithm Title Description Learn KMP algorithm, give the main string and mode string, and find the position of mode string in the main string The algorithm framework is as follows for reference only input The first input t indicates that there are t instances The second line inputs the main string of t ...

Posted by 87dave87 on Tue, 07 Sep 2021 11:16:18 -0700

PAT class a graph theory

Test site 1. Various deformations of Dijkstra 2. Connectivity, judging the number of connected blocks 3. Hierarchical traversal 4. Ergodic properties of edges Foundation preparation - Dijkstra I #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int N = 510; int n, m; int g[N][N]; ...

Posted by shatner on Mon, 06 Sep 2021 12:33:50 -0700

[Questions] AcWing 1566. Graduate Enrollment

1566. Graduate Enrollment Theme transmission: AcWing 1566. Graduate Enrollment It is said that, 2011 2011 In 2011, Zhejiang Province has about 100 100 100 Graduate Hospitals Ready to ...

Posted by jamiet757 on Mon, 06 Sep 2021 09:33:18 -0700

Algorithm basis - merge sort and its application

I wrote a related article two years ago: Sorting algorithm - merge sorting The reason why we have another article today is that we have a deeper understanding of this algorithm. Algorithm analysis Here, we will paste the dynamic diagram of merge sorting algorithm again: [external chain picture transfer failed. The source station may have anti ...

Posted by jrschwartz on Sun, 05 Sep 2021 20:58:10 -0700

Fundamentals of algorithm – sorting out key points of quick sorting

Recently, I reviewed the sorting algorithm. Although I have studied it before, I forget it almost if I write it directly, even if I have written relevant before article , let's summarize the idea of quick sorting here. First, post the animation demonstration of quick row here: partition If you want to remember the implementation of fast ...

Posted by shergold on Sun, 05 Sep 2021 16:28:51 -0700

① , jQuery, massive algorithm, high-frequency interview question compilation and analysis

Create a new jquery.min.js file in vs (any name here, as long as it is a JS file) Import in html file <script src = "jquery.min.js"></script> 1.2. jQuery entry function 🔥 // The first method is recommended $(function(){ ... // This is the entrance to the completion of page DOM loading }) // The second ...

Posted by bryan52803 on Sun, 05 Sep 2021 13:06:53 -0700

Matlab multi population genetic algorithm

Matlab multi population genetic algorithm get ready Before writing your own code, you should understand the basic structure of the algorithm. For details, please refer to my previous articles outline Or here Simple function optimization Or more advanced nonlinear programming problem and TSP problem Although the article is simple, it can ...

Posted by Matth_S on Sun, 05 Sep 2021 12:39:05 -0700

Hungarian algorithm to find the maximum match

Problem background Given a connection graph corresponding to x and y, it is required that each xi and yi can only be matched once at most, and the maximum matching times can be calculated Solution idea  ( 1) Convert the connection of x and y into a matrix, which can be connected to each other, marked as 1, and the rest as 0 y1y2y3y4y ...

Posted by aosmith on Sun, 05 Sep 2021 11:51:41 -0700