From de64dfc84c054ba2a69b54b6fbb52b2e8a9a3677 Mon Sep 17 00:00:00 2001 From: Adarsh Gautam Date: Sat, 24 Oct 2020 10:45:46 +0530 Subject: [PATCH] BitMasking Algorithm --- BitMasking | 47 +++++++++++++++++++++++++++++++++++++++++++++++ InsertionSort.cpp | 0 Linkedlist | 0 MergeSort.cpp | 0 N-Queen.cpp | 0 Prims.cpp | 0 QuickSort.cpp | 0 README.md | 0 SelectionSort.cpp | 0 9 files changed, 47 insertions(+) create mode 100755 BitMasking mode change 100644 => 100755 InsertionSort.cpp mode change 100644 => 100755 Linkedlist mode change 100644 => 100755 MergeSort.cpp mode change 100644 => 100755 N-Queen.cpp mode change 100644 => 100755 Prims.cpp mode change 100644 => 100755 QuickSort.cpp mode change 100644 => 100755 README.md mode change 100644 => 100755 SelectionSort.cpp diff --git a/BitMasking b/BitMasking new file mode 100755 index 0000000..55f1e18 --- /dev/null +++ b/BitMasking @@ -0,0 +1,47 @@ +https://www.geeksforgeeks.org/bits-manipulation-important-tactics/ + +Theory from tutorials point +Program 1: + +#include +#include + +using namespace std; + +int main(void) { + + bitset<4> b; + + cout << "Before set operation b = " << b << endl; + + b.set(); + + cout << "After set operation b = " << b << endl; + + return 0; +} +Let us compile and run the above program, this will produce the following result − + +output: +Before set operation b = 0000 +After set operation b = 1111 + + +Program2: +#include +#include + +using namespace std; + +int main(void) { + + bitset<4> b("1110"); + + cout << "In bitset " << b << ", " << b.count() << " bits are set." << endl; + + return 0; +} +Let us compile and run the above program, this will produce the following result − + +output: +In bitset 1110, 3 bits are set. diff --git a/InsertionSort.cpp b/InsertionSort.cpp old mode 100644 new mode 100755 diff --git a/Linkedlist b/Linkedlist old mode 100644 new mode 100755 diff --git a/MergeSort.cpp b/MergeSort.cpp old mode 100644 new mode 100755 diff --git a/N-Queen.cpp b/N-Queen.cpp old mode 100644 new mode 100755 diff --git a/Prims.cpp b/Prims.cpp old mode 100644 new mode 100755 diff --git a/QuickSort.cpp b/QuickSort.cpp old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SelectionSort.cpp b/SelectionSort.cpp old mode 100644 new mode 100755