Cookiejar
A contestant's algorithm toolbox
Install / Use
/learn @karalabe/CookiejarREADME
CookieJar - A contestant's toolbox
CookieJar is a small collection of common algorithms, data structures and library extensions that were deemed handy for computing competitions at one point or another.
This toolbox is a work in progress for the time being. It may be lacking, and it may change drastically between commits (although every effort is made not to). You're welcome to use it, but it's your head on the line :)
Installation
To get the package, execute:
go get gopkg.in/karalabe/cookiejar.v2
To import this package, add the following line to your code:
import "gopkg.in/karalabe/cookiejar.v2"
For more details, see the package documentation.
Contents
Algorithms:
Data structures:
Extensions:
- fmt
ScanandFscanforint,float64,stringand lines
- math
AbsforintMinandMaxforint,big.Intandbig.RatSignforintandfloat64
- os
OpenandCreatewithout error codes
- sort
SortandSearchforbig.Intandbig.RatUniquefor anysort.Interface
Below are the performance results for the data structures and the complexity analysis for the algorithms.
Performance
Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz:
- bag
- BenchmarkInsert 309 ns/op
- BenchmarkRemove 197 ns/op
- BenchmarkDo 28.1 ns/op
- deque
- BenchmarkPush 25.4 ns/op
- BenchmarkPop 6.72 ns/op
- prque
- BenchmarkPush 171 ns/op
- BenchmarkPop 947 ns/op
- queue
- BenchmarkPush 23.0 ns/op
- BenchmarkPop 5.92 ns/op
- set
- BenchmarkInsert 259 ns/op
- BenchmarkRemove 115 ns/op
- BenchmarkDo 20.9 ns/op
- stack
- BenchmarkPush 16.4 ns/op
- BenchmarkPop 6.45 ns/op
Complexity
| Algorithm | Time complexity | Space complexity | |:---------:|:---------------:|:----------------:| | graph/bfs | O(E) | O(V) | | graph/dfs | O(E) | O(E) |
Here be dragons :)
. _///_,
. / ` ' '>
) o' __/_'>
( / _/ )_\'>
' "__/ /_/\_>
____/_/_/_/
/,---, _/ /
"" /_/_/_/
/_(_(_(_ \
( \_\_\\_ )\
\'__\_\_\_\__ ).\
//____|___\__) )_/
| _ \'___'_( /'
\_ (-'\'___'_\ __,'_'
__) \ \\___(_ __/.__,'
,((,-,__\ '", __\_/. __,'
'"./_._._-'
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
