PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my alerts
my settings
my profile
Public Pastes
Untitled
1 sec ago
Untitled
1 sec ago
Untitled
6 sec ago
صور نانسي ...
16 sec ago
Untitled
10 sec ago
Untitled
11 sec ago
Untitled
13 sec ago
Untitled
15 sec ago
Untitled
By: a guest on Feb 12th, 2012 | syntax:
None
| size: 0.33 KB | hits: 37 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
void insertInOrder(int[] a, int n, int newValue)
{
// Shift values to the right by one until you find the
// place to insert:
int k = n; // Start at the end
while (k > 0 && a[k-1] > newValue)
{
a[k] = a[k-1];
k--;
}
a[k] = newValue;
}
create a
new version
of this paste
RAW Paste Data
void insertInOrder(int[] a, int n, int newValue) { // Shift values to the right by one until you find the // place to insert: int k = n; // Start at the end while (k > 0 && a[k-1] > newValue) { a[k] = a[k-1]; k--; } a[k] = newValue; }