Data structure and algorithm

catalogue Object oriented programming Complexity analysis Linked list Unidirectional linked list Bidirectional linked list Circular linked list Jump linked list Sparse table Stack and queue Stack: (last in, first out) Queue: (first in, first out) Queue with two stacks Stack with two queues recursion Recursive implementation of fa ...

Posted by BinaryStar on Wed, 19 Jan 2022 21:56:26 +0100

Trying to master the basic knapsack problem

    1: 01 knapsack problem   There are N items and a backpack with a capacity of {V. Each item can only be used once. The volume of the # i article is # vi and the value is # wi. Solve which items are loaded into the backpack, so that the total volume of these items does not exceed the backpack capacity, and the total value is the largest. ...

Posted by kristen on Wed, 19 Jan 2022 20:59:09 +0100

KMP algorithm (string matching problem) acm winter vacation training diary 22 / 1 / 19

First, let's look at an example: If we don't consider overtime, we can use the most simple method (violence) to solve it //Violence algorithm (n*m) int ViolentMatch(char *s,char *p) { int sLen = strlen(s); int pLen = strlen(p); int i = 0; int j = 0; while(i<sLen&&j<pLen) { if(s[i]==p[j]) { i++; j++; } ...

Posted by ceanth on Wed, 19 Jan 2022 20:18:48 +0100

2022-01-17 swipe questions and punch in every day

1, Y total video progress          2, 854 Floyd finds the shortest path (1) Problem description          Given a directed graph with {nn} points and {mm} edges, there may be multiple edges and self rings, and the edge weight may be negative. Give another {kk} queries. Each query contains two integers {xx} and} yy, indicating the shortest ...

Posted by ewillms on Wed, 19 Jan 2022 17:12:49 +0100

[SSL.1213] polygon area (computational geometry)

Polygon area Description Jerry, a middle school student, is intoxicated with mathematical research. His problems may be too simple for experts, but as a 15-year-old amateur, he does very well. He is so keen on thinking about mathematical problems that he easily learns to try mathematical methods to solve problems. One day, He saw a piece of p ...

Posted by suthen_cowgirl on Wed, 19 Jan 2022 15:12:05 +0100

Arrays, functions and objects of JavaScript(2)

1, Array Concept of array: It can store a group of relevant data together and provide convenient access What is an array: An array is a collection of data, each of which is called an element. Any type of element can be stored in the array. //Ordinary variables can only store one value at a time var num = 10; //Arrays can store multiple va ...

Posted by shoutdots on Wed, 19 Jan 2022 15:01:28 +0100

[case] clustering algorithm

KMEANS clustering https://www.cnblogs.com/pinard/p/6164214.html 1. Briefly describe the principle and workflow of K-means algorithm K sample points are randomly selected as the initial centroid Calculate the distance from other samples to K centroids respectively, and divide each sample into the nearest cluster For the new cluster, calcul ...

Posted by Deviants on Wed, 19 Jan 2022 14:44:04 +0100

Modeling method for dealing with structural changes of time series 1

Previous articles in this column have discussed that under the condition of complex and changeable exogenous stimuli, the structure of time series data will change, so that outdated data is no longer suitable for current time series modeling. The general time series econometric modeling method itself does not have the function of identifying st ...

Posted by Russia on Wed, 19 Jan 2022 14:35:43 +0100

Data structure and algorithm: Fig

chart 1, Figure basic introduction 1. Why is there a map We learned linear tables and trees earlierThe linear table is limited to the relationship between a direct precursor and a direct successorThe tree can only have one direct precursor, that is, the parent nodeWhen we need to represent many to many relationships, we use graphs here. 2. ...

Posted by switchdoc on Wed, 19 Jan 2022 13:53:26 +0100

LeetCode-138 - copy linked list with random pointer

Copy linked list with random pointer Title Description: give you a linked list with a length of n. each node contains an additional random pointer random, which can point to any node or empty node in the linked list. Construct a deep copy of this linked list. The deep copy should consist of exactly n new nodes, in which the value of each new n ...

Posted by dman779 on Wed, 19 Jan 2022 08:26:42 +0100