Sorting - the most complete knowledge summary of seven sorting algorithms

concept Sorting: a series of records arranged in ascending or descending order according to the size of one or some keywords. Generally, sorting refers to sorting in place. What is sort stability Sorting stability: for two equal data, if the sorting algorithm can ensure that its relative position does not change after sorting, then the a ...

Posted by NikLP on Fri, 11 Feb 2022 16:01:40 +0100

Sword finger offer89: House theft

Title: A professional thief plans to steal houses along the street. There is a certain amount of cash hidden in each room. The only restrictive factor affecting the thief's theft is that the adjacent houses are equipped with interconnected anti-theft systems. If two adjacent houses are intruded by thieves on the same night, the system will auto ...

Posted by zipp on Fri, 11 Feb 2022 15:53:42 +0100

Data structure and algorithm - Chapter 3

catalogue Chapter III Proposal of linked list The essence of variable identification in python Single linked list Comparison between single linked list and sequential list Bidirectional linked list One way circular linked list Chapter III Proposal of linked list Linear list: sequential list + linked list The sequential list is arran ...

Posted by Braveheartt on Fri, 11 Feb 2022 13:53:51 +0100

Dichotomy and quadratic problem of algorithm performance optimization

Performance optimization cases 1. Dichotomy search Ordered array lookup What is an ordered array? If the values in an array are arranged in a certain order, we call it an ordered array For example: array [2, 8, 15, 24, 66, 88, 100] Now I want to complete a function to find out whether a number exists in the array. For example: 24 ...

Posted by Gulsaes on Fri, 11 Feb 2022 13:07:29 +0100

Python group of the 11th Blue Bridge Cup provincial competition in 2020 (real topic + analysis + code): Crop hybridization

1 true question Title Description Crop hybridization is an important step in crop cultivation. There are known n crops (No. 1 to n), and the time from sowing to maturity of the ith crop is Ti. Crops can be hybridized in pairs, and the longer of the two kinds of time is taken as the hybridization time. If the planting time of crop A is 5 ...

Posted by curmudgeon42 on Fri, 11 Feb 2022 11:59:35 +0100

Stack and queue force deduction problem opening brush

Question 1: Force deduction 232 questions Problem solving ideas: This is related to the characteristics of stacks and queues. As we all know, stacks meet the requirements of "first in and last out", while queues meet the requirements of "first in and first out", so smart humans think of using two stacks to realize queues. ...

Posted by glenelkins on Fri, 11 Feb 2022 10:14:14 +0100

Double pointer algorithm - sum of two numbers II

Give you an integer array numbers with subscript starting from 1. The array has been arranged in non decreasing order. Please find two numbers in the array that meet the sum of addition and equal to the target number target. If the two numbers are numbers[index1] and numbers[index2] respectively, then 1 < = index1 < index2 < = numbers ...

Posted by Hobgoblin11 on Fri, 11 Feb 2022 10:01:40 +0100

[Java data structure] - introduction of tree and detailed analysis of binary tree

1, Basic concepts of tree Definition of tree: Tree is a nonlinear data structure. It is a set with hierarchical relationship composed of n (n > = 0) finite nodes. It is called a tree because it looks like an upside down tree, that is, it has its roots up and its leaves down. It has the following characteristics: There is a spec ...

Posted by gaz_hayes on Fri, 11 Feb 2022 09:56:28 +0100

[ACWing]2277. Secret milking machine

Title address: https://www.acwing.com/problem/content/2279/ Farmer John is making a new milking machine and hopes to keep it strictly confidential. He hid the milking machine deep in the farm, enabling him to carry out the task without being found. In the process of machine manufacturing, he has to carry out a total between the cowshed and th ...

Posted by scottd on Fri, 11 Feb 2022 06:58:08 +0100

[algorithm problem inductive collection] graph theory - difference constraint

The application explanation of differential constraint can jump to: Principle and application of differential constraint algorithm 1, AcWing 1169 candy [Title Description] In kindergarten N N N children. Now the teacher wants to distribute candy to these children ...

Posted by Ell20 on Fri, 11 Feb 2022 05:47:05 +0100