golang learning notes Part 2: 9 Arrays and slices

golang learning notes Part 2: 9 Arrays and slices 18. Array 1) Array definition: store multiple data of the same type. In go language, array is the value type var array name [array size] data type var a [5]int var b [3]int = [3]int{1,2,3} var c = [3]int{1,2,3} var d = [...] int {1,2,3} / /... Represents the traversal of the array for the syst ...

Posted by nec9716 on Wed, 09 Feb 2022 19:12:01 +0100

Chapter 4 stack and queue

Chapter 4 stack and queue A stack is a linear table that is restricted to insert and delete operations only at the end of the table. We call the end that allows insertion and deletion as the top of the stack, the other end as the bottom of the stack, and the stack without any data elements as an empty stack. Stack is also called last in first ...

Posted by BillyBoB on Wed, 09 Feb 2022 12:59:52 +0100

Leetcode question brushing record: 1 sum of two numbers (array hash)

Leetcode question brushing record: 1 sum of two numbers (array hash) Title stem: Given an integer array nums and an integer target value target, please find the two integers with and as the target value target in the array and return their array subscripts. You can assume that each input will correspond to only one answer. However, the sam ...

Posted by Bullit on Wed, 09 Feb 2022 06:03:33 +0100

NOI 1805: shredder DFS depth first search / map record answer / string to int

subject Origin link describe You are now in charge of designing a new paper shredder. The general shredder cuts the paper into small pieces and becomes difficult to read. The new shredder you designed has the following characteristics: 1. Before each cutting, a target number of shredders should be given first, and a number should also be in ...

Posted by CoderGoblin on Wed, 09 Feb 2022 04:20:52 +0100

[C++] Hash_map implementation principle and source code [hash table] [hash mapping] [universal data support] [STL]

Hash_map As a nonlinear data structure Before reading, you need to make sure you really understand what a pointer is And without looking at any source code, the linked list data structure is realized through the principle If unsure, the following articles are recommended: Principle of [C/C + +] pointer and its application and understanding (inc ...

Posted by driver on Wed, 09 Feb 2022 01:52:19 +0100

HashMap source code and underlying data structure analysis

The official account of WeChat: Java essays Follow to learn more about Java related technology sharing. Questions or suggestions, welcome to the official account message! Introduction to HashMap HashMap is mainly used to store key value pairs. It is implemented based on the Map interface of hash table. It is one of the commonly used Jav ...

Posted by rubadub on Wed, 09 Feb 2022 01:42:55 +0100

Basic improvement 1 - hash function and Hash list, etc

1, Characteristics of hash function Input ∞, output S (limited range)Same in - > same out not randomDifferent in - > same out hash collision. The probability is very smallDifferent inputs can be almost uniformly dispersed to the S region Input, the number obtained through the hash function is in a limited range S, modulus m, a ...

Posted by markvaughn2006 on Wed, 09 Feb 2022 01:40:09 +0100

AVL tree and red black tree

AVL tree concept Background: Although the binary search tree can shorten the search efficiency, if the data is orderly or close to orderly, the binary search tree will degenerate into a single tree, and the search elements are equivalent to searching elements in the sequence table, which is inefficient, Therefore, two Russian mathematicians G ...

Posted by ghostrider1 on Tue, 08 Feb 2022 22:28:37 +0100

Source Analysis of HashMap - Three main points (the reason for the capacity being 2nd power, calculation method of hash value and detailed expansion process)

1. Illustrating data structures 1. Infrastructure (1) Arrays Arrays are essentially a continuous block of memory that holds something in common. Array elements can be quickly positioned and manipulated through array subscripts. However, its insertion and deletion operations are inconvenient, requiring all elements following the insertio ...

Posted by DeeDee2010 on Tue, 08 Feb 2022 20:00:04 +0100

Flood Fill algorithm of common algorithm

Flood Fill algorithm of common algorithm Algorithm Introduction Basic function: find connected blocksBasic method: BFS searchApplicable topics: it is necessary to find out the topics of classification blocks / some clustering problemsAs the name suggests, Flood Fill algorithm is to find the surrounding qualified areas like flooding. BFS can b ...

Posted by DepretioN on Tue, 08 Feb 2022 15:44:16 +0100