UVA122 traverses Trees on the level
Title Description
input
(11,LL) (7,LLL) (8,R) (5,) (4,L) (13,RL) (2,LLR) (1,RRR) (4,RR) ()
(3,L) (4,R) ()
output
5 4 8 11 13 4 7 2 1
not complete
Idea 1: implement binary tree in pointer mode (chain storage) First define a structure, and then define a structure pointer root as the root node of the whole tree. If the left and right nodes ...
Posted by henrygao on Sat, 19 Feb 2022 13:08:37 +0100
Generate binary reflection code
Recursively generate binary reflection Code:
Requirements:
We use recursion to generate binary reflection gray code.
What is gray code?
The typical Binary Gray Code is abbreviated as gray code, which is named after the patent "Pulse Code Communication" of Frank Gray (18870913-19690523) published in 1953. It was originally used to ...
Posted by shazly on Sat, 19 Feb 2022 12:00:12 +0100
poj3565 (maximum weight perfect match)
Meaning: let n ants to an apple tree, and give the corresponding coordinates of N ants and N apple trees. To calculate the weight is to calculate the distance between coordinate points, and it is required to calculate the minimum distance! Idea: use the maximum weight perfect matching problem, but now the problem is to find the minimum weight. ...
Posted by zsedc on Sat, 19 Feb 2022 11:14:41 +0100
Topic + source code analysis (81 examples)
[Title 81]
Title: a company uses a public telephone to transmit data. The data is a four digit integer and is encrypted in the transmission process. The encryption rules are as follows: add 5 to each number, then replace the number with the remainder of sum divided by 10, and then exchange the first and fourth bits, and the second and third bi ...
Posted by Pavel_Nedved on Sat, 19 Feb 2022 10:43:34 +0100
A headline algorithm problem, an unknown solution!
subject
Enter the integer array arr to find the minimum number of k. For example, if you enter 8 numbers: 4, 5, 1, 6, 2, 7, 3 and 8, the smallest 4 numbers are 1, 2, 3 and 4.
Example 1:
Input: arr = [3,2,1], k = 2 output: [1,2] or [2,1] example 2:
Input: arr = [0,1,2,1], k = 1, output: [0]
Restrictions:
0 <= k <= arr.length &l ...
Posted by thinfile on Sat, 19 Feb 2022 09:37:24 +0100
Wireless sensor network location simulation algorithm based on matlab particle swarm optimization
1 Introduction
As one of the 21 most influential technologies in the 21st century and one of the top ten technologies that change the world, Wireless Sensor Networks (WSN) is widely used in industry, transportation, medical treatment, environmental protection, military management and so on. WSN is usually composed of a large number of wireless ...
Posted by intercampus on Sat, 19 Feb 2022 09:28:33 +0100
Day86 sliding window maximum
Give you an integer array nums, with a sliding window of size k moving from the leftmost side of the array to the rightmost side of the array. You can only see k numbers in the sliding window. The sliding window moves only one bit to the right at a time. Returns the maximum value in the sliding window
https://leetcode-cn.com/problems/sliding-w ...
Posted by jokeruk on Sat, 19 Feb 2022 08:43:14 +0100
Credit scoring model development (FICO scoring)
Take Alipay's Sesame credit as an example, its value range is 350-950 points. It is generally believed that the higher the score, the better the credit and the lower the default rate of personal business. Here is also a personal credit scoring tool similar to FICO scoring.
The idea of FICO scoring is: collect / analyze / convert a large number ...
Posted by nick5449 on Sat, 19 Feb 2022 05:52:12 +0100
LeetCode-004 Median of Two Sorted Arrays
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
Example:
Input: nums1 = [1,3], nums2 = [2]
Output: 2.00000
Explanation: merged array = [1,2,3] and median is 2.
Solution 1
To find the median in an ordered array, you ...
Posted by theorok on Sat, 19 Feb 2022 05:09:39 +0100
Main algorithms of OCR text detection
Reprint: https://www.mayi888.com/archives/60604
Character detection is a very important link in the process of character recognition. The main goal of character detection is to detect the position of the character area in the picture for later character recognition. Only when the text area is found can its content be recognized.
Text detec ...
Posted by psycovic23 on Sat, 19 Feb 2022 04:51:57 +0100