Java solves the eight queens problem
Video link: Han Ping's Java data structure and algorithm -- 8 Queen Problem
Eight emperors and empress N
VIII. Introduction to questions:
The eight queens problem is an ancient and famous problem and a typical case of backtracking algorithm. The problem was put forward by international chess player Max Bethel in 1848: in August × E ...
Posted by raffael3d on Sun, 10 Oct 2021 19:56:38 -0700
Talking about TSP of repeatable cities (shortest distance + specific walking method)
Hello, guys. Today, I'd like to briefly talk about the TSP problem of this repeatable city. The so-called repeatable means that the city and route can be taken casually, as long as the sum of its paths is the smallest in the end.
The knowledge points to be used are state compression dp and Floyd algorithm
1, Floyd algorithm
Floyd algorithm: ...
Posted by Remote4ever on Sun, 10 Oct 2021 10:41:23 -0700
[data structure] sort - eight sorts
preface
In learning data structures, we often come into contact with the term sorting, but when we learn, we may be at a loss when facing the code directly. Why do the interface use these parameters and why do we exchange them back and forth... We don't know what the authors think when implementing these interfaces, In this blog, I wil ...
Posted by kailien on Sun, 10 Oct 2021 10:33:03 -0700
[Algorithm-LeetCode] 110.Balanced Binary Tree (Recursive)
110.Balanced Binary Tree-Force Button (LeetCode)
Release: October 10, 2021 21:30:53
Problem description and examples
Given a binary tree, determine whether it is a highly balanced binary tree. In this topic, a height-balanced binary tree is defined as: The absolute difference between the left and right subtrees of each node of a binary tr ...
Posted by lox on Sun, 10 Oct 2021 10:19:23 -0700
Week 2021-10-10 summary
1, Problem summary
2, Problem reply
2.1LeetCode: 2. Add two numbers
(1) Problem description
Here you are A non empty linked list that represents two non negative integers. Each of these numbers is based on Reverse order And each node can only store One Number.
Please add the two numbers and re ...
Posted by fingerprn on Sun, 10 Oct 2021 04:54:42 -0700
JAVA object-oriented basic knowledge and error prone points
1, Stack method area, method call, recursion, etc
1. Object class stack method area
Cat cat = new Cat();
cat.name = "Xiaobai";
cat.age = 12;
cat.color = "white";
The string is a reference type and will be placed in the constant pool of the method area
① The syntax of attribute definition is the same as that of varia ...
Posted by jesus_hairdo on Sun, 10 Oct 2021 00:17:21 -0700
Sorting - Minimum k number, median of data stream, heap module, double heap
Sword finger Offer 40. Minimum number of k
Just in the last article, we talked about the two sorting methods of small top heap and fast row, which can solve the k-th problem.
Official fast platoon use ij exchange
Here is my wrong idea
To find the k-th, you should first be able to write fast rows. For a round of fast scheduling, the lef ...
Posted by DangerousDave86 on Sat, 09 Oct 2021 21:58:01 -0700
Divide and conquer algorithm (D&C)
summary
Divide and conquer (D & C) algorithm is a classical recursive method to solve problems. Divide and conquer is its main idea. Applicable scenarios: 1) Find the termination condition (baseline condition) and stop recursion. The simpler the condition, the better; 2) It can decompose the problem and continuously reduce the scale of the ...
Posted by gethinw on Sat, 09 Oct 2021 20:37:48 -0700
Force buckle + basic algorithm summary
preface
Give yourself: 26 days away from the Blue Bridge Cup. I've been preparing for a whole month and a half, and I haven't put too much pressure on myself. occasionally
Play the piano and play the band, and occasionally play games, which is basically in the state of half learning and playing. The most important part of the previous Blu ...
Posted by danieliser on Sat, 09 Oct 2021 20:32:27 -0700
⭐Introduction to Algorithms⭐Heap Medium 02 - LeetCode 703.Largest K element in data flow
1. Title
1. Title Description
_Design a class that finds the kth largest element in the data stream. Note that the kth largest element is sorted, not the kth different element. Implement the KthLargest class:_1) KthLargest(int k, int[] nums) initializes objects using integer k and integer stream nums._2) int add(int val) inserts Vals ...
Posted by classic on Sat, 09 Oct 2021 12:21:15 -0700