Tag：Section

Time：2021418
Some usages of dataframe in pandas Pandas reading excel file pd.read_excelThe prerequisite is to install the xlrd library Conversion between dataframe, numpy and list Dataframe to numpy: dataframe object. Values Dataframe to list: dataframe object values.tolist () List to numpy: np.array (list object) List to dataframe: pd.DataFrame (list object) Numpy to list: numpy object. Tolist […]

Time：2021417
Binary search [toc] The most basic binary search int binarySearch(int[] nums, int target) { int left = 0; int right = nums.length 1; // Note while(left <= right) { Int mid = left + (right – left) / 2; // Note: if (right + left) / 2 is used, overflow will occur if(nums[mid] == target) […]

Time：2021417
algorithm First select a benchmark pivot, then go through the array, Move everything smaller than pivot to the left of pivot, Move everything larger than pivot to the right of pivot. In this way, the position of the pivot is determined, that is, one element is arranged. Then sort the numbers to the left of […]

Time：2021414
In the world of code, stack is a very important data structure no matter what language it is.Stack overflow, the worldfamous code query community, takes stack overflow as a part of the website name.In the process of writing code or debugging, I believe you have felt the joy of skipping in the world of function […]

Time：2021414
Is the following code a dead loop? func main() { v := []int{1, 2, 3} for i := range v { v = append(v, i) } } The above code first initializes a file with contents of 1, 2 and 3sliceAnd then traverse thissliceAnd then add elements to the slice. As the traversal proceeds, the […]

Time：2021412
What is sorting? First knowledge Algorithm diagram Sorting in JavaScript Normal sort Complex sorting Encapsulation of complex sorting function Lodash (v4.17.15) sort function Looking at sort () Bihui classic sorting algorithm Bubble sort (max end sort) Select sort (minimum value first sort) Insert sort (find position sort) Merge sort (binary recursive sort) Quick sort (base […]

Time：2021411
The Dutch flag problem is also called tricolor sorting, or rainbow sorting, Because the Dutch flag has only three colors, the problem of this question is to give you three colors and arrange them in the given order. Of course, there are various ways to ask questions, some for numbers, some for letters, but the […]

Time：202142
Built in functions 1. Close: it is mainly used to close the channel 2. Len: used to find the length, such as string, array, slice, map and channel 3. Both new and make are used to allocate memory New is used to assign value types, such as int and string, and returns a pointer Make […]

Time：2021330
128. Longest continuous sequence subject Given an unordered integer array, find out the length of the longest continuous sequence. The time complexity of the algorithm is O (n). Example: Input: [100, 4, 200, 1, 3, 2]Output: 4Explanation: the longest continuous sequence is [1,2,3,4]. Its length is four. Thinking of solving problems Idea: hash table The […]

Time：2021322
1. What is a string? In go language, string is a byte slice. By placing the content between double quotation marks, we can create a string. Let’s take a look at a simple example of creating and printing a string. package main import ( “fmt” ) func main() { str := “hello golang” fmt.Println(str) } […]

Time：2021319
In recent discussions with colleagues, I mentioned the importance of go languageVariable parametersWe have not summarized the relevant knowledge points before. Today we will introduce the variable parameters of go language. Variable parameters（Variable Parameters）Function with variable number of parameters is called variable parameter function, which is mainly used inGrammar sugar（syntactic sugar）。 The most classic example […]

Time：2021317
Chapter 2 vector VectorIt is an abstraction and generalization of linear array. Starting from the most basic interface of vector, the corresponding vector template class is designed and implemented. a. Operation interface supported by vector ADT Operation interface function Applicable objects size() The current size of the report vector (total number of elements) vector get(r) […]