Skip to main content
Code Review

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.

Filter by
Sorted by
Tagged with
2 votes
0 answers
66 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 ...
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 ...
1 vote
1 answer
117 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 ...
1 vote
1 answer
178 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 ...
3 votes
2 answers
344 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
87 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 ...
4 votes
3 answers
388 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 ...
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 ...
1 vote
4 answers
225 views

Permuting BitSet in Java

I have this tool for permuting bits in BitSets: com.stackexchange.codereview.util.BitPermutation.java: ...
coderodde's user avatar
  • 31.7k
0 votes
1 answer
168 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 (...
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 ...
3 votes
4 answers
124 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
516 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
973 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 ...
3 votes
1 answer
109 views

Programming Pearls -- Column 1: Sorting unique numbers with bitfield

I've implemented a simple program to sort an input of unique numbers given as decimals on a separate line. The idea is, since all numbers are unique, to use a (long) bitfield where a 1 on index n ...

15 30 50 per page
1
2 3 4 5

AltStyle によって変換されたページ (->オリジナル) /