SlideShare ist ein Scribd-Unternehmen logo
1 von 2
In java, Create an insertion sort algorithm that will accept 100 random values in an array, print
the sorted values in the console.
Solution
Answer:
The java code for an insertion sort algorithm that will accept 100 random values in an
array is given as below :
import java.util.*;
class InsertionSortApplication {
public static void main(String[] args) {
int A[] = new int[10];
allotArray(A);
System.out.println("The numbers previously sorting the array is : ");
arrayShow(A);
InsertionSortApplication(A);
System.out.println("The numbers after sorting the array is : ");
arrayShow(A);
}
private static void InsertionSortApplication(int[] arr) {
for (int i = 1; i < arr.length; i++) {
int readvalue = arr[i];
int j = i;
while (j > 0 && arr[j - 1] > readvalue) {
arr[j] = arr[j - 1];
j--;
}
arr[j] = readvalue;
}
}
public static void arrayShow(int[] B) {
System.out.println(Arrays.toString(B));
}
public static void allotArray(int[] B) {
for (int i = 0; i < B.length; i++) {
B[i] = (int) (Math.random() * 100);
}
}
}

Weitere ähnliche Inhalte

Ähnlich wie In java- Create an insertion sort algorithm that will accept 100 rando.docx

import java.util.ArrayList; import java.util.Scanner;public clas.pdf
import java.util.ArrayList; import java.util.Scanner;public clas.pdfimport java.util.ArrayList; import java.util.Scanner;public clas.pdf
import java.util.ArrayList; import java.util.Scanner;public clas.pdfshettysachin2005
 
Write a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfWrite a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfMALASADHNANI
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...MaruMengesha
 
Code javascript
Code javascriptCode javascript
Code javascriptRay Ray
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfoptokunal1
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple ProgramsUpender Upr
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdfrushabhshah600
 
ArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfANANDSALESINDIA105
 

Ähnlich wie In java- Create an insertion sort algorithm that will accept 100 rando.docx (10)

import java.util.ArrayList; import java.util.Scanner;public clas.pdf
import java.util.ArrayList; import java.util.Scanner;public clas.pdfimport java.util.ArrayList; import java.util.Scanner;public clas.pdf
import java.util.ArrayList; import java.util.Scanner;public clas.pdf
 
Write a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfWrite a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdf
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_15-Feb-2021_L6-...
 
Code javascript
Code javascriptCode javascript
Code javascript
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
6_Array.pptx
6_Array.pptx6_Array.pptx
6_Array.pptx
 
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
1sequences and sampling. Suppose we went to sample the x-axis from X.pdf
 
ArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdfArrayOperations.java import java.util.Arrays; import java.util.pdf
ArrayOperations.java import java.util.Arrays; import java.util.pdf
 

Mehr von carold12

In scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxIn scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxcarold12
 
In managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxIn managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxcarold12
 
in Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxin Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxcarold12
 
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxIn Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxcarold12
 
In Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxIn Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxcarold12
 
In its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxIn its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxcarold12
 
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxin thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxcarold12
 
In the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxIn the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxcarold12
 
In this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxIn this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxcarold12
 
In the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxIn the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxcarold12
 
In the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxIn the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxcarold12
 
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docxcarold12
 
3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docxcarold12
 
2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docxcarold12
 
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docxcarold12
 
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docxcarold12
 
25- Question Part Points Submissions Used 1.docx
25-       Question Part   Points   Submissions Used         1.docx25-       Question Part   Points   Submissions Used         1.docx
25- Question Part Points Submissions Used 1.docxcarold12
 
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docxcarold12
 

Mehr von carold12 (18)

In scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docxIn scilab Write a function named countDown that accepts a total time T.docx
In scilab Write a function named countDown that accepts a total time T.docx
 
In managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docxIn managing processes within organizations- what type(s) of methodolog.docx
In managing processes within organizations- what type(s) of methodolog.docx
 
in Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docxin Java For any element in keysList with a value greater than 100- pri.docx
in Java For any element in keysList with a value greater than 100- pri.docx
 
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docxIn Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
In Iate 2012- the Micklaus Corporation was formed- The corporate chart.docx
 
In Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docxIn Fall 1999- people in the financial community were making their fina.docx
In Fall 1999- people in the financial community were making their fina.docx
 
In its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docxIn its income statement for the year ended December 31- 2014- Gavin Co.docx
In its income statement for the year ended December 31- 2014- Gavin Co.docx
 
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docxin thin layer chromatography aspirin and caffeine were used as spot- u.docx
in thin layer chromatography aspirin and caffeine were used as spot- u.docx
 
In the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docxIn the USA are we currently in a period of recession or inflation- Exp.docx
In the USA are we currently in a period of recession or inflation- Exp.docx
 
In this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docxIn this Discussion- you will be able to familiarize yourself with the.docx
In this Discussion- you will be able to familiarize yourself with the.docx
 
In the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docxIn the US economy we have two sectors- private and public sectors- In.docx
In the US economy we have two sectors- private and public sectors- In.docx
 
In the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docxIn the traditional systems development life cycle- users- Are importan.docx
In the traditional systems development life cycle- users- Are importan.docx
 
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx3) IR Spec When it comes to IR analysis- one can choose different meth.docx
3) IR Spec When it comes to IR analysis- one can choose different meth.docx
 
3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx3) Distinguish among various methods to implement access controlsSolut.docx
3) Distinguish among various methods to implement access controlsSolut.docx
 
2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx2D-Array How is the address of an individual element of a 2-dimensiona.docx
2D-Array How is the address of an individual element of a 2-dimensiona.docx
 
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
28- How does the total vapor pressure (VP) and freezing point (FP) of.docx
 
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
27- The Bohr m odel of the hydrogen atom includes which of the followi.docx
 
25- Question Part Points Submissions Used 1.docx
25-       Question Part   Points   Submissions Used         1.docx25-       Question Part   Points   Submissions Used         1.docx
25- Question Part Points Submissions Used 1.docx
 
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
3- Suppose that U-S- government actively uses the fiscal policy to fig.docx
 

Kürzlich hochgeladen

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Kürzlich hochgeladen (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

In java- Create an insertion sort algorithm that will accept 100 rando.docx

  • 1. In java, Create an insertion sort algorithm that will accept 100 random values in an array, print the sorted values in the console. Solution Answer: The java code for an insertion sort algorithm that will accept 100 random values in an array is given as below : import java.util.*; class InsertionSortApplication { public static void main(String[] args) { int A[] = new int[10]; allotArray(A); System.out.println("The numbers previously sorting the array is : "); arrayShow(A); InsertionSortApplication(A); System.out.println("The numbers after sorting the array is : "); arrayShow(A); } private static void InsertionSortApplication(int[] arr) { for (int i = 1; i < arr.length; i++) { int readvalue = arr[i]; int j = i; while (j > 0 && arr[j - 1] > readvalue) { arr[j] = arr[j - 1]; j--; } arr[j] = readvalue;
  • 2. } } public static void arrayShow(int[] B) { System.out.println(Arrays.toString(B)); } public static void allotArray(int[] B) { for (int i = 0; i < B.length; i++) { B[i] = (int) (Math.random() * 100); } } }