Knapsack problem of dynamic programming (java)
1, Dynamic programming
Dynamic Programming (DP) is a branch of operations research, which is the process of solving the optimization of decision-making process.
2, Basic thought
(1) divide the large problem into small problems to solve, so as to obtain the optimal solution step by step; (2) the dynamic progra ...
Posted by devilincarnated on Fri, 28 Jan 2022 14:00:55 +0100
Data structure -- implementation of two-way linked list (review)
Compared with the previous sequential list and single linked list, the implementation of two-way linked list is more complex, but the actual operation link is simpler. For example, highways are more difficult to build than ordinary asphalt roads, but cars can run faster on highways.
It should be noted that the condition that the two-way lead l ...
Posted by mellis95 on Fri, 28 Jan 2022 13:55:35 +0100
Hand torn red and black tree
I Introduction to red and black trees
Red black tree (R-B tree for short) is a special binary search tree.Red black tree is a special binary search tree, which means that it meets the characteristics of binary search tree: the key value contained in any node is greater than or equal to the key value of the left child and less than or equal ...
Posted by sriusa on Fri, 28 Jan 2022 13:13:40 +0100
Data structure - linear table
3, Linear table
Linear table is the most basic, simplest and most commonly used data structure. A linear table is a finite sequence of n data elements with the same characteristics.
Precursor element:
If element A is in front of element B, it is called the precursor element of B
Successor elements:
If element B follows element a, it is cal ...
Posted by The Jackel on Fri, 28 Jan 2022 12:00:16 +0100
Java one-dimensional array and common operations
1. Definition of array
An array is an ordered collection of data of the same type. Array describes several data of the same type according to a certain priority It is formed by arrangement and combination in the later order. Among them, each data is called an element, and each element can pass an index (subscript) To access them. Four basic fe ...
Posted by SensualSandwich on Fri, 28 Jan 2022 11:13:18 +0100
[CF1539F] Strange Array
Problem surface
There is a length of
n
\tt n
Sequence of n
a
\tt a
a. For each location
i
∈
[
...
Posted by hexguy on Fri, 28 Jan 2022 08:01:17 +0100
Analysis of leetcode problem solving ideas 693 - 699 questions
Alternate bit binary number Given a positive integer, check whether its binary representation always alternates 0 and 1: in other words, the numbers of adjacent two digits in the binary representation will never be the same.
Get data by bit and XOR
class Solution {
public:
bool hasAlternatingBits(int n)
{
int a = n & 1;
...
Posted by a1amattyj on Fri, 28 Jan 2022 07:21:04 +0100
Software construction blog1--java student achievement management system
(1) Foreword
Because this project was written in a hurry just after learning java. Although the management system was also written in c language before, the scoring standard at that time used more data structures such as pointers and linked lists. And it is process oriented programming, not object-oriented. This time I mainly want to write ...
Posted by jaybones on Fri, 28 Jan 2022 03:49:05 +0100
Learning note 2: linear data structure
preface
this article is about 300 lines of daily code link Study notes. give a 10% discount, with a daily code of 30 lines. this article adjusts the learned code according to your own understanding. the code in this article is just personal notes, and some notes are jumping. imitating excellent code is in ...
Posted by redbullmarky on Fri, 28 Jan 2022 01:41:58 +0100
Key algorithms of graph
1, ConceptA Graph is a structure used to represent a certain relationship between objects. The "object" after mathematical abstraction is called a Vertex, node or point, and the correlation between nodes is called an edge. When drawing a Graph, nodes are usually represented by a group of points or small circles, and the edges between ...
Posted by mhalloran on Fri, 28 Jan 2022 01:09:52 +0100