Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core Java and Java 8
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lokesh Singh
Core Java and Java 8
Commits
78cb4256
Unverified
Commit
78cb4256
authored
3 years ago
by
Lokesh Singh
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Create bubble sort
parent
a639c633
Branches
Branches containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bubble sort
+19
-0
19 additions, 0 deletions
bubble sort
with
19 additions
and
0 deletions
bubble sort
0 → 100644
+
19
−
0
View file @
78cb4256
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void bubbleSort(int arr[], int n)
{
// Your code here
for(int i = 0; i<n-1; i++)
{
for(int j = 0; j<n-i-1; j++)
{
if(arr[j]>arr[j+1])
{
swap(&arr[j], &arr[j+1]);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment