Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

BitArray

A bit array (also known as bit map, bit set, bit string, or bit vector) is an array data structure that compactly stores bits.

Installation

go get github.com/aermolaev/bitarray

Simple Example

package main

import (
	"fmt"

	"github.com/aermolaev/bitarray"
)

func main() {
	b := bitarray.NewBitArray(1_000_000)

	b.Mark(4000)
	fmt.Println(b.Get(4000)) // true

	b.Unmark(4000)
	fmt.Println(b.Get(4000)) // false

	i := b.MarkFree()        // 0
	fmt.Println(i)           // true
	fmt.Println(b.Get(i))    // true
	fmt.Println(b.IsEmpty()) // false
	fmt.Println(b.HasRoom()) // true
}

About

A bit array is an array data structure that compactly stores bits.

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.