0

一些数据结构小抄

 1 year ago
source link: https://helloteemo.github.io/2022/11/16/leetcode/%E5%B0%8F%E6%8A%84/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

本文最后更新于:2022年11月16日 晚上

数据结构小抄,Go语言实现,用于面试快速书写算法

一些数据结构小抄

type hp struct{ sort.IntSlice }

func (h *hp) Push(v interface{}) {
h.IntSlice = append(h.IntSlice, v.(int))
}

func (h *hp) Pop() interface{} {
a := h.IntSlice
v := a[len(a)-1]
h.IntSlice = a[:len(a)-1]
return v
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK