Skip to content

Commit e42da04

Browse files
Merge pull request #753 from Monsieurvishal/master
Minor fix
2 parents f1c3214 + 57f7044 commit e42da04

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

Binary_search.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
def binarySearch(arr, l, r, x):
44
while l <= r:
55

6-
mid = l + (r - l) / 2; #extracting the middle element from the array
6+
mid = l + (r - l) / 2 #extracting the middle element from the array
7+
mid=int(mid) #it has to be integer
78

89
# Check if x is present at mid
910
if arr[mid] == x:

perfect_square.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

power_of_two.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Simple and efficient python program to check whether a number is series of power of two
2+
# Example:
3+
# Input:
4+
# 8
5+
# Output:
6+
# It comes in power series of 2
7+
a = int(input("Enter a number"))
8+
if a & (a - 1) == 0:
9+
print("It comes in power series of 2")
10+
else:
11+
print("It does not come in power series of 2")

0 commit comments

Comments
 (0)