diff --git a/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html
new file mode 100644
index 000000000..f57fecb10
--- /dev/null
+++ b/d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html
@@ -0,0 +1,237 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+
+
+
+
+
[Next higher number with same number of set bits] (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/ ) implementation
+More...
+
#include <cassert>
+#include <iostream>
+
+
+
[Next higher number with same number of set bits] (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/ ) implementation
+
Given a number x, find next number with same number of 1 bits in it’s binary representation. For example, consider x = 12, whose binary representation is 1100 (excluding leading zeros on 32 bit machine). It contains two logic 1 bits. The next higher number with two logic 1 bits is 17 (100012).
+
A binary number consists of two digits. They are 0 & 1. Digit 1 is known as set bit in computer terms.
Author Kunal Nayak
+
+
+
◆ main()
+
+
+
+
+
+ int main
+ (
+ void
+ )
+
+
+
+
+
+
Main function.
+
Returns 0 on exit
+
100 {
+
+
102 return 0;
+
103 }
+
static void test()
Self-test implementations.
Definition next_higher_number_with_same_number_of_set_bits.cpp:76
+
+
+
+
+
+
+
◆ test()
+
+
+
+
+
+
+
+
+ static void test
+ (
+ )
+
+
+
+
+
+static
+
+
+
+
+
Self-test implementations.
+
Returns void
+
76 {
+
77
+
+
79
+
+
81
+
+
83
+
+
85
+
+
87
+
+
89
+
+
91
+
+
93
+
+
95 }
+
+
+
uint64_t next_higher_number(uint64_t x)
The main function implements checking the next number.
Definition next_higher_number_with_same_number_of_set_bits.cpp:31
+
+
+
+
+
+
+
+
+
+uint64_t next_higher_number (uint64_t x)
+ The main function implements checking the next number.
+
bool isPowerOfTwo (std ::int64_t n)
The main function implements check for power of 2.
@@ -163,6 +166,70 @@ Functions
+
+◆ next_higher_number()
+
+
+
+
+
+ uint64_t bit_manipulation::next_higher_number
+ (
+ uint64_t
+ x )
+
+
+
+
+
+
The main function implements checking the next number.
+
Parameters
+
+ x the number that will be calculated
+
+
+
+
Returns a number
+
32 {
+
33
+
34 uint64_t rightOne;
+
35 uint64_t nextHigherOneBit;
+
36 uint64_t rightOnesPattern;
+
37
+
38 uint64_t next = 0;
+
39
+
40 if (x)
+
41 {
+
42
+
43
+
44 rightOne = x & -(signed)x;
+
45
+
46
+
47
+
48 nextHigherOneBit = x + rightOne;
+
49
+
50
+
51
+
52
+
53 rightOnesPattern = x ^ nextHigherOneBit;
+
54
+
55
+
56 rightOnesPattern = (rightOnesPattern)/rightOne;
+
57
+
58
+
59 rightOnesPattern >>= 2;
+
60
+
61
+
62
+
63
+
64 next = nextHigherOneBit | rightOnesPattern;
+
65 }
+
66
+
67 return next;
+
68 }
+
+
+
diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map
new file mode 100644
index 000000000..a696ddbcd
--- /dev/null
+++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.map
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5 b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5
new file mode 100644
index 000000000..a00bf9ded
--- /dev/null
+++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.md5
@@ -0,0 +1 @@
+cee136b162973d12df81f1bb9920b6e9
\ No newline at end of file
diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg
new file mode 100644
index 000000000..4d2027fec
--- /dev/null
+++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl.svg
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp
+
+
+Node1
+
+
+bit_manipulation/next
+_higher_number_with_same
+_number_of_set_bits.cpp
+
+
+
+
+
+Node2
+
+
+cassert
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+
+
+
+Node3
+
+
+iostream
+
+
+
+
+
+Node1->Node3
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg
new file mode 100644
index 000000000..a67e2289f
--- /dev/null
+++ b/d9/deb/next__higher__number__with__same__number__of__set__bits_8cpp__incl_org.svg
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+bit_manipulation/next_higher_number_with_same_number_of_set_bits.cpp
+
+
+Node1
+
+
+bit_manipulation/next
+_higher_number_with_same
+_number_of_set_bits.cpp
+
+
+
+
+
+Node2
+
+
+cassert
+
+
+
+
+
+Node1->Node2
+
+
+
+
+
+
+
+
+Node3
+
+
+iostream
+
+
+
+
+
+Node1->Node3
+
+
+
+
+
+
+
+
diff --git a/dir_f3c4fbc4e901afa0a54d0623c5574aa7.html b/dir_f3c4fbc4e901afa0a54d0623c5574aa7.html
index e7f427f77..655bf9bd4 100644
--- a/dir_f3c4fbc4e901afa0a54d0623c5574aa7.html
+++ b/dir_f3c4fbc4e901afa0a54d0623c5574aa7.html
@@ -118,6 +118,9 @@ Files
hamming_distance.cpp
Returns the Hamming distance between two integers.
+ next_higher_number_with_same_number_of_set_bits.cpp
+ [Next higher number with same number of set bits] (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/ ) implementation
+
power_of_2.cpp
[Find whether a given number is power of 2] (https://www.geeksforgeeks.org/program-to-find-whether-a-given-number-is-power-of-2/ ) implementation
diff --git a/dir_f3c4fbc4e901afa0a54d0623c5574aa7.js b/dir_f3c4fbc4e901afa0a54d0623c5574aa7.js
index 78662bfae..dff96a6a7 100644
--- a/dir_f3c4fbc4e901afa0a54d0623c5574aa7.js
+++ b/dir_f3c4fbc4e901afa0a54d0623c5574aa7.js
@@ -5,6 +5,7 @@ var dir_f3c4fbc4e901afa0a54d0623c5574aa7 =
[ "count_of_trailing_ciphers_in_factorial_n.cpp", "da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp.html", "da/d50/count__of__trailing__ciphers__in__factorial__n_8cpp" ],
[ "find_non_repeating_number.cpp", "d6/d38/find__non__repeating__number_8cpp.html", "d6/d38/find__non__repeating__number_8cpp" ],
[ "hamming_distance.cpp", "d4/d48/hamming__distance_8cpp.html", "d4/d48/hamming__distance_8cpp" ],
+ [ "next_higher_number_with_same_number_of_set_bits.cpp", "d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp.html", "d5/d1e/next__higher__number__with__same__number__of__set__bits_8cpp" ],
[ "power_of_2.cpp", "dc/d6d/power__of__2_8cpp.html", "dc/d6d/power__of__2_8cpp" ],
[ "set_kth_bit.cpp", "d5/db5/set__kth__bit_8cpp.html", "d5/db5/set__kth__bit_8cpp" ],
[ "travelling_salesman_using_bit_manipulation.cpp", "d4/d8f/travelling__salesman__using__bit__manipulation_8cpp.html", "d4/d8f/travelling__salesman__using__bit__manipulation_8cpp" ]
diff --git a/files.html b/files.html
index 94d6edd45..7b48d6e97 100644
--- a/files.html
+++ b/files.html
@@ -122,9 +122,10 @@ solve-a-rat-in-a-maze-c-java-pytho/" target="_blank">Rat in a Maze algorithm
count_of_trailing_ciphers_in_factorial_n.cpp Count the number of ciphers in n! implementation
find_non_repeating_number.cpp Implementation to find the non repeating integer in an array of repeating integers. Single Number
hamming_distance.cpp Returns the Hamming distance between two integers
- power_of_2.cpp [Find whether a given number is power of 2] (https://www.geeksforgeeks.org/program-to-find-whether-a-given-number-is-power-of-2/ ) implementation
- set_kth_bit.cpp Implementation to [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/ ) in an integer
- travelling_salesman_using_bit_manipulation.cpp Implementation to [Travelling Salesman problem using bit-masking] (https://www.geeksforgeeks.org/travelling-salesman-problem-set-1/ )
+ next_higher_number_with_same_number_of_set_bits.cpp [Next higher number with same number of set bits] (https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/ ) implementation
+ power_of_2.cpp [Find whether a given number is power of 2] (https://www.geeksforgeeks.org/program-to-find-whether-a-given-number-is-power-of-2/ ) implementation
+ set_kth_bit.cpp Implementation to [From the right, set the Kth bit in the binary representation of N] (https://practice.geeksforgeeks.org/problems/set-kth-bit3724/1/ ) in an integer
+ travelling_salesman_using_bit_manipulation.cpp Implementation to [Travelling Salesman problem using bit-masking] (https://www.geeksforgeeks.org/travelling-salesman-problem-set-1/ )
► ciphers
a1z26_cipher.cpp Implementation of the A1Z26 cipher
atbash_cipher.cpp Atbash Cipher implementation
diff --git a/globals_func_m.html b/globals_func_m.html
index c11581063..3c982ac27 100644
--- a/globals_func_m.html
+++ b/globals_func_m.html
@@ -100,7 +100,7 @@ $(document).ready(function(){initNavTree('globals_func_m.html',''); initResizabl
Here is a list of all documented functions with links to the documentation:
- m -