How to match strings in 9python

Title Description: Given the main string s and pattern string P, determine whether P is a substring of S. if so, find out the subscript of P in s for the first time. Method: Direct calculation method KMP 1. Direct calculation method Suppose the main string S = "S0S1S2 Sm ", mode string P = ...

Added by fr8 on Wed, 05 Feb 2020 07:07:03 +0200

Left God algorithm notes -- prefix tree

trie The prefix tree is understood by the figure above, in which nodes are represented by circles, and characters such as "abc" are added to the whole tree as paths instead of nodes. At the same time, each character is added from the beginning node, so it can be seen that "abc" an ...

Added by alfieshooter on Wed, 05 Feb 2020 05:46:43 +0200

Implementation and application of experiment 5-semaphore on Linux-0.11 operating system

Experimental environment: Implementation and application of semaphores Experimental Tasks: Write programs under Ubuntu to solve producer-consumer problems with semaphores; Implement semaphores in linux-0.11 and test them with a producer-consumer program. Solving producer-consumer problems with semap ...

Added by martin_g on Tue, 04 Feb 2020 05:42:03 +0200

Swing Programming - Tree Components

Tree Component (JTree) A tree can only have one parent node, and it can have zero or more children. By default, each node can have children, and it can be set to not have children. Common construction methods: public JTree() creates a default tree public JTree(TreeNode root) creates a tree from the r ...

Added by berridgeab on Mon, 03 Feb 2020 05:04:03 +0200

Initial Algorithms (Day 4) 4-2

1. Determine if a list of chains is palindromic (the same from forward to backward and from backward to forward) Solution 1: Traverse the entire list with one stack (the extra space is O(N), save the values of the list in the stack, pop them out one by one, and compare them with the values of the li ...

Added by patrickng on Mon, 03 Feb 2020 03:33:34 +0200

Serial data receiving and transmitting in DMA cycle mode of HAL library version

At https://my.oschina.net/machinor/blog/3162697 First, set up the serial port to receive and send data through the serial port. In the HAL library generated by STM32CubeMX, there are three types of serial data receiving and transmitting interfaces, namely blocking mode, non blocking mode and DMA mode. The text mainly analyzes DMA mode and propo ...

Added by PABobo on Sun, 02 Feb 2020 18:56:58 +0200

Redis: del/unlink command source code analysis

Redis (4): del/unlink command source code analysis Let's take a look at the deletion process in this article. For the client, the delete operation does not need to distinguish which data type, just del operation. Zero, delete definition of del command There are mainly two: del/unlink. The difference is that unlink is faster because it uses asyn ...

Added by Yamakazi on Sun, 02 Feb 2020 13:43:58 +0200

[Java common classes] common methods of ArrayList and Vector in java.util package

Article directory Preface 1, ArrayList Two, use 1. constructor 2. Common methods 2.1 add + get + remove 2.2 get the number of elements 2.3 whether it is empty 2.4 included or not 2.5 search 2.5 replacement Last Relevant Preface ArrayList and Vector are used the same way. They are all variabl ...

Added by byronwells on Sat, 01 Feb 2020 14:46:35 +0200

[2018.07.23 learning notes] [linux advanced knowledge Shell script programming exercise]

1. Write shell script to calculate the sum of 1-100; #!/bin/bash sum=0 for i in `seq 1 100` do sum=$[$sum+$i] done echo $sum 2. Write a shell script, ask to input a number, and then calculate the sum from 1 to the input number. If the input number is less than 1, input again until the correct number is input; #!/bin/bash n=0 while [ $n -lt " ...

Added by krraleigh on Fri, 31 Jan 2020 16:17:42 +0200

Common methods of arrays in js

Common methods of arrays in js push() Returns the new length after the specified value is added to the end of the array arrayObject.push(newElement1, newElement2,... newElementX) The push() method adds its parameter order to the tail of the arrayObject. Instead of creating a new array, it modifies ...

Added by SteveMellor on Thu, 30 Jan 2020 11:20:38 +0200