Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gaissmai committed Jan 26, 2025
1 parent b72b2c3 commit e7edf58
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/sparse/array.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ type Array[T any] struct {

// Get the value at i from sparse array.
//
// example: Array.Get(5) -> Array.Items[1]
// example: Array.Get(5) -> Array.Items[1]
//
//
// BitSet: [0|0|1|0|0|1|0|1|...] <- 3 bits set
// Items: [*|*|*] <- len(Items) = 3
//
// ⬇
// BitSet: [0|0|1|0|0|1|0|1|...] <- 3 bits set
// Items: [*|*|*] <- len(Items) = 3
// ⬆
//
// BitSet.Test(5): true
// BitSet.popcount(5): 2, for interval [0,5]
// BitSet.Rank0(5): 1, equal popcount(5)-1
// BitSet.Test(5): true
// BitSet.popcount(5): 2, for interval [0,5]
// BitSet.Rank0(5): 1, equal popcount(5)-1
func (s *Array[T]) Get(i uint) (value T, ok bool) {
if s.Test(i) {
return s.Items[s.Rank0(i)], true
Expand Down

0 comments on commit e7edf58

Please sign in to comment.