-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbinarysearch.html
More file actions
108 lines (98 loc) · 5.39 KB
/
binarysearch.html
File metadata and controls
108 lines (98 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap" rel="stylesheet">
</head>
<body >
<div id="wizard">
<img id="wiz" src="wizard.png">
</div>
<div class="menu-bar">
<ul>
<li><img src="Amanda Wood.png" alt="" class="logo"></li>
<li><a href="index.html">HOME</a></li>
<li><a href="#">SEARCHING</a>
<div class="sub-menu-search">
<ul>
<li><a href="binarysearch.html">Binary Search</a></li>
<li><a href="linearsearch.html">Linear Search</a></li>
</ul>
</div>
</li>
<li><a href="#">SORTING</a>
<div class="sub-menu-sort">
<ul>
<li><a href="selectionsort.html">Selection Sort</a></li>
<li><a href="insertionsort.html">Insertion Sort</a></li>
<li><a href="bubblesort.html">Bubble Sort</a></li>
<li><a href="heapsort.html">Heap Sort</a></li>
</ul>
</div>
</li>
<li><a href="waiting.html">BACKTRACKING</a></li>
<li><a href="waiting.html">GRAPH TRAVERSAL</a></li>
<li><a href="about.html">ABOUT</a></li>
</ul>
</div>
<div class="codevis">
<div class="array">
<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<div id="4"></div>
<div id="5"></div>
<div id="6"></div>
<button onclick="binarysearch()" id="button">search</button>
<!-- <button onclick="selectionsort()" id="button1">sort</button> -->
<input type="text" placeholder="Enter the key to be searched" class="text" id="textbox"/>
</div>
<div class="codeslide" id="toggle">
<button class="sliderbtn" onclick="visibility() "><svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" ><path d="M18.75 36.3 16.3 33.85 26.2 23.95 16.3 14.05 18.75 11.6 31.1 23.95Z"/></svg></button>
<div class="psuedo">
<!-- <p> BinarySearch(int low,int high,int arr[],int key){</p>
<div id="col1"> while(low<=high){</div>
<div id="col2"> int mid=low+(high-low)/2</div>
<div id="col3"> if(key==arr[mid]){</div> -->
<!-- <div id="col4"> return mid; </div>
<p> }else{</p>
<div id="col5"> if(key>arr[mid]){</div> -->
<!-- <div id="col6"> low=mid+1;</div>
<p> }else{</p>
<div id="col7"> high=mid-1;</div>
<p> }</p>
<p> }</p>
<p > }</p>
<p> }</p> -->
<div id="col1"><pre><code><var>while</var>(low<=high)<br></code></pre></div>
<div id="col14"><pre><code>{</code></pre></div>
<div id="col2"><pre><code> int mid=low+(high-low)/2</code></pre></div>
<div id="col3"><pre><code> <var>if </var>(key==arr[mid]){ </code></pre></div>
<div id="col4"><pre><code> <var> return </var> mid;</code></pre></div>
<div><code><pre> }</pre></code></div>
<div id="col5"><pre><code> <var> else </var></code></pre></div>
<div><code><pre> {</pre></code></div>
<div id="col6"><pre><code> <var> if </var>(key>arr[mid])</code></pre></div>
<div><code><pre> {</pre></code></div>
<div id="col7"><pre><code> low=mid+1;</code></pre></div>
<div><code><pre> }</pre></code></div>
<div id="col8"><pre><code><var> else</var></code></pre></div>
<div><code><pre> {</pre></code></div>
<div id="col9"><pre><code> high=mid-1;</code></pre></div>
<div id="col10"><pre><code> }</code></pre></div>
<div id="col11"><pre><code> }</code></pre></div>
<div id="col12"><pre><code>}</code></pre></div>
</div>
</div>
</div>
</div>
<button class="new-sliderbtn" id="btn-toggle" onclick="visibility()"><svg xmlns="http://www.w3.org/2000/svg" height="48" width="48"><path d="M28.05 36 16 23.95 28.05 11.9 30.2 14.05 20.3 23.95 30.2 33.85Z"/></svg></button>
</div>
<script src="script.js"></script>
</body>
</html>