POJ-2286 The Rotation Game + Python(DFS)

Title Link: poj 2286 The Rotation Game Title Purpose: make the values of the middle 8 elements the same by rotating in 8 directions. Examples are as follows: I. problem solving instructions #1 note: during Rotation, the matrix data needs to be re assigned, otherwise it will change together. #2. Note: the operation procedure is stored in a ...

Posted by chadtimothy23 on Sun, 26 Dec 2021 15:03:44 +0100

Violent recursion -- Hanoi Tower problem

Print the whole process of moving the n-layer Hanoi tower from the leftmost to the rightmost Violent recursion is trying 1) The problem is transformed into a sub problem of the same kind of problem with reduced scale 2) There are explicit conditions (base case) that do not need to continue recursion 3) There is a decision-making process whe ...

Posted by nomadrw on Sun, 26 Dec 2021 14:04:52 +0100

Force buckle: 5965 Sum of intervals of the same elements - prefix and

Title: Give you an array arr of n integers with subscripts starting from 0. The interval between two elements in arr is defined as the absolute difference between their subscripts. More formally, the interval between arr[i] and arr[j] is | i - j |. Returns an array of intervals of length n, where intervals[i] is the sum of the intervals bet ...

Posted by Parody on Sun, 26 Dec 2021 13:57:39 +0100

Sword finger offer: motion range of JZ66 robot

describe There is a grid of rows and cols columns on the ground. The coordinates are from [0,0] to [rows-1,cols-1]. A robot starts to move from the grid with coordinates 0,0. Each time, it can only move one grid in the left, right, upper and lower directions, but it cannot enter the grid where the sum of digits of row coordinates and column co ...

Posted by rweston002 on Sun, 26 Dec 2021 12:47:12 +0100

[Algorithms] Use exercises to teach you how to use dynamic planning, super-detailed, at a glance!! Recommended collection!!

As long as you keep reading it, I'm sure you can learn it!! Preface Definition of Dynamic Planning (DP): Dynamic Planning is an extension of the idea of division, and in a general sense, it is the art of turning big things into small ones and small things into nothing. Dynamic planning has the following three characteristics: ...

Posted by johno on Sun, 26 Dec 2021 10:08:10 +0100

Python programming to sort keyboard input elements binary tree sorting

Today, let's take a different sort method - binary tree sort. This sorting method is more interesting and easy to operate. This paper refers to Python data analysis from introduction to mastery, Zhang Xiaoyu and Li Jing, electronic industry press, 5.3 2 sorting Binary tree sorting The process of binary tree sorting is mainly the constru ...

Posted by Bogart on Sun, 26 Dec 2021 08:35:55 +0100

7. Sliding window routine algorithm framework -- Go language version

Antecedents: Go language learners. Article reference https://labuladong.gitee.io/algo , the code is written by yourself. If there is anything wrong, thank you for your correction In order to facilitate downloading and sorting, articles on golang algorithm have been open source and placed in: https://github.com/honlu/GoLabuladongAlgorithmhttps ...

Posted by ccgorman on Sun, 26 Dec 2021 00:36:50 +0100

Python implementation of common algorithms

sort Quick row arr = [np.random.randint(1,100) for i in range(11)] def quickSort(data): if len(data)<2: return data else: tmp = data[-1] data.pop() left,right = [],[] for item in data: if item <=tmp: left.append(item) else: right.appe ...

Posted by ki on Sun, 26 Dec 2021 00:17:47 +0100

Algorithm - discretization

The discretization in this section refers in particular to the order preserving discretization of integers. What is 1 There is such a problem in processing: processing the number (eg.105) with a small number in a large data range (eg.0 ~ 109), that is, "large value range, small number". The large storage space and high time complexi ...

Posted by kpowning on Sat, 25 Dec 2021 22:08:30 +0100

Data structure - binary tree - Application - BST&AVL&RBT

Data structure - binary tree - Application - BST & AVL & RBT Binary sort tree (BST) Basics demand Give you a sequence (7, 3, 10, 12, 5, 1, 9), which is required to query and add data efficiently. Use array (1) The array is not sorted. Advantages: it is added directly at the end of the array, which is fast. Disadvantages: t ...

Posted by jesse_james on Sat, 25 Dec 2021 21:46:02 +0100