Skip to content

Commit 16905c2

Browse files
Question 67 Solution Added
1 parent 9297692 commit 16905c2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Status/Day_17.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,28 @@ print bin_search(li,12)
104104
```python
105105
#to be written
106106

107+
```
108+
----------------
109+
**Solution by AasaiAlangaram: Python 3**
110+
```python
111+
def binary_search_Ascending(array, target):
112+
lower = 0
113+
upper = len(array)
114+
print('Array Length:',upper)
115+
while lower < upper:
116+
x = (lower + upper) // 2
117+
print('Middle Value:',x)
118+
value = array[x]
119+
if target == value:
120+
return x
121+
elif target > value:
122+
lower = x
123+
elif target < value:
124+
upper = x
125+
126+
Array = [1,5,8,10,12,13,55,66,73,78,82,85,88,99]
127+
print('The Value Found at Index:',binary_search_Ascending(Array, 82))
128+
107129
```
108130
---------------------
109131

0 commit comments

Comments
 (0)