FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
AlgorithmVisualizer/algorithm/sorting/bubble/basic/code.js at master · IdleDust/AlgorithmVisualizer · GitHub
IdleDust
/
AlgorithmVisualizer
Public
forked from
algorithm-visualizer/algorithm-visualizer
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
AlgorithmVisualizer
/
algorithm
/
sorting
/
bubble
/
basic
/
code.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (23 loc) · 706 Bytes
Breadcrumbs
AlgorithmVisualizer
/
algorithm
/
sorting
/
bubble
/
basic
/
code.js
Copy path
File metadata and controls
23 lines (23 loc) · 706 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
logger
.
_print
(
'original array = ['
+
D
.
join
(
', '
)
+
']'
)
;
var
N
=
D
.
length
;
var
swapped
;
do
{
swapped
=
false
;
tracer
.
_select
(
N
-
1
)
.
_wait
(
)
;
for
(
var
i
=
1
;
i
<
N
;
i
++
)
{
tracer
.
_select
(
i
)
.
_wait
(
)
;
if
(
D
[
i
-
1
]
>
D
[
i
]
)
{
logger
.
_print
(
'swap '
+
D
[
i
-
1
]
+
' and '
+
D
[
i
]
)
;
var
temp
=
D
[
i
-
1
]
;
D
[
i
-
1
]
=
D
[
i
]
;
D
[
i
]
=
temp
;
swapped
=
true
;
tracer
.
_notify
(
i
-
1
,
D
[
i
-
1
]
)
.
_notify
(
i
,
D
[
i
]
)
.
_wait
(
)
;
tracer
.
_denotify
(
i
-
1
)
.
_denotify
(
i
)
;
}
tracer
.
_deselect
(
i
)
;
}
tracer
.
_deselect
(
N
-
1
)
;
N
--
;
}
while
(
swapped
)
;
logger
.
_print
(
'sorted array = ['
+
D
.
join
(
', '
)
+
']'
)
;
Back
|
FazBrowse Home
|
New Git URL