01 knapsack problem (explanation of state transition equation)

1. Topic introduction: There are N # items and a backpack with a capacity of V. each item has its own value and can only be selected once. Under the limited backpack capacity, the total value of the loaded items is the largest. "0-1 knapsack" is a relatively simple dynamic programming problem and the basis of other knapsack problems ...

Posted by DigitHeads on Sat, 01 Jan 2022 19:38:20 +0100

C + + function template and class template -- Generic Programming

The so-called function template is actually to establish a general function. Its function type and formal parameter type are not specified, but are represented by a virtual type. This generic function is called a function template. All functions with the same function body can be replaced by this template. There is no need to define multiple fu ...

Posted by daglasen on Sat, 01 Jan 2022 17:06:02 +0100

Detailed explanation of C++STL -- Simulation Implementation of vector

Overview of vector function interfaces namespace cl { //Simulation implementation vector template<class T> class vector { public: typedef T* iterator; typedef const T* const_iterator; //Default member function vector(); //Constructor vector(size_t n, const T& val); ...

Posted by PJ droopy pants on Sat, 01 Jan 2022 16:47:35 +0100

Binary search tree

Binary search tree concept Binary search tree is also called binary sort tree. It is either an empty tree or a binary tree with the following properties: If its left subtree is not empty, the values of all nodes on the left subtree are less than those of the root node If its right subtree is not empty, the values of all nodes on the right ...

Posted by jossejf on Sat, 01 Jan 2022 14:42:12 +0100

Summary of C + + dots

Summary of C + + dots (I) explain The main reason why C + + is difficult to learn is that its standards and knowledge points are complex; For the previous C + + learning bias theory, this column will take every 20 small problems as an article, which mainly records the problems encountered in practice. The difficulty is different, which can be ...

Posted by klaibert26 on Sat, 01 Jan 2022 09:55:13 +0100

Introduction to ROS learning notes | how to use launch file

Environment: Ubuntu 18 04, ROS version: Melody launch file: realize the configuration and startup of multiple nodes through xml file. ROS master can be started automatically without entering roscore instruction 1, launch file syntax 1. Grammar The root element in the launch file is defined with the < launch > tag < node >: ...

Posted by lentin64 on Sat, 01 Jan 2022 08:10:28 +0100

C + + Notes 9: linked list

P.S is a non professional and unfamiliar with C + + and algorithms. Starting from the introduction, he uses the Leetcode platform and draws on the ideas of many predecessors. The blog is only for recording. Three questions in this issue's punch list: corresponding to < sword finger Offer 06 Print linked list from end to end > < sword f ...

Posted by iraja on Sat, 01 Jan 2022 07:39:27 +0100

[interview] sorting out common interview questions in C + +

What is the difference between the declaration and definition of variables The definition of a variable allocates address and storage space for the variable, and the declaration of a variable does not allocate address. A variable can be declared in multiple places, But only in one place. join extern Modified is the declaration of a variable, ...

Posted by tron00 on Sat, 01 Jan 2022 04:26:06 +0100

C + + multidimensional array

Array of arrays Strictly speaking, there is no multi-dimensional array in C + + language. The commonly mentioned multi-dimensional array is actually an array of arrays. Keeping this in mind will be of great benefit to the understanding and use of multidimensional arrays in the future. When the element of an array is still an array, it is usuall ...

Posted by Web For U on Fri, 31 Dec 2021 23:04:12 +0100

Notes on bfs and dfs

See a problem, the problem solution summarizes the bfs and dfs templates to record.   1: bfs bfs is accessed layer by layer, which is suitable for finding the shortest path steps with goals. Think about searching layer by layer, and each layer represents one step. bfs gives priority to sibling nodes (adjacent nodes). Only when this laye ...

Posted by seanlim on Fri, 31 Dec 2021 22:28:44 +0100