Xiaohao algorithm let you learn how to judge with code

"24 o'clock" is a kind of mathematical game, just like chess and go, it is a kind of entertainment that people like to see. It can't be traced back to when it started, but it is gradually accepted by more and more people with its unique mathematical charm and rich connotation. Today, I'd like to share an algorithm topic about "2 ...

Posted on Wed, 26 Feb 2020 04:00:46 -0500 by eskimo42

Slice and Array in Golang

1. Arrays in Golang Arrays are a basic data structure with a fixed length. Once an array is created in golang as in C, its length is not allowed to change. The empty position of the array is filled with 0 and the array is not allowed to cross the boundary. Some basic operations of arrays: Create arrays:   func main() { var arr1 = [...]int{1,2 ...

Posted on Tue, 25 Feb 2020 11:13:16 -0500 by ghazianibros

golang foundation--defer in detail

defer anonymous function feature Executes like destructors in other languages, one by one in the reverse order of the call order after the body has been executed //Reverse execution order package main import "fmt" func main() { fmt.Println("a") defer fmt.Println("b") defer fmt.Println("c") } /*output a c b */ Even if a serious e ...

Posted on Thu, 20 Feb 2020 11:42:17 -0500 by tomato

Out of the box digital currency options quantitative trading tool

1. Quantitative and procedural trading of digital currency options Recently, many exchanges have successively opened the trading function of digital currency options, a derivative. Similar to traditional options, options trading and futures trading can combine to form many trading strategies and methods. Although there are many open-source qua ...

Posted on Thu, 20 Feb 2020 04:30:47 -0500 by genius

A memory error of golang channel

cause Cause investigation Cause analysis Problem solving summary cause Today, when reading database data, first write the data read from the database to the channel through multiple goroutines, and then read the data from the channel through another goroutine for analysis This is such a simple function. When reading data, the following error ...

Posted on Wed, 19 Feb 2020 23:11:51 -0500 by Onle

Go - atomic package usage and source code analysis of atomic.Value

1. Atomic operation in go Atomicity: the property that one or more operations are not interrupted during the execution of the CPU. It is called atomicity. These operations are shown as an integral whole externally. They either execute or do not execute, and the outside world will not see that they only execute to half of the st ...

Posted on Wed, 19 Feb 2020 02:59:29 -0500 by nafarius1357

2020 teaches you a deep understanding of the channel of Golang

Preface There are two powerful tools for concurrent programming in Golang, channel and goroutine. In this article, let's talk about channel. People familiar with Golang all know a famous saying: "use communication to share memory, not to communicate through shared memory". There are two meanings in this sentence. Go la ...

Posted on Mon, 17 Feb 2020 04:21:50 -0500 by Jiin

Raft theory and practice [6]-lab3a-building distributed fault-tolerant kv service based on raft

Dead work Read raft paper Read raft Theory and Practice [1] - Theory Paper Read raft Theory and Practice [2]-lab2a Read raft theory and practice [3]-lab2a explanation Read raft Theory and Practice [4]-lab2b Log Replication Read raft Theory and Practice [5]-lab2c Log Replication Read Simulate RPC remote procedure calls Preface In previous ar ...

Posted on Sat, 15 Feb 2020 12:08:37 -0500 by dar-k

Basis of golang -- strcut structure

Struct is similar to class in python language. The elements of struct can be a variable, function or other types, such as python attributes and methods. // struct structure, similar to class class in python package main import "fmt" type person struct { //Define a strcut Name string Age int } func main() { a := person{} //Ass ...

Posted on Sat, 15 Feb 2020 10:21:45 -0500 by moberemk

Unit test of Go language foundation

Development without writing tests is not a good programmer. I personally advocate TDD (Test Driven Development), but unfortunately, domestic programmers do not pay much attention to the test part. This article mainly introduces how to do unit test and benchmark in Go language. go test tool Tests in the Go language rely on the go test command. W ...

Posted on Mon, 10 Feb 2020 10:21:20 -0500 by lucasmontan