you help us make a program tracing in paper? Thank you!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

can you help us make a program tracing in paper? Thank you! <3

 

*The attached images are the code and the output.

 

 

1.
2 public class tracing {
3
void sort(int arr[])
{
int n = arr.length;
for (int i = 1; i < n; ++i) {
int key = arr[i];
int j = i - 1;
40
5
7
8
9
10
11
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
12
13
14
15
16
17
18
}
19
static void printArray(int arr[])
{
200
21
22
int n = arr.length;
for (int i = 0; i < n; ++i)
System.out.print(arr[i] +
23
24
25
");
26
System.out.println();
}
27
28
29
30
public static void main(String args[])
310
32
33
34
35
36
37
38
39
int arr[] = { 12, 11, 13, 5, 6 };
tracing ob = new tracing();
ob.sort(arr);
printArray(arr);
40
41
42
Transcribed Image Text:1. 2 public class tracing { 3 void sort(int arr[]) { int n = arr.length; for (int i = 1; i < n; ++i) { int key = arr[i]; int j = i - 1; 40 5 7 8 9 10 11 while (j >= 0 && arr[j] > key) { arr[j + 1] = arr[j]; j = j - 1; } arr[j + 1] = key; 12 13 14 15 16 17 18 } 19 static void printArray(int arr[]) { 200 21 22 int n = arr.length; for (int i = 0; i < n; ++i) System.out.print(arr[i] + 23 24 25 "); 26 System.out.println(); } 27 28 29 30 public static void main(String args[]) 310 32 33 34 35 36 37 38 39 int arr[] = { 12, 11, 13, 5, 6 }; tracing ob = new tracing(); ob.sort(arr); printArray(arr); 40 41 42
2 Problems @ Javadoc 2 Declaration e Console
<terminated> tracing [Java Application] C:\Program Fil
5 6 11 12 13
Transcribed Image Text:2 Problems @ Javadoc 2 Declaration e Console <terminated> tracing [Java Application] C:\Program Fil 5 6 11 12 13
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education