Follow left theological algorithm
Only as personal study notes, don't spray!
1. Given an array and a reference value, it is required that less than the reference value is on the left of the array, equal to the reference value is in the middle, and greater than the reference value is on the right
public static int[] hierarchy(int[] nums,int equivalent){
/* 1.If the curr ...
Posted by xadmin on Wed, 19 Jan 2022 04:56:05 +0100
KNN algorithm (with iris classification Implementation)
1.k-nearest neighbor algorithm
K-Nearest Neighbor learning (KNN) learning is a commonly used supervised learning method. Its working mechanism is very simple: given a test sample, find the K samples closest to it in the training set based on a certain distance measurement, and then predict through the k neighbor samples. If there are many n ...
Posted by nick2005 on Wed, 19 Jan 2022 04:19:54 +0100
Sword finger offer38: arrangement of strings
First, let's look back:
The code is as follows:
class Solution {
public:
vector<string> permutation(string s) {
vector<string> ans;
string str;
sort(s.begin(),s.end());
vector<int> visit(s.size(),0);
permutationCore(ans,str,s,0,visit);
return ans;
}
void permutat ...
Posted by pablodelapena on Wed, 19 Jan 2022 01:32:09 +0100
Blue Bridge Cup Summer Training Question 1
Sum of A Series
Skip it.
B k Good Number
Through dfs search, the parameter records the last selected number, then judges the number selected by this bit based on the last selected number, and finally memorizes the number selected by the current status and what the previous number is currently.
#include<bits/stdc++.h>
u ...
Posted by my_name on Tue, 18 Jan 2022 23:39:04 +0100
[diary of dishes] 215 The kth largest element in the array
Series index: [diary of dishes] the days when LeetCode used Python to abuse
The road of cultivating immortality with vegetables and chickens -- January 17, 2022 Although I haven't written a topic solution blog these two days, I still haven't broken one day. I just write simple questions and sometimes I don't think it's necessary to write ...
Posted by krang on Tue, 18 Jan 2022 23:24:07 +0100
Data structure - sorting
Experimental preparation:
1. Understand and master the basic concepts and methods of direct insertion sort, half insertion sort, 2-way insertion sort, bubble sort and quick sort. 2. Master the basic idea of sorting algorithm.
1, Experimental purpose
Master the implementation of the basic idea of sorting algorithm.Through experiments, master ...
Posted by ted_chou12 on Tue, 18 Jan 2022 21:27:46 +0100
c + + basic STL Part 4 (queue container and list container)
A basic concept of queue container
Concept: queue is a first in first out (FIFO) data structure. The queue container allows elements to be inserted from one end and removed from the other end. explain:
Usually, the head of the queue is to remove data, and the tail of the queue is to insert data;There is no iterator operation in the queue, ...
Posted by afhouston on Tue, 18 Jan 2022 20:35:28 +0100
Summary of typical minimum spanning tree algorithms~
Classification of minimum spanning tree
🐖: The minimum spanning tree is generally used for undirected graphs, and directed graphs are rarely used. Method selection: Dense graph: using naive Prim algorithm Sparse graph: using Kruskal algorithm Heap optimized Prim is not commonly used!
Plain Prim
The general idea can be referred to Dijk ...
Posted by schme16 on Tue, 18 Jan 2022 17:59:39 +0100
The algorithm enters Dachang from 0 - Part1 - and XOR operation
XOR and XOR
Recognize XOR
int a = 7;
// At this time, the binary of a is 0111
int b = 13;
// At this time, the binary of b is 1101
So now let's turn a XOR b to 10
0 1 1 1
1 1 0 1
-------
1 0 1 0
Officially, it is the same as 0, but different as 1
Simply remember that you want to add directly without carrying
Separate from the same or operat ...
Posted by pit on Tue, 18 Jan 2022 17:39:56 +0100
Hash table (general hash table, string hash and Luogu topic P1160 queue arrangement, P4387 [deep foundation 15. Xi 9] verification stack sequence)
Nanchang Institute of technology acm summer training This week I learned the hash table in the data structure and practiced some data structure topics I learned last week Next week, the multi school league will start to learn search and graph theory while making supplementary questions for the competition
General hash table
Definition of h ...
Posted by shezz on Tue, 18 Jan 2022 16:45:53 +0100