Advanced depth first search

Depth first search application Example 1: alphabetical arrangement (subject library 2698) Given a string composed of different lowercase letters, output all the full permutations of the string. Let's assume 'a' < 'B' <... < 'for lowercase letters Y '<' Z ', and the letters in the given string have been arranged from small to large ...

Posted by captain_scarlet87 on Sun, 13 Feb 2022 09:04:28 +0100

Basic algorithm template | CSDN creation punch in

1. Fast power algorithm template Find mk%p, time complexity O(logk). int qmi(int m, int k, int p) { int res = 1 % p, t = m; while (k) { if (k&1) res = res * t % p; t = t * t % p; k >>= 1; } return res; }   2. Binary search algorithm template There are two bisection templates, which are ...

Posted by jaypotter on Sun, 13 Feb 2022 08:46:54 +0100

Introduction to basic JAVA learning

Introduction to JAVA array (I) So far, the basic syntax of java has been basically summarized. The next thing to learn is array. 1. Overview of Array Array is a collection of multiple data of the same type arranged in a certain order, named with a name, and managed uniformly by numbering.Common concepts of arrays: 1. Array name 2. Elements 3 ...

Posted by MBrody on Sun, 13 Feb 2022 03:19:44 +0100

HS Corner Detection

1. Basic Theory When processing feature descriptors suitable for multiple images, there are two main feature detection methods, one is angle-based detection, the other is to process all areas in the image. Here we will focus on angle-based detection. In 1988, Harris and Stephens presented an angle detection algorithm, HS Angle Detector. See p ...

Posted by SBro on Sat, 12 Feb 2022 18:14:25 +0100

Algorithm exercise 29 - "time display" of 2021 provincial competition of Blue Bridge Cup

preface Blue Bridge Cup 2021 provincial competition, programming problem (C + +) 1, Title Description Xiaolan wants to cooperate with her friends to develop a time display website. On the server, the friend has obtained the current time, which is expressed as an integer. The value is the number of milliseconds from 00:00:00 on Janua ...

Posted by dsoftnet on Sat, 12 Feb 2022 15:16:19 +0100

Algorithm design and analysis ordered table

Ordered table Function: supports all operations of hash table. Keys are organized in order (hash table is out of order)Time complexity: all operations are O(log N) levelImplementation method: (1) Red black tree (2)AVL (3)SBT (4) Skip list (1) , (2), (3) all attribute BST (balanced search binary tree) Search Binary Tree There are general ...

Posted by Arrow on Sat, 12 Feb 2022 13:28:22 +0100

Interface isolation principle -- give an example to illustrate the interface isolation principle in Java design pattern

Before introducing the principle of interface isolation, let's take a look at the first example in the following example - counterexample 1, Examples 1. Counterexample (1) Class diagram description Because the class diagram is relatively clear, let's look at the class diagram first As you can see, DogPlays Java and CatPlays Java impl ...

Posted by areid on Sat, 12 Feb 2022 12:50:56 +0100

[backtracking algorithm] data structure and algorithm

Backtracking algorithm is actually a similar exhaustive search attempt process, which is mainly to find the order of the problem in the search attempt process. When it is found that the solution conditions are not met, it will "backtrack" (i.e. backtrack) and try other paths. Therefore, backtracking method is known as "common pro ...

Posted by riex1 on Sat, 12 Feb 2022 12:06:15 +0100

Algorithm III. sorting and searching

Some codes involve the knowledge mentioned before Quick sort Two way fast platoon Improve according to the one-way fast sorting in the previous section. In order to prevent each cycle, the same number is on one side, such as: 3 4 1 2 3 2 1 3 1 3 5 4 Single way fast platoon: 1 1 2 1 3 3 3 4 5 4 In this way, the case equal to thre ...

Posted by britey on Sat, 12 Feb 2022 09:03:26 +0100

[sword finger offer] 10- I. Fibonacci sequence (it takes three hours to study something more essential)

Say something before brushing If you want to cut the length of the article, you will say it in addition to the length of the code, Because too much time is wasted in writing articles! In fact, it's not difficult to brush the questions. What's difficult is to insist! This column is the classic title of sword finger offer, And record you ...

Posted by The_Stranger on Sat, 12 Feb 2022 06:00:21 +0100