Questions tagged [bitset]

A collection of bits organized as an array of bits, in which each bit can be accessed separately. For C++ bitsets, prefer the tag std-bitset

A collection of bits organized as an array of bits, in which each bit can be accessed separately.

Usage guidelines:

Related tags, with slighly differences:

751 questions
0
votes
1 answer

Memory - Natural address boundary

Definition Structure padding is the process of aligning data members of the structure in accordance with the memory alignment rules specified by the processor. what is the memory alignment rule for Intel x86 processor? As per my understanding,…
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
5 answers

should I use a bit set or a vector? C++

I need to be able to store an array of binary numbers in c++ which will be passed through different methods and eventually outputted to file and terminal, What are the key differences between vectors and bit sets and which would be easiest and/or…
S.Mitchell
  • 91
  • 1
  • 2
  • 10
0
votes
1 answer

Byte and bits in computer science in C language

A language has 28 different letters in total. Each word in the language is composed of maximum 7 letters. You want to create a data-type to store a word of this language. You decide to store the word as an array of letters. How many bits will you…
0
votes
2 answers

Java: Extracting integers from a BitSet, each of which consists of specific bit number

If I have a Java BitSet with a length of 500 bits and, I know, it contains 100 integers, each of which is represented by 5 bits, how do I extract an array of these integers? Using some of the examples online, I came up with the following: static…
Igor Tupitsyn
  • 1,193
  • 3
  • 18
  • 45
0
votes
3 answers

DNA compression using bitset java

My assignment is to compress a DNA sequence. First enconding using a = 00 c = 01 g = 10 t = 11. I have to read in from a file the sequence and covert to my encoding. i know i have to use the bitSet class in java, but I'm having issues with how to…
l.bol
  • 7
  • 8
0
votes
1 answer

assigning values to a bitset from multiple int types

I am using a bitset that is created in the following way std::bitset<4> bitset; I wanted to know how I can assign a value to a bitset if I have ints with the values A=0,B=1,C=1,D=0 ? I have read that I could do this bitset.set(0,…
James Franco
  • 4,516
  • 10
  • 38
  • 80
0
votes
1 answer

Check the value of a byte In 16 bits BITSET

I have a binary code originated from bitse<16>binary_form (decimal_form). I want to check if the output code is 0010********1001 or 1001********0010 or 1001********0001. So i want to check the value of the first half byte and the value of the last…
Ahmed
  • 21
  • 6
0
votes
1 answer

Finding the majority of corresponding bits

I am trying to find an efficient way to get the majority of corresponding bit in a group of same sized integers. For example in the given integers: 12 => 1 1 0 0 9 => 1 0 0 1 9 => 1 0 0 1 3 => 0 0 1 1 the majority of bit (column wise) can be…
Atee
  • 11
  • 3
0
votes
0 answers

Storing big numbers in BitSet for easy lookup

I want to parse files and read numbers which are stored as Strings and build the data structure to store the numbers. Later in my application should provide method to check if a number is present in the list of numbers. These numbers will not fit…
ravthiru
  • 8,878
  • 2
  • 43
  • 52
0
votes
1 answer

Getting the length of a BiSet instance

I have a function which takes as argument a BiSet object. I have the following public static void(String [] args) { BitSet test = new BitSet(15); Store(test); } public void Store (BitSet a) { boolean [] temp = new boolean[a.length()](); …
user3841581
  • 2,637
  • 11
  • 47
  • 72
0
votes
1 answer

convert dynamic_bitset to std::bitset

I have an application where I need to dynamically allocate a bitset at runtime, so I'm forced to use boost::dynamic_bitset. However, for efficiency reasons, I'd like to ultimately use the data as std::bitset. How might I go about converting from…
audiFanatic
  • 2,296
  • 8
  • 40
  • 56
0
votes
1 answer

Quickly converting a string in the format of '0 1 1 0 1' into a bitset

How can I quickly convert a string of ones and zeroes separated by spaces into a bitset? There exists a constructor to initialize a bitset from a string not separated by spaces, one to initialize a bitset to all zeroes or ones, and one to initialize…
noɥʇʎԀʎzɐɹƆ
  • 9,967
  • 2
  • 50
  • 67
0
votes
8 answers

Java Collections automatic reallocation when size is reached

I'm not sure if I'm using the correct terms, but I am curious how it's determined how much to increase the size of a Collection in Java when it gets full? I've tried searching but I'm not really coming up with anything useful. So, if I have…
AHungerArtist
  • 9,332
  • 17
  • 73
  • 109
0
votes
0 answers

Maths, RNS residue number system, 2^n + 3 modulo way to compute. c++, bitset

I am looking for the way of computing modulo 2^n +3 from bigger number. The problem is that i don't know how to fast compute it and there is nothing on web. I got some help for modulo of 2^n -3 and it works by that way: Separate bits by the max…
0
votes
1 answer

BitSet LeftShift wrap around issue

I'm attempting to make a method that does a left shift with wrap around in Java using BitSet, but I cannot figure out how to get it to do the wrap around. Right now my method just removes the first bit and keeps the rest without adding that first…