bitvector Questions
8
Solved
Are there any well-known libraries in Java for sparse bit vectors?
(And are there guidelines for how sparse is useful to use them vs. java.util.BitSet?)
Inoculate asked 14/6, 2010 at 20:57
7
Solved
This is one of the questions in the Cracking the Coding Interview book by Gayle Laakmann McDowell:
Implement an algorithm to determine if a string has all unique characters. What if you can not ...
Senatorial asked 11/1, 2014 at 2:25
4
Solved
When thinking about this question I start to wondering if std::copy() and/or std::fill are specialized (I really mean optimized) for std::vector<bool>.
Is this required by C++ standard or, p...
Morna asked 14/9, 2012 at 23:18
12
Solved
I am confused about how a bit vector would work to do this (not too familiar with bit vectors). Here is the code given. Could someone please walk me through this?
public static boolean isUniqueCha...
Betjeman asked 4/2, 2012 at 15:10
1
Solved
Perl is pretty great at doing bit strings/vectors. Setting bits is as easy as
vec($bit_string, 123, 1) = 1;
Getting the count of set bits is lightning quick
$count = unpack("%32b*", $bit_strin...
7
Solved
In an assignment I am currently working on we need to work with bit vectors, but I am very unsure of how to do this in Python. They should be able to be from 4 bits to 20 bits. I have never worked ...
Nesmith asked 27/1, 2010 at 14:59
1
Solved
I'm having trouble understanding the bit logic in these two functions.
I don't know why we are checking for the condition (bitVector & mask) == 0.
Also, why do we OR the bitVector with the ma...
Goraud asked 30/11, 2016 at 6:45
1
Solved
I'm in the process of implementing a Bit Vector class as an exercise, however only knowing Rust for less than a week I run into trouble with the following code:
use std::cmp::Eq;
use std::ops::Bit...
3
I notice that vector is much slower than bool array when running the following code.
int main()
{
int count = 0;
int n = 1500000;
// slower with c++ vector<bool>
/*vector<bool> i...
Goings asked 29/4, 2016 at 7:52
6
Solved
Item 18 of Scott Meyers's book Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library says to avoid vector <bool> as it's not an STL container and it doesn't rea...
Barred asked 22/7, 2013 at 18:18
2
Solved
We have a class with many instances and run into memory problems. Therefore, we try to reduce the memory requirements of this class. One idea would be the following.
The class has many boolean in...
Afford asked 2/6, 2015 at 8:14
6
Solved
I have a collection of four bitvectors, for example:
b1 = 00001010
b2 = 10100111
b3 = 10010010
b4 = 10111110
I would like to get the masks of those bits that are set in exactly 0, 1, 2, 3 or 4 o...
Sunward asked 20/11, 2014 at 11:2
2
Solved
It's well known that std::vector<bool> does not satisfy the Standard's container requirements, mainly because the packed representation prevents T* x = &v[i] from returning a pointer to a...
Poplar asked 27/12, 2012 at 21:43
3
What is the difference between BitArray and BitVector 32 structure and what are the advantages of BitVector 32 structure over BitArray? Why is the BitVector 32 structure more efficient than BitArra...
Rockandroll asked 24/5, 2009 at 11:10
1
Currently using the run length encoding for encoding bit-vectors, and the current run time is
2log(i), where is the size of the run. Is there another way of doing it to bring it down to log(i)?
Th...
Erminna asked 13/10, 2012 at 22:21
3
Solved
Is there some reasonably fast code out there which can help me quickly search a large bitmap (a few megabytes) for runs of contiguous zero or one bits?
By "reasonably fast" I mean something that c...
2
Solved
I am working on a project where at a certain moment I need to show for one month which days are still available. There is a function that calculates which days are available. My colleagues said:"Oh...
Marcie asked 23/2, 2011 at 17:16
4
Solved
what's the best way to perform bitwise operations on vector<bool>?
as i understand, vector<bool> is a specialisation that uses one bit per boolean. I chose vector<bool> for memor...
Forgetmenot asked 29/10, 2010 at 3:24
2
Solved
Recently I heard about bit vectors, but i cant really find any useful info or tutorials on this topic. Can you please suggest a book or a quick tutorial on how to implement your own bit vecto...
2
Solved
A demo problem: Given two std::bitset<N>s, a and b check if any bit is set in both a and b.
There are two rather obvious solutions to this problem. This is bad because it creates a new tempo...
2
Solved
I am working on a project whose focus is the use of term rewriting to solve/simplify fixed-size bit-vector arithmetic problems, which is something useful to do as a prior step to some decision proc...
3
Solved
During a job interview I had some time ago I was asked to calculate the number of positive (i.e. set to "1") bits in a bitvector-structure (like unsigned integer or long). My solution was rather st...
Louque asked 20/11, 2011 at 10:42
1
In his answer to this question, John Feminella says:
It's possible to do this sub-quadratically if you get really fancy, by
representing each integer as a bit vector and performing a fast
Four...
1
© 2022 - 2024 — McMap. All rights reserved.