Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gitlab-inlab
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
hackslash
gitlab-inlab
Commits
78937d80
Commit
78937d80
authored
Aug 10, 2017
by
KONDETI TANMAYEE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload new file
parent
297723e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
lab3/average.cpp
lab3/average.cpp
+28
-0
No files found.
lab3/average.cpp
0 → 100644
View file @
78937d80
#include<iostream>
#include<stdlib.h>
using
namespace
std
;
void
insertionSort
(
int
*
a
,
int
n
)
{
for
(
int
i
=
0
;
i
<
n
-
1
;
i
++
)
{
for
(
int
j
=
i
+
1
;
j
<
n
;
j
++
)
{
if
(
a
[
i
]
>
a
[
j
])
swap
(
a
[
i
],
a
[
j
]);
}
}
}
int
main
()
{
int
a
[
1000
],
step
=
10
;
double
clocksPerMillis
=
double
(
CLOCKS_PER_SEC
)
/
1000
;
for
(
int
n
=
0
;
n
<=
1000
;
n
+=
step
)
{
int
rep
;
clock_t
startTime
=
clock
();
do
{
rep
++
;
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
a
[
i
]
=
rand
()
%
n
+
1
;
}
insertionSort
(
a
,
n
);
}
while
(
rep
<=
20
);
double
elapsedMillis
=
(
clock
()
-
startTime
)
/
clocksPerMillis
;
cout
<<
n
<<
'\t'
<<
elapsedMillis
/
rep
<<
endl
;
if
(
n
==
100
)
step
=
100
;
}
}
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