Skip to content

Commit a1ad2b0

Browse files
committed
Linear Search and Heap Sort
1 parent 4d6a23f commit a1ad2b0

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

Searching/LinearSearch.ipynb

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 2,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdin",
10+
"output_type": "stream",
11+
"text": [
12+
"Enter N 4\n",
13+
" 3\n",
14+
" 2\n",
15+
" 4\n",
16+
" 2\n",
17+
"Enter Key 2\n"
18+
]
19+
},
20+
{
21+
"name": "stdout",
22+
"output_type": "stream",
23+
"text": [
24+
"Found\n"
25+
]
26+
}
27+
],
28+
"source": [
29+
"def search(arr, x): \n",
30+
" \n",
31+
" for i in range(len(arr)): \n",
32+
" \n",
33+
" if arr[i] == x: \n",
34+
" return \"Found\" \n",
35+
" return \"Not Found\"\n",
36+
"\n",
37+
"arr = []\n",
38+
"n=int(input(\"Enter N\"))\n",
39+
"for x in range(n):\n",
40+
" arr.append(int(input()))\n",
41+
"x=int(input(\"Enter Key\"))\n",
42+
"print(search(arr,x))\n",
43+
" "
44+
]
45+
}
46+
],
47+
"metadata": {
48+
"kernelspec": {
49+
"display_name": "Python 3",
50+
"language": "python",
51+
"name": "python3"
52+
},
53+
"language_info": {
54+
"codemirror_mode": {
55+
"name": "ipython",
56+
"version": 3
57+
},
58+
"file_extension": ".py",
59+
"mimetype": "text/x-python",
60+
"name": "python",
61+
"nbconvert_exporter": "python",
62+
"pygments_lexer": "ipython3",
63+
"version": "3.7.4"
64+
}
65+
},
66+
"nbformat": 4,
67+
"nbformat_minor": 4
68+
}

Sorting/HeapSort.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": 4,
66
"metadata": {},
77
"outputs": [
88
{

0 commit comments

Comments
 (0)