FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Data-Structures-Algorithms/Sorting/bubblesort.cpp at master · dracowane0/Data-Structures-Algorithms · GitHub
dracowane0
/
Data-Structures-Algorithms
Public
forked from
CodersForLife/Data-Structures-Algorithms
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
Data-Structures-Algorithms
/
Sorting
/
bubblesort.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (20 loc) · 444 Bytes
Breadcrumbs
Data-Structures-Algorithms
/
Sorting
/
bubblesort.cpp
Copy path
File metadata and controls
24 lines (20 loc) · 444 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
24
#
include
<
bits/stdc++.h
>
using
namespace
std
;
void
bubbleSort
(
int
a[],
int
s) {
for
(
int
i =
1
; i < s; i++) {
bool
swapped =
false
;
for
(
int
j =
0
; j < s - i; j++) {
if
(a[j] > a[j +
1
]) {
std::swap
(a[j], a[j +
1
]);
swapped =
true
;
}
}
if
(!swapped) {
return
;
}
}
}
void
main
(){
int
a[]={
13
,
32
,
43
,
14
,
25
};
bubbleSort
(a,
5
);
}
Back
|
FazBrowse Home
|
New Git URL