search

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

*

  • @time: 2019-08-19 22:37
  • @author: louis

*

  • @time: 2019-08-20 22:49
  • @author: louis

*

  • @time: 2019-08-19 23:15
  • @author: louis

*

  • @time: 2019-08-19 22:53
  • @author: louis

Index

Constants

View Source
const (
	CMCC             byte = iota + 0x01 //中国移动
	CUCC                                //中国联通
	CTCC                                //中国电信
	CTCCv                               //电信虚拟运营商
	CUCCv                               //联通虚拟运营商
	CMCCv                               //移动虚拟运营商
	IntLen           = 4
	CharLen          = 1
	HeadLength       = 8
	PhoneIndexLength = 9
	PhoneDat         = "phone.dat"
)

Variables

View Source
var (
	CardTypeMap = map[byte]string{
		CMCC:  "中国移动",
		CUCC:  "中国联通",
		CTCC:  "中国电信",
		CTCCv: "中国电信虚拟运营商",
		CUCCv: "中国联通虚拟运营商",
		CMCCv: "中国移动虚拟运营商",
	}
)

Functions

func BinarySearch

func BinarySearch(arr []int, size, p int) int

BinarySearch 从小到大的int数组a里面,

func BinarySearchX

func BinarySearchX(nums []int, target int) int

func Debug

func Debug()

func Factorial

func Factorial(n int) int

func Fib

func Fib(n int) int

func FindX

func FindX() float64

func FlipBit

func FlipBit(c byte, i uint) byte

func GetBit

func GetBit(c byte, i uint) byte

GetBit get bit in byte

func LowerBound

func LowerBound(a []int, size, p int) int

LowerBound 在从小到大的数组里面

func OutputResult

func OutputResult()

func Period

func Period(p, e, i, d int)

func SetBit

func SetBit(c byte, i uint, v int) byte

func TwoSum

func TwoSum(a []int, m int) []int

解法3: 将数组遍历,存入map,key值为原数组索引,原数组索引存入value值,如果能从map里面取出要找的数,说明存在,复杂度为o(n)

func TwoSunSort

func TwoSunSort(a []int, m int) []int

Types

type PhoneRecord

type PhoneRecord struct {
	PhoneNum string
	Province string
	City     string
	ZipCode  string
	AreaZone string
	CardType string
}

func Find

func Find(phoneNum string) (pr *PhoneRecord, err error)

二分法查询phone数据

func (PhoneRecord) String

func (pr PhoneRecord) String() string

Directories

Path Synopsis
* * @time: 2019-08-19 21:47 * @author: louis
* * @time: 2019-08-19 21:47 * @author: louis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL