Interpretation of ArrayList source code

Interpretation of ArrayList source code attribute private static final int DEFAULT_CAPACITY = 10;//Default initialization space private static final Object[] EMPTY_ELEMENTDATA = {};//Empty array for empty object initialization private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; transient Object[] element ...

Posted by The_Assistant on Sat, 02 Nov 2019 11:09:12 -0700

HDU-4568 TSP + shortest circuit

Meaning: for a matrix with n rows and m columns, the number on the matrix represents the passing cost (pay attention here to pay for each passing cost). There are several treasures on the matrix. The hunter can go in from any boundary, get all the treasures from the matrix and come out from any boundary. Solution: it should be easy to think of ...

Posted by bruckerrlb on Sat, 02 Nov 2019 10:43:10 -0700

kuangbin special topic a simple search for very Cola HDU - 1495

Title Link: https://vjudge.net/problem/HDU-1495 There are two empty cups (N l and M L respectively) and A full can of coke (S l), S = N + M, three containers can be poured into each other. If A is poured into B, there are only two cases:(1) pour all A into B, and the number of liters in B is less than or equal to the maximum capacity of B.(2) ...

Posted by fukas on Sat, 02 Nov 2019 04:01:05 -0700

[explanation] roll out of Mr. Luogu P5338 [TJOI2019]

Original question gate This problem can balance the tree directly and energetically, so I want to talk about the method of line segment tree + tree array It's also very violent to use the actual line tree + tree array First, we use the tree array to maintain the number of teams per ac. In this way, we can quickly find out how many teams have mo ...

Posted by kidbrax on Fri, 01 Nov 2019 23:17:55 -0700

hdu4738 Caocao's Bridges(tarjan / bridge + special judgment)

subject I n this paper, we give a n (n < = 1E3) point m (m < = n * n) edge graph. There are wi individuals (0 < = wi < = 1E4) on the i-th edge. Blow up at most one edge of this picture at the cost that the number of people dispatched is not less than the number of people on the edge Sp ...

Posted by Terminator on Fri, 01 Nov 2019 12:02:12 -0700

Data structure experiment: one way linked list

Experiment content: 1. Randomly generate or input a group of elements (no less than 10 elements) to establish a single chain table with leading nodes. 2. Invert the elements in the single chain table (it is not allowed to apply for new node space). 3. Delete all even element nodes in the single chain table. 4. Write a ...

Posted by tony_l on Fri, 01 Nov 2019 08:23:05 -0700

Minimum coverage

  Main idea: first determine an M, then input the coordinates of the left and right ends of multiple groups of line segments, and then let you find out that in the given line segment, you can The minimum number of lines needed to completely cover the [0, M] area, and output the left and right endpoint coordinates of these lines.   Thought ...

Posted by Angus on Fri, 01 Nov 2019 04:13:04 -0700

sklearn linear regression

# import numpy as np import pandas as pd from pandas import Series,DataFrame import matplotlib.pyplot as plt from pylab import mpl mpl.rcParams['font.sans-serif'] = ['FangSong'] # Specify default font mpl.rcParams['axes.unicode_minus'] = False # Resolve save image is negative'-'Questions displayed as squares //Import data coastal ...

Posted by rowantrimmer on Thu, 31 Oct 2019 16:14:23 -0700

Implement design pattern from scratch based on Java -- Builder pattern

Builder mode: in this mode, users do not need to know the details of internal construction, so they can better control the construction process. A complex object can have many parameters and components. The purpose of builder mode is to separate the process of creating this complex object from m ...

Posted by lady1dc on Thu, 31 Oct 2019 11:19:48 -0700

leetcode - 42.Trapping Rain Water

simple solution Search from the left side of the list, and define left=0. If the number on the right side is less than the number on the left side, search from the left side to the right side until a number on the right side is greater than the number on the left side, or greater than the number afte ...

Posted by phpcat on Wed, 30 Oct 2019 10:33:23 -0700