Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
170050002-170050022-170050060-git
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MASHKARIA SATVIK MEHULBHAI
170050002-170050022-170050060-git
Commits
cfa633d4
Commit
cfa633d4
authored
Aug 26, 2018
by
TUSHAR AGARWAL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change implementation to insertion-sort
parent
feba6dea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
sorting.cpp
sorting.cpp
+16
-10
No files found.
sorting.cpp
View file @
cfa633d4
...
...
@@ -2,13 +2,19 @@
using
namespace
std
;
vector
<
int
>
sort_custom
(
vector
<
int
>
data
)
{
vector
<
int
>
arr
(
data
.
begin
(),
data
.
end
())
;
for
(
int
i
=
0
;
i
<
data
.
size
();
i
++
)
{
for
(
int
j
=
0
;
j
<
data
.
size
()
-
i
-
1
;
j
++
)
{
if
(
arr
[
j
]
>
arr
[
j
+
1
])
swap
(
arr
[
j
],
arr
[
j
+
1
])
;
}
}
return
arr
;
}
\ No newline at end of file
int
i
,
key
,
j
;
vector
<
int
>
ans
=
data
;
for
(
i
=
1
;
i
<
data
.
size
();
i
++
)
{
key
=
ans
[
i
];
j
=
i
-
1
;
while
(
j
>=
0
&&
ans
[
j
]
>
key
)
{
ans
[
j
+
1
]
=
ans
[
j
];
j
=
j
-
1
;
}
ans
[
j
+
1
]
=
key
;
}
return
ans
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment