Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-KOUAGOU committed Jan 15, 2020
1 parent 23161b2 commit c148ce4
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions My_binary_search_from_scratch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Length of the current array: 10\n",
"Length of the current array: 4\n",
"Length of the current array: 12\n",
"Length of the current array: 6\n",
"Length of the current array: 2\n",
"Length of the current array: 1\n",
"\n",
"-1\n",
"\n",
"Length of the current array: 10\n",
"Length of the current array: 4\n",
"Length of the current array: 12\n",
"Length of the current array: 5\n",
"Length of the current array: 2\n",
"\n",
"8\n"
]
Expand Down Expand Up @@ -48,7 +49,8 @@
" center=(n-1)//2\n",
" return center, even\n",
" \n",
"def binary_search(input_array, value):\n",
"def binary_search(input_array_, value):\n",
" input_array=input_array_.copy()\n",
" index=-1\n",
" Search=True\n",
" center=binary_search_helper(input_array)[0]\n",
Expand All @@ -72,8 +74,8 @@
" Search=False\n",
" print()\n",
" return index\n",
"test_list = [1,3,9,11,15,19,29,171,527.7,1472]\n",
"test_val1 = 25\n",
"test_list = [1,3,9,11,15,19,29,171,527.7,1472,-9,78]\n",
"test_val1 = 17\n",
"test_val2 = 527.7\n",
"print(binary_search(test_list, test_val1))\n",
"print()\n",
Expand Down Expand Up @@ -105,9 +107,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit c148ce4

Please sign in to comment.