-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhtml.txt
More file actions
52 lines (42 loc) · 1.26 KB
/
html.txt
File metadata and controls
52 lines (42 loc) · 1.26 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="container" id="container">
<div class="top_bar"><div class="counter">
<p>size of array : </p>
<button onclick="counterChange(-1)">-</button>
<span id="counterValue"></span>
<button onclick="counterChange(1)">+</button>
</div></div>
<!-- <div id="array_div" class="array_div"> -->
</div>
</div>
<script src="node.js"></script>
</body>
</html>
////////////////////////////bubble sort///////////////////
function swap(arr, first_Index, second_Index){
var temp = arr[first_Index];
arr[first_Index] = arr[second_Index];
arr[second_Index] = temp;
}
function bubble_Sort(arr){
var len = arr.length,
i, j, stop;
for (i=0; i < len; i++){
for (j=0, stop=len-i; j < stop; j++){
if (arr[j] > arr[j+1]){
swap(arr, j, j+1);
}
}
}
return arr;
}
console.log(bubble_Sort([3, 0, 2, 5, -1, 4, 1]));