Data structure and algorithm sorting

sort Sorting is an algorithm that arranges data in a certain order. The following are introduced one by one. 1, Bubble sorting Bubble sorting is to compare the elements between lists in pairs, and the large exchange position is to the right. In the first pairwise comparison, the largest element must be placed on the far right, so the second ...

Posted by enemeth on Sat, 15 Jan 2022 11:50:47 +0100

PAT [L2-016] may all lovers in the world be brothers and sisters who have been separated for many years (dfs super detailed explanation)

Original title ha-ha. As we all know, intermarriage is not allowed within five clothes, that is, if the nearest common ancestor of two people is within five generations (i.e. myself, parents, grandparents, great grandparents and high grandparents), they cannot intermarry. Please help a couple to judge whether they can get married or not? Inpu ...

Posted by rinteractive on Sat, 15 Jan 2022 05:17:13 +0100

Radar echo simulation: echo generation, pulse compression (taking LFM as an example) matlab

Radar target echo Firstly, the composition and structure of radar target echo are introduced, and then the students have an in-depth understanding of the generation of target echo through code. The echo received by radar can be forward scattering or backward scattering. Backscattering is usually unique to bistatic radar. The signal receiv ...

Posted by Timsoft on Sat, 15 Jan 2022 04:21:15 +0100

Polygon clipping 1

Original address: https://sean.cm/a/polygon-clipping-pt1 Greiner Hormann clipping algorithm cannot handle coincident lines. So I studied and wrote another article that applies to all polygons. Read on here: Polygon clipping (Part 2) problem First, let's define the problem, Suppose you have two polygons, each in 2D var poly1 = [ // red ...

Posted by nawhaley2265 on Sat, 15 Jan 2022 04:11:31 +0100

Video processor

1, Environment configuration This program needs to import capture-0.3.10 jar,bridj-0.6.2.jar,slf4j-api-1.7.2.jar and slf4j-nop-1.7.26 Jar four jar packages. 2, Realization thought A total of three classes are required, namely, the interface display class (drawpixel), the image (video) processing class (myThread) and the button listener cl ...

Posted by whizzykid on Sat, 15 Jan 2022 03:41:29 +0100

Array 8: parsing the subList of ArrayList in Alibaba Development Manual

In the Taishan edition of Alibaba Java development manual, there are two descriptions about subList What does this mean? Let's analyze: Let's first look at the simple use of subList: List<String> bookList = new ArrayList<>();bookList.add("Kwai Ali");bookList.add("promotion increase ");bookList.add("assume CTO");bookList.add("Ma ...

Posted by cwscribner on Sat, 15 Jan 2022 02:06:37 +0100

Linked list sorting problem

Problem expression problem analysis The problem itself is easy to understand. Here are two solutions. The key to the problem of the linked list is to pay attention to the pointing between nodes. In addition, pay attention to each node, such as virtual head node, current node, previous node, next node, etc. the memory distribution of the li ...

Posted by phprocky on Sat, 15 Jan 2022 01:42:07 +0100

Introduction to dichotomy and dichotomy

Introduction to dichotomy and dichotomy Introduction to dichotomy and dichotomy Little story1. Introduction to dichotomy 1.1 time complexity1.2 working principle1.3 space complexity 1.3.1 recursive version1.3.2 non recursive version 1.3.3 binary search of STL 2. Common questions 2.1 binary search2.2 binary search 2.2 ...

Posted by shauns2007 on Fri, 14 Jan 2022 23:56:54 +0100

LeetCode tree review II

236. Nearest common ancestor of fork tree Given a binary tree, find the nearest common ancestor of two specified nodes in the tree. Baidu Encyclopedia defines the nearest public ancestor as: "for two nodes p and q with root tree T, the nearest public ancestor is expressed as a node x, which satisfies that x is the ancestor of p and q, an ...

Posted by bouba on Fri, 14 Jan 2022 22:43:00 +0100

[opencv3 learning record] Chapter 7 pixel operation on image

1: Image addition You can use the function CV2 Add() adds two images. Of course, numpy, res=img1+img can also be used directly. The size and type of the two images must be the same, or the second image can make a simple scalar value. Note: addition in OpenCV is different from addition in Numpy. OpenCV addition is a saturation operation, whil ...

Posted by Bac on Fri, 14 Jan 2022 22:04:55 +0100