Leetcode3-4 (longest substring without repeated characters, finding the median of two positive arrays)
1. Longest substring without repeated characters
① Violent solution
According to the topic, convert the string to char type, cycle once, and then use a temp variable of temporary StringBuffer type for judgment. If the current byte does not exist in the temp string, it will be traced. Otherwise, it will be intercepted, and then continue to run ...
Posted by TCovert on Mon, 14 Feb 2022 06:51:08 +0100
Consistent hash ring algorithm for load balancing
preface
Now there is a scenario: when a client accesses the server, it can only access one machine all the time, because some user data exists on the server. If you access other servers, the user data will be lost. How to use algorithms to solve this problem?
Consistent hash ring algorithm
base
The ring structure here is abstracted from ou ...
Posted by podja on Mon, 14 Feb 2022 06:39:51 +0100
Bubble sorting and optimization of bubble sorting - > cocktail sorting
What is bubble sorting
Bubble Sort is the most basic exchange sort. Everyone must have drunk soda. There are often many small bubbles floating on it. This is because the carbon dioxide that makes up small bubbles is lighter than water, so small bubbles can float upward bit by bit. The basic idea of Bubble Sorting is to compare the values of ...
Posted by snowdog on Mon, 14 Feb 2022 04:16:15 +0100
Algorithm and tree structure
Tree structure: tree structure is a data structure that describes nonlinear hierarchical relationships.
A tree is a set of n data nodes, which contains a root node. Under the root node, there are some non intersecting subsets, which are subtrees of the root node. Basic characteristics of tree structure: (1) In a tree structure, there is only ...
Posted by blackwidow on Mon, 14 Feb 2022 02:56:02 +0100
[Template Summary] - Binary Search Tree BST - Basic
Template Title Link
BST Lookup- Leetcode 270. Closest BST ValueBST Insert- Leetcode 701. Insert Node in BSTBST Delete- Leetcode 450. Delete Node in BST
Binary Search Tree-BST Overview
BST is a kind of binary tree, which has the structural properties of binary tree: there is only one Root node, each node can have at most two left and right sub ...
Posted by Quadodo on Sun, 13 Feb 2022 18:42:38 +0100
[daily problem] Li Kou - game 280 (I really didn't know how to solve other people's problems so succinctly)
⭐ New pit in winter vacation -- daily question notes of code Fox 😢 The winter vacation is about to expire 😢
6007. Maximum sum of array - Hard - game 280 weekly question 4
Give you an integer array nums with length N and an integer numSlots, satisfying 2 * numSlots > = n. There are a total of numSlots baskets numbered 1 to numSlots.
Y ...
Posted by andrewgauger on Sun, 13 Feb 2022 15:18:17 +0100
Minimum spanning tree algorithm and bipartite graph algorithm
There are two minimum spanning tree algorithms. One is prim algorithm and the other is Kruskal algorithm. The time complexity of the two algorithms are o (n^2) and O (mlogn) [n is the number of points and m is the number of edges]. The two algorithms behave differently in different graphs.
Let's start with prim algorithm.
The core idea of thi ...
Posted by FaT3oYCG on Sun, 13 Feb 2022 11:57:46 +0100
[digital signal denoising] improved wavelet modulus maxima digital signal denoising based on MATLAB [including Matlab source code 1710]
1, Overview of wavelet threshold denoising
The noise of power quality disturbance signal mostly exists in the form of Gaussian white noise. Wavelet transform is used for multi-resolution decomposition of the signal. Because wavelet transform has the characteristics of removing data correlation, it can separate the energy of useful signal and n ...
Posted by TheTitans on Sun, 13 Feb 2022 11:48:53 +0100
Double pointer algorithm based on algorithm c++&python
The core of double pointer: transfer the information expressed by the previous state pointer to the next state, so as to reduce unnecessary search
Template:
while(i < n && j < m){ if(checked(i, j)) i ++; j ++; }
Topic 1:
Given a sequence of integers a1,a2,..., an with a length of nn and a sequence of integers b1 ...
Posted by ignace on Sun, 13 Feb 2022 10:37:24 +0100
Codeforces Global Round 19 A - E
https://codeforces.com/contest/1637
A
Select a length len, sort the number of the first len and the number of the next len respectively, and ask whether the array can always be arranged well
Obviously, only the array has been ordered before
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::syn ...
Posted by webpals on Sun, 13 Feb 2022 10:33:58 +0100