SlideShare a Scribd company logo
1 of 2
Download to read offline
Need help on this- See screenshoots and bolded line below
public class PartitionInsertionapp {
public static void main(String[] args) {
final String BLANKS = " "; // A String of two blanks
int i, pivot, partition; // Array index
// The array to be sorted
int[] data = { 100, 80, 23, 50, 88, 70, 60, 90, 20, 72, 40, 8, 9 };
PartitionInsertionapp part = new PartitionInsertionapp();
Insertion is = new Insertion();
// Print the array before sorting:
System.out.println("Here is the entire original array:");
for (i = 0; i < data.length; i++)
System.out.print(data[i] + BLANKS);
System.out.println();
// Calculate the pivot using median-of-three partitioning
int left = 0;
int right = data.length - 1;
int center = (left + right) / 2;
// Sort left, center, and right elements and use center as pivot
if (data[center] < data[left]) {
swap(data, left, center);
}
if (data[right] < data[left]) {
swap(data, left, right);
}
if (data[right] < data[center]) {
swap(data, center, right);
}
pivot = data[center];
// Call the partition method to partition the array around the pivot
partition = part.partitionIt(0, data.length - 1, pivot, data);
// Display the pivot and the index where the upper partition begins
System.out.println("The pivot value is " + pivot + " and the upper partition starts at index " +
partition);
// Display the partitioned array
System.out.println("Here is the partitioned array:");
for (i = 0; i < data.length; i++)
System.out.print(data[i] + BLANKS);
System.out.println();
// Sort the lower partition using insertion sort
is.insertionSort(0, partition - 1, data);
// Display the array after sorting the lower partition
System.out.println("Here is the array after sorting the lower partition:");
for (i = 0; i < data.length; i++)
System.out.print(data[i] + BLANKS);
System.out.println();
// Sort the upper partition using insertion sort
is.insertionSort(partition, data.length - 1, data);
// Display the final sorted array
System.out.println("Here is the final sorted array:");
for (i = 0; i < data.length; i++)
System.out.print(data[i] + BLANKS);
System.out.println();
}
// Helper method to swap two elements in an array
private static void swap(int[] arr, int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
PartitionInsertionapp part = new PartitionInsertionapp (); Insertion is = new Insertion();
// Call the partition method to partition the array around the pivot partition = part.partitionIt (0,
data.length - 1, pivot, data);

More Related Content

Similar to Need help on this- See screenshoots and bolded line below public.pdf

Objectives In this lab you will review passing arrays to methods and.pdf
Objectives In this lab you will review passing arrays to methods and.pdfObjectives In this lab you will review passing arrays to methods and.pdf
Objectives In this lab you will review passing arrays to methods and.pdff3apparelsonline
 
Sorting_Algoritm-computee-scienceggn.pdf
Sorting_Algoritm-computee-scienceggn.pdfSorting_Algoritm-computee-scienceggn.pdf
Sorting_Algoritm-computee-scienceggn.pdfMohammed472103
 
Bubble sort, Selection sort SORTING .pptx
Bubble sort, Selection sort SORTING .pptxBubble sort, Selection sort SORTING .pptx
Bubble sort, Selection sort SORTING .pptxKalpana Mohan
 
Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdffashioncollection2
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxrajahchelsey
 
Sorting and Searching in Array.pptx
Sorting and Searching in Array.pptxSorting and Searching in Array.pptx
Sorting and Searching in Array.pptxMERIAMMADERA2
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfsiennatimbok52331
 
Write a program that will test a name) method no sorting routine from.docx
 Write a program that will test a name) method no sorting routine from.docx Write a program that will test a name) method no sorting routine from.docx
Write a program that will test a name) method no sorting routine from.docxajoy21
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfRohitkumarYadav80
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdfafgt2012
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfrajeshjangid1865
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdffeelinggifts
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arraystameemyousaf
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab ManualAkhilaaReddy
 
import java.util.Scanner;public class ArrayOperation {    inp.pdf
import java.util.Scanner;public class ArrayOperation {     inp.pdfimport java.util.Scanner;public class ArrayOperation {     inp.pdf
import java.util.Scanner;public class ArrayOperation {    inp.pdfangelsfashion1
 

Similar to Need help on this- See screenshoots and bolded line below public.pdf (20)

Objectives In this lab you will review passing arrays to methods and.pdf
Objectives In this lab you will review passing arrays to methods and.pdfObjectives In this lab you will review passing arrays to methods and.pdf
Objectives In this lab you will review passing arrays to methods and.pdf
 
Sorting_Algoritm-computee-scienceggn.pdf
Sorting_Algoritm-computee-scienceggn.pdfSorting_Algoritm-computee-scienceggn.pdf
Sorting_Algoritm-computee-scienceggn.pdf
 
Bubble sort, Selection sort SORTING .pptx
Bubble sort, Selection sort SORTING .pptxBubble sort, Selection sort SORTING .pptx
Bubble sort, Selection sort SORTING .pptx
 
Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdf
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docx
 
Sorting and Searching in Array.pptx
Sorting and Searching in Array.pptxSorting and Searching in Array.pptx
Sorting and Searching in Array.pptx
 
sorting and its types
sorting and its typessorting and its types
sorting and its types
 
07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 
Write a program that will test a name) method no sorting routine from.docx
 Write a program that will test a name) method no sorting routine from.docx Write a program that will test a name) method no sorting routine from.docx
Write a program that will test a name) method no sorting routine from.docx
 
JAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdfJAVA PRACTICE QUESTIONS v1.4.pdf
JAVA PRACTICE QUESTIONS v1.4.pdf
 
1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
 
05 queues
05 queues05 queues
05 queues
 
Java file
Java fileJava file
Java file
 
Java file
Java fileJava file
Java file
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdf
 
03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays03 stacks and_queues_using_arrays
03 stacks and_queues_using_arrays
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 
import java.util.Scanner;public class ArrayOperation {    inp.pdf
import java.util.Scanner;public class ArrayOperation {     inp.pdfimport java.util.Scanner;public class ArrayOperation {     inp.pdf
import java.util.Scanner;public class ArrayOperation {    inp.pdf
 

More from mkagarwalma

OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfOLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfmkagarwalma
 
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfNeed help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfmkagarwalma
 
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfObtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfmkagarwalma
 
Observation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfObservation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfmkagarwalma
 
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfNSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfmkagarwalma
 
Now that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfNow that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfmkagarwalma
 
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfNogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfNeed Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfmkagarwalma
 
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfNEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfmkagarwalma
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfmkagarwalma
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfmkagarwalma
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfmkagarwalma
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfmkagarwalma
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfmkagarwalma
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfmkagarwalma
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfmkagarwalma
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfmkagarwalma
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfmkagarwalma
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfmkagarwalma
 

More from mkagarwalma (20)

OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdfOLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
OLS modelinde, �rneklem b�y�kl�� (N) arttk�a var( b1 ) ne olur o .pdf
 
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdfNeed help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
Need help with this assignment Sara Lange, a charge nurse at Sunny N.pdf
 
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdfObtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
Obtuviste un contrato para producir 1000 widgets para el gobierno de.pdf
 
Observation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdfObservation First-year biology students at the University of Guyana.pdf
Observation First-year biology students at the University of Guyana.pdf
 
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdfNSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
NSZ Ltd. has equity of 15 Million and 10 debt of 20 Million. Cost o.pdf
 
Now that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdfNow that Hurd has more specifically located the source of the econom.pdf
Now that Hurd has more specifically located the source of the econom.pdf
 
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdfNogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
Nogalesin bir ksm Amerika Birleik Devletlerinde, Arizonada, dier .pdf
 
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdfNeed Answer on Urgent Base PleaseUnderstand how technology is used.pdf
Need Answer on Urgent Base PleaseUnderstand how technology is used.pdf
 
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdfNEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
NEED HELP ASAP!!! doLikeTweet This function is used to add a like .pdf
 
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdfNeed Answer on Urgent Base PleaseUnderstand the different types of.pdf
Need Answer on Urgent Base PleaseUnderstand the different types of.pdf
 
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdfNeed Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
Need Answer on Urgent Base PleaseUnderstand the drivers and influe.pdf
 
Nancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdfNancy had an accident that resulted in injuries to three people. The.pdf
Nancy had an accident that resulted in injuries to three people. The.pdf
 
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdfNakamura, CPA, has accepted an engagement to audit the financial sta.pdf
Nakamura, CPA, has accepted an engagement to audit the financial sta.pdf
 
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdfMountain Co. Ltd. is a small public company limited by shares formed.pdf
Mountain Co. Ltd. is a small public company limited by shares formed.pdf
 
More than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdfMore than a year into the COVID-19 pandemic, the world continues the.pdf
More than a year into the COVID-19 pandemic, the world continues the.pdf
 
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdfMonique is a life insurance agent in a small company in Ontario. Rec.pdf
Monique is a life insurance agent in a small company in Ontario. Rec.pdf
 
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdfMesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
Mesajnz �slup ve �slup a�sndan deerlendirdikten sonra aadakilerden h.pdf
 
Miguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdfMiguel contributed substantially appreciated property to the MR Part.pdf
Miguel contributed substantially appreciated property to the MR Part.pdf
 
Mia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdfMia will retire 10 years from now and wants to establish a fund toda.pdf
Mia will retire 10 years from now and wants to establish a fund toda.pdf
 
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdfMichael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
Michael McCain Tweeting on the Maple Leaf Foods AccountOn January.pdf
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

Need help on this- See screenshoots and bolded line below public.pdf

  • 1. Need help on this- See screenshoots and bolded line below public class PartitionInsertionapp { public static void main(String[] args) { final String BLANKS = " "; // A String of two blanks int i, pivot, partition; // Array index // The array to be sorted int[] data = { 100, 80, 23, 50, 88, 70, 60, 90, 20, 72, 40, 8, 9 }; PartitionInsertionapp part = new PartitionInsertionapp(); Insertion is = new Insertion(); // Print the array before sorting: System.out.println("Here is the entire original array:"); for (i = 0; i < data.length; i++) System.out.print(data[i] + BLANKS); System.out.println(); // Calculate the pivot using median-of-three partitioning int left = 0; int right = data.length - 1; int center = (left + right) / 2; // Sort left, center, and right elements and use center as pivot if (data[center] < data[left]) { swap(data, left, center); } if (data[right] < data[left]) { swap(data, left, right); } if (data[right] < data[center]) { swap(data, center, right); } pivot = data[center]; // Call the partition method to partition the array around the pivot partition = part.partitionIt(0, data.length - 1, pivot, data); // Display the pivot and the index where the upper partition begins System.out.println("The pivot value is " + pivot + " and the upper partition starts at index " + partition);
  • 2. // Display the partitioned array System.out.println("Here is the partitioned array:"); for (i = 0; i < data.length; i++) System.out.print(data[i] + BLANKS); System.out.println(); // Sort the lower partition using insertion sort is.insertionSort(0, partition - 1, data); // Display the array after sorting the lower partition System.out.println("Here is the array after sorting the lower partition:"); for (i = 0; i < data.length; i++) System.out.print(data[i] + BLANKS); System.out.println(); // Sort the upper partition using insertion sort is.insertionSort(partition, data.length - 1, data); // Display the final sorted array System.out.println("Here is the final sorted array:"); for (i = 0; i < data.length; i++) System.out.print(data[i] + BLANKS); System.out.println(); } // Helper method to swap two elements in an array private static void swap(int[] arr, int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } PartitionInsertionapp part = new PartitionInsertionapp (); Insertion is = new Insertion(); // Call the partition method to partition the array around the pivot partition = part.partitionIt (0, data.length - 1, pivot, data);