Skip to main content

Questions tagged [bitset]

A bit array (also known as bitmap, bitset, bit string, or bit vector) is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level parallelism in hardware to perform operations quickly. A typical bit array stores kw bits, where w is the number of bits in the unit of storage, such as a byte or word, and k is some nonnegative integer.

2 votes
2 answers
615 views

Three non-negative integer encoding techniques in Java

Intro In this post, I will present three (3) non-negative integer encoding techniques: Elias gamma coding Elias delta coding Golomb-Rice coding Code ...
coderodde's user avatar
  • 32.1k
2 votes
0 answers
71 views

A machine learning model for predicting bit strings in Java

I have this GitHub repository (BitPredictor.java). Basically, I tried to harness a machine learning model for predicting bit strings. I have implemented it to the best of my understanding and have ...
coderodde's user avatar
  • 32.1k
5 votes
3 answers
1k views

A Dynamic Bitset that I wrote and will use in my compression algortithm. This will be used to store the chars as bits from fstream

I have currently implemented an increment method. A method to add bytes. And a method to print out the bitset.   Main.cpp ...
Christian Phillips's user avatar
1 vote
1 answer
133 views

Bit vector in Java supporting O(1) rank() and O(log n) select() - follow-up

(This post is the continuation of Bit vector in Java supporting O(1) rank() and O(log n) select(). It resides here (version 1.0.1).) Basically, I have implemented everything harold suggested, except ...
coderodde's user avatar
  • 32.1k
1 vote
1 answer
197 views

Bit vector in Java supporting O(1) rank() and O(log n) select()

Introduction I have this GitHub repository (version 1.0.0.). It implements a rank(i) operation in \$\Theta(1)\$ time, and ...
coderodde's user avatar
  • 32.1k
3 votes
2 answers
357 views

Something like std::bitset in C

I am looking for opinion on this bitset implementation. It only has 4 functions and they are set - set a bit/clear - clear a bit/check - test a bit /zero - zero out all bits. There is another one as ...
sOmEonE 's user avatar
3 votes
1 answer
96 views

Python classes which can be used as arrays with any number of bits per index

https://github.com/speedrun-program/small_array/blob/main/small_array.py As a personal project, I wanted to try to make Snake Game in pygame where the grid can be arbitrarily large. I made these ...
my_stack_exchange_account's user avatar
4 votes
3 answers
406 views

Optimize memory and disk usage for sequences of n-bit values

Motivation: I am working with sequences of n-bit values coming from an ADC. I was initially using a std::vector<unsigned short> to store these values (12 bit ...
lobis's user avatar
  • 161
6 votes
2 answers
1k views

Huffman coding, using vector<bool>

This is my draft implementation of Huffman encoding & decoding. I'd appreciate any feedback, but have a couple specific questions: I wrote the code assuming vector represents each bool with a ...
Uri Raz's user avatar
  • 213
1 vote
4 answers
237 views

Permuting BitSet in Java

I have this tool for permuting bits in BitSets: com.stackexchange.codereview.util.BitPermutation.java: ...
coderodde's user avatar
  • 32.1k
0 votes
1 answer
176 views

Transformations on a game board represented as a bitset

I'm using a long as a bitset to represent a game board. If a field is set (X) the corresponding bit is set, if it's empty (...
martin's user avatar
  • 131
8 votes
2 answers
1k views

Representing Tic-Tac-Toe using a binary BitBoard

So I have been learning more about binary numbers lately, particularly in related to describing a gamestate. While perhaps chess is the most natural candidate I wanted to start of with something ...
N3buchadnezzar's user avatar
3 votes
4 answers
127 views

Move an unaligned bit-addressed range into another bitmap

Context I have an array of maximum-fixed-size, size, containers of items; these items are either pointers to objects or an index of the same array, (but no loops.) ...
Neil's user avatar
  • 1,112
2 votes
1 answer
527 views

Determine if a point is inside or ouside of an irregular shape on a bitmap [closed]

So this is my task: You are given an irregular shape on a bitmap. How do you determine if a point is inside or ousdie of the shape? We are allowed to assume that ...
NoobCoder's user avatar
  • 129
1 vote
2 answers
1k views

Individual bit access in C

Im not that good at C, so go easy on me, but I wanted to be able to have individual bit access in C without using a ton of functions to do bit manipulation on a ...
QuestionLimitGoBrrrrr's user avatar

15 30 50 per page
1
2 3 4 5