cookiejar

module
v2.0.0-...-8dcd6a7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2015 License: BSD-2-Clause

README

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
    • Scan and Fscan for int, float64, string and lines
  • math
    • Abs for int
    • Min and Max for int, big.Int and big.Rat
    • Sign for int and float64
  • os
    • Open and Create without error codes
  • sort
    • Sort and Search for big.Int and big.Rat
    • Unique for any sort.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'  __/_'>
    (   /  _/  )_\'>
     ' "__/   /_/\_>
         ____/_/_/_/
        /,---, _/ /
       ""  /_/_/_/
          /_(_(_(_                 \
         (   \_\_\\_               )\
          \'__\_\_\_\__            ).\
          //____|___\__)           )_/
          |  _  \'___'_(           /'
           \_ (-'\'___'_\      __,'_'
           __) \  \\___(_   __/.__,'
        ,((,-,__\  '", __\_/. __,'
                     '"./_._._-'

Directories

Path Synopsis
ai
utility
Package utility implements a reasoner AI based on utility theory.
Package utility implements a reasoner AI based on utility theory.
collections
bag
Package bag implements a multi-set data structure supporting arbitrary types (even a mixture).
Package bag implements a multi-set data structure supporting arbitrary types (even a mixture).
deque
Package deque implements a double ended queue supporting arbitrary types (even a mixture).
Package deque implements a double ended queue supporting arbitrary types (even a mixture).
prque
Package prque implements a priority queue data structure supporting arbitrary value types and float priorities.
Package prque implements a priority queue data structure supporting arbitrary value types and float priorities.
queue
Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).
Package queue implements a FIFO (first in first out) data structure supporting arbitrary types (even a mixture).
set
Package set implements simple present/not data structure supporting arbitrary types (even a mixture).
Package set implements simple present/not data structure supporting arbitrary types (even a mixture).
stack
Package stack implements a LIFO (last in first out) data structure supporting arbitrary types (even a mixture).
Package stack implements a LIFO (last in first out) data structure supporting arbitrary types (even a mixture).
exts
fmtext
Package fmtext contains extensions to the base Go fmt package.
Package fmtext contains extensions to the base Go fmt package.
mathext
Package mathext contains extensions to the base Go math package.
Package mathext contains extensions to the base Go math package.
osext
Package osext contains extensions to the base Go os package.
Package osext contains extensions to the base Go os package.
sortext
Package sortext contains extensions to the base Go sort package.
Package sortext contains extensions to the base Go sort package.
Package geometry implements basic geometric types and operations on them.
Package geometry implements basic geometric types and operations on them.
Package graph implements a simple graph data structure and supporting API to allow implementing graph alogirthms on top.
Package graph implements a simple graph data structure and supporting API to allow implementing graph alogirthms on top.
bfs
Package bfs implements the breadth-first-search algorithm for the graphs.
Package bfs implements the breadth-first-search algorithm for the graphs.
dfs
Package dfs implements the depth-first-search algorithm for the graphs.
Package dfs implements the depth-first-search algorithm for the graphs.
tools
deps
Package deps contains utility functions for contest dependency management.
Package deps contains utility functions for contest dependency management.

Jump to

Keyboard shortcuts

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