diff options
| -rw-r--r-- | datastructures/bitset.cpp | 7 | ||||
| -rw-r--r-- | datastructures/datastructures.tex | 4 | ||||
| -rw-r--r-- | tcr.pdf | bin | 647987 -> 648767 bytes |
3 files changed, 11 insertions, 0 deletions
diff --git a/datastructures/bitset.cpp b/datastructures/bitset.cpp new file mode 100644 index 0000000..9f33a5b --- /dev/null +++ b/datastructures/bitset.cpp @@ -0,0 +1,7 @@ +bitset<10> bits(0b000010100); +cout << bits._Find_first() << endl; //2 +cout << bits._Find_next(2) << endl; //4 +cout << bits._Find_next(4) << endl; //10 bzw. N +bits[x] = 1; //not bits.set(x)! +bits[x] = 0; //not bits.reset(x)! +bits[x].flip(); //not bits.flip(x)! diff --git a/datastructures/datastructures.tex b/datastructures/datastructures.tex index 85ad693..578eaba 100644 --- a/datastructures/datastructures.tex +++ b/datastructures/datastructures.tex @@ -23,6 +23,10 @@ \method{find\_first}{erster Index in [l, r) $\geq$ x (erfordert max-combine)}{\log(n)} \sourcecode{datastructures/lazyPropagation.cpp} \end{algorithm} + +\begin{algorithm}{STL-Bitset} + \sourcecode{datastructures/bitset.cpp} +\end{algorithm} \clearpage \begin{algorithm}{Fenwick Tree} Binary files differ |
