SlideShare a Scribd company logo
Please I want a detailed complete answers for each part.Then make sure you provide clear
picture(s) of soultions that I can read. Try making all numbers and letters clrearly readable easy
to recognize. You also can type it which I prefer so I can copy all later, paste them in Microsoft
Word to enlarge & edit if needed. Thanks for all :) 1. Sort the record 9, 34,17,6, 15, 3:8 by using
the following sorting techniques, respectively, 1) QuickSort with a good call for the first pivot
value 2) MergeSort 3) HeapSort (including the details for building 1st Heap, and all 6 heaps) 4)
Binsort (Choose Bins as: 0-9; 10-19, 20-29, 30-39) 5) Radix sort The details of each sorting step
should be ncluded The details of each sorting step should be included
Solution
QuickSort:
QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the
given array around the picked pivot. There are many different versions of quickSort that pick
pivot in different ways.
The key process in quickSort is partition(). Target of partitions is, given an array and an element
x of array as pivot, put x at its correct position in sorted array and put all smaller elements
(smaller than x) before x, and put all greater elements (greater than x) after x. All this should be
done in linear time
elements:
9 34 17 6 15 38
9 34 17 6 15 38
9 34 17 6 15 38
9 34 17 6 15 38
9 34 17 6 15 38
9 34 17 6 15 38
9 6 17 34 15 38
swapping 15 and 34
15 is choosing pivot
compare with i-1 value
Program
def quickSort(alist):
quickSortHelper(alist,0,len(alist)-1)
def quickSortHelper(alist,first,last):
if first= pivotvalue and rightmark >= leftmark:
rightmark = rightmark -1
if rightmark < leftmark:
done = True
else:
temp = alist[leftmark]
alist[leftmark] = alist[rightmark]
alist[rightmark] = temp
temp = alist[first]
alist[first] = alist[rightmark]
alist[rightmark] = temp
return rightmark
alist = [9,34,17,6,15,8]
quickSort(alist)
print(alist)
Mergesort:
MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for
the two halves and then merges the two sorted halves. The merge() function is used for merging
two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are
sorted and merges the two sorted sub-arrays into one. See following C implementation for
details.
9 34 17 6 15 38
divide two parts
9 34 17 6 15 38
divide separate parts
9 34 17 6 15 38
compare two elements in each section
9 34 17 6 15 38
compare section to section
9 17 34 6 15 38
compare two section
6 9 15 17 34 38
Merges two subarrays of arr[].
# First subarray is arr[l..m]
# Second subarray is arr[m+1..r]
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r- m
# create temp arrays
L = [0] * (n1)
R = [0] * (n2)
# Copy data to temp arrays L[] and R[]
for i in range(0 , n1):
L[i] = arr[l + i]
for j in range(0 , n2):
R[j] = arr[m + 1 + j]
# Merge the temp arrays back into arr[l..r]
i = 0 # Initial index of first subarray
j = 0 # Initial index of second subarray
k = l # Initial index of merged subarray
while i < n1 and j < n2 :
if L[i] <= R[j]:
arr[k] = L[i]
i += 1
else:
arr[k] = R[j]
j += 1
k += 1
# Copy the remaining elements of L[], if there
# are any
while i < n1:
arr[k] = L[i]
i += 1
k += 1
# Copy the remaining elements of R[], if there
# are any
while j < n2:
arr[k] = R[j]
j += 1
k += 1
# l is for left index and r is right index of the
# sub-array of arr to be sorted
def mergeSort(arr,l,r):
if l < r:
# Same as (l+r)/2, but avoids overflow for
# large l and h
m = (l+(r-1))/2
# Sort first and second halves
mergeSort(arr, l, m)
mergeSort(arr, m+1, r)
merge(arr, l, m, r)
Output:
Heapsort:
def heapsort( aList ):
# convert aList to heap
length = len( aList ) - 1
leastParent = length / 2
for i in range ( leastParent, -1, -1 ):
moveDown( aList, i, length )
# flatten heap into sorted array
for i in range ( length, 0, -1 ):
if aList[0] > aList[i]:
swap( aList, 0, i )
moveDown( aList, 0, i - 1 )
def moveDown( aList, first, last ):
largest = 2 * first + 1
while largest <= last:
# right child exists and is larger than left child
if ( largest < last ) and ( aList[largest] < aList[largest + 1] ):
largest += 1
# right child is larger than parent
if aList[largest] > aList[first]:
swap( aList, largest, first )
# move down to largest child
first = largest;
largest = 2 * first + 1
else:
return # force exit
def swap( A, x, y ):
tmp = A[x]
A[x] = A[y]
A[y] = tmp
BinSort:
Time Complexity of

More Related Content

Similar to Please I want a detailed complete answers for each part.Then make.pdf

Merge sort
Merge sortMerge sort
Merge sort
Md. Rakib Trofder
 
Python programming for Beginners - II
Python programming for Beginners - IIPython programming for Beginners - II
Python programming for Beginners - II
NEEVEE Technologies
 
(Ai lisp)
(Ai lisp)(Ai lisp)
(Ai lisp)
Ravi Rao
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
DataminingTools Inc
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
LISP Content
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
RenalthaPujaBagaskar
 
14-sorting (3).ppt
14-sorting (3).ppt14-sorting (3).ppt
14-sorting (3).ppt
yasser3omr
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
SushantRaj25
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
KamalAlbashiri
 
Lecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structureLecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structure
Nurjahan Nipa
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
wahab khan
 
Data Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx soData Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx so
Salma368452
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
Manchireddy Reddy
 
Microsoft Word Practice Exercise Set 2
Microsoft Word   Practice Exercise Set 2Microsoft Word   Practice Exercise Set 2
Microsoft Word Practice Exercise Set 2rampan
 
R tutorial for a windows environment
R tutorial for a windows environmentR tutorial for a windows environment
R tutorial for a windows environment
Yogendra Chaubey
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
mydrynan
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 

Similar to Please I want a detailed complete answers for each part.Then make.pdf (20)

Merge sort
Merge sortMerge sort
Merge sort
 
Python programming for Beginners - II
Python programming for Beginners - IIPython programming for Beginners - II
Python programming for Beginners - II
 
(Ai lisp)
(Ai lisp)(Ai lisp)
(Ai lisp)
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
14-sorting (3).ppt
14-sorting (3).ppt14-sorting (3).ppt
14-sorting (3).ppt
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
14-sorting.ppt
14-sorting.ppt14-sorting.ppt
14-sorting.ppt
 
Lecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structureLecture 02: Preliminaries of Data structure
Lecture 02: Preliminaries of Data structure
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
 
Data Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx soData Structure Marge sort Group 5 pptx so
Data Structure Marge sort Group 5 pptx so
 
Learn Matlab
Learn MatlabLearn Matlab
Learn Matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
Microsoft Word Practice Exercise Set 2
Microsoft Word   Practice Exercise Set 2Microsoft Word   Practice Exercise Set 2
Microsoft Word Practice Exercise Set 2
 
R tutorial for a windows environment
R tutorial for a windows environmentR tutorial for a windows environment
R tutorial for a windows environment
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 

More from siennatimbok52331

SKIPPED hich level of biological orga.pdf
SKIPPED hich level of biological orga.pdfSKIPPED hich level of biological orga.pdf
SKIPPED hich level of biological orga.pdf
siennatimbok52331
 
please explain transcription and translationSolutionAnsTran.pdf
please explain transcription and translationSolutionAnsTran.pdfplease explain transcription and translationSolutionAnsTran.pdf
please explain transcription and translationSolutionAnsTran.pdf
siennatimbok52331
 
Please answer all of #5 After the completion of S phase, F.2F functi.pdf
Please answer all of #5 After the completion of S phase, F.2F functi.pdfPlease answer all of #5 After the completion of S phase, F.2F functi.pdf
Please answer all of #5 After the completion of S phase, F.2F functi.pdf
siennatimbok52331
 
Consider the security of a computer belonging to a criminal organiza.pdf
Consider the security of a computer belonging to a criminal organiza.pdfConsider the security of a computer belonging to a criminal organiza.pdf
Consider the security of a computer belonging to a criminal organiza.pdf
siennatimbok52331
 
Match the bones in column A with the characteristics in column B. Pla.pdf
Match the bones in column A with the characteristics in column B. Pla.pdfMatch the bones in column A with the characteristics in column B. Pla.pdf
Match the bones in column A with the characteristics in column B. Pla.pdf
siennatimbok52331
 
Is the mean age at which American children learn to walk less than 15.pdf
Is the mean age at which American children learn to walk less than 15.pdfIs the mean age at which American children learn to walk less than 15.pdf
Is the mean age at which American children learn to walk less than 15.pdf
siennatimbok52331
 
Introduction to material science What kind of analyses methods will .pdf
Introduction to material science What kind of analyses methods will .pdfIntroduction to material science What kind of analyses methods will .pdf
Introduction to material science What kind of analyses methods will .pdf
siennatimbok52331
 
Is this a Cohort Study What would be an example of a Cohort study.pdf
Is this a Cohort Study What would be an example of a Cohort study.pdfIs this a Cohort Study What would be an example of a Cohort study.pdf
Is this a Cohort Study What would be an example of a Cohort study.pdf
siennatimbok52331
 
Function of medium veins Function of medium veinsSolution.pdf
Function of medium veins Function of medium veinsSolution.pdfFunction of medium veins Function of medium veinsSolution.pdf
Function of medium veins Function of medium veinsSolution.pdf
siennatimbok52331
 
Explain the four factors of production. In what way are they rela.pdf
Explain the four factors of production. In what way are they rela.pdfExplain the four factors of production. In what way are they rela.pdf
Explain the four factors of production. In what way are they rela.pdf
siennatimbok52331
 
Discrete Math problem37 students use a variety of forms of transp.pdf
Discrete Math problem37 students use a variety of forms of transp.pdfDiscrete Math problem37 students use a variety of forms of transp.pdf
Discrete Math problem37 students use a variety of forms of transp.pdf
siennatimbok52331
 
Discuss the involvement of interest groups in the political circumst.pdf
Discuss the involvement of interest groups in the political circumst.pdfDiscuss the involvement of interest groups in the political circumst.pdf
Discuss the involvement of interest groups in the political circumst.pdf
siennatimbok52331
 
Determine which of these statements describing the cytochrome P450 f.pdf
Determine which of these statements describing the cytochrome P450 f.pdfDetermine which of these statements describing the cytochrome P450 f.pdf
Determine which of these statements describing the cytochrome P450 f.pdf
siennatimbok52331
 
Describe the difference between the lytic cycle and lysogeny when bac.pdf
Describe the difference between the lytic cycle and lysogeny when bac.pdfDescribe the difference between the lytic cycle and lysogeny when bac.pdf
Describe the difference between the lytic cycle and lysogeny when bac.pdf
siennatimbok52331
 
Describe some of the different ways members of Congress can represen.pdf
Describe some of the different ways members of Congress can represen.pdfDescribe some of the different ways members of Congress can represen.pdf
Describe some of the different ways members of Congress can represen.pdf
siennatimbok52331
 
Company B Company C None of them satisfy the requirements. Question9 .pdf
Company B Company C None of them satisfy the requirements. Question9 .pdfCompany B Company C None of them satisfy the requirements. Question9 .pdf
Company B Company C None of them satisfy the requirements. Question9 .pdf
siennatimbok52331
 
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdfCase 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
siennatimbok52331
 
A Correlation of zero means that (what)SolutionA value of zer.pdf
A Correlation of zero means that (what)SolutionA value of zer.pdfA Correlation of zero means that (what)SolutionA value of zer.pdf
A Correlation of zero means that (what)SolutionA value of zer.pdf
siennatimbok52331
 
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdfA bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
siennatimbok52331
 
You cut your finger, and your skin cells divide to heal up the wou.pdf
You cut your finger, and your skin cells divide to heal up the wou.pdfYou cut your finger, and your skin cells divide to heal up the wou.pdf
You cut your finger, and your skin cells divide to heal up the wou.pdf
siennatimbok52331
 

More from siennatimbok52331 (20)

SKIPPED hich level of biological orga.pdf
SKIPPED hich level of biological orga.pdfSKIPPED hich level of biological orga.pdf
SKIPPED hich level of biological orga.pdf
 
please explain transcription and translationSolutionAnsTran.pdf
please explain transcription and translationSolutionAnsTran.pdfplease explain transcription and translationSolutionAnsTran.pdf
please explain transcription and translationSolutionAnsTran.pdf
 
Please answer all of #5 After the completion of S phase, F.2F functi.pdf
Please answer all of #5 After the completion of S phase, F.2F functi.pdfPlease answer all of #5 After the completion of S phase, F.2F functi.pdf
Please answer all of #5 After the completion of S phase, F.2F functi.pdf
 
Consider the security of a computer belonging to a criminal organiza.pdf
Consider the security of a computer belonging to a criminal organiza.pdfConsider the security of a computer belonging to a criminal organiza.pdf
Consider the security of a computer belonging to a criminal organiza.pdf
 
Match the bones in column A with the characteristics in column B. Pla.pdf
Match the bones in column A with the characteristics in column B. Pla.pdfMatch the bones in column A with the characteristics in column B. Pla.pdf
Match the bones in column A with the characteristics in column B. Pla.pdf
 
Is the mean age at which American children learn to walk less than 15.pdf
Is the mean age at which American children learn to walk less than 15.pdfIs the mean age at which American children learn to walk less than 15.pdf
Is the mean age at which American children learn to walk less than 15.pdf
 
Introduction to material science What kind of analyses methods will .pdf
Introduction to material science What kind of analyses methods will .pdfIntroduction to material science What kind of analyses methods will .pdf
Introduction to material science What kind of analyses methods will .pdf
 
Is this a Cohort Study What would be an example of a Cohort study.pdf
Is this a Cohort Study What would be an example of a Cohort study.pdfIs this a Cohort Study What would be an example of a Cohort study.pdf
Is this a Cohort Study What would be an example of a Cohort study.pdf
 
Function of medium veins Function of medium veinsSolution.pdf
Function of medium veins Function of medium veinsSolution.pdfFunction of medium veins Function of medium veinsSolution.pdf
Function of medium veins Function of medium veinsSolution.pdf
 
Explain the four factors of production. In what way are they rela.pdf
Explain the four factors of production. In what way are they rela.pdfExplain the four factors of production. In what way are they rela.pdf
Explain the four factors of production. In what way are they rela.pdf
 
Discrete Math problem37 students use a variety of forms of transp.pdf
Discrete Math problem37 students use a variety of forms of transp.pdfDiscrete Math problem37 students use a variety of forms of transp.pdf
Discrete Math problem37 students use a variety of forms of transp.pdf
 
Discuss the involvement of interest groups in the political circumst.pdf
Discuss the involvement of interest groups in the political circumst.pdfDiscuss the involvement of interest groups in the political circumst.pdf
Discuss the involvement of interest groups in the political circumst.pdf
 
Determine which of these statements describing the cytochrome P450 f.pdf
Determine which of these statements describing the cytochrome P450 f.pdfDetermine which of these statements describing the cytochrome P450 f.pdf
Determine which of these statements describing the cytochrome P450 f.pdf
 
Describe the difference between the lytic cycle and lysogeny when bac.pdf
Describe the difference between the lytic cycle and lysogeny when bac.pdfDescribe the difference between the lytic cycle and lysogeny when bac.pdf
Describe the difference between the lytic cycle and lysogeny when bac.pdf
 
Describe some of the different ways members of Congress can represen.pdf
Describe some of the different ways members of Congress can represen.pdfDescribe some of the different ways members of Congress can represen.pdf
Describe some of the different ways members of Congress can represen.pdf
 
Company B Company C None of them satisfy the requirements. Question9 .pdf
Company B Company C None of them satisfy the requirements. Question9 .pdfCompany B Company C None of them satisfy the requirements. Question9 .pdf
Company B Company C None of them satisfy the requirements. Question9 .pdf
 
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdfCase 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
Case 2S [symptoms] 10 month male presents to pediatrician’s offic.pdf
 
A Correlation of zero means that (what)SolutionA value of zer.pdf
A Correlation of zero means that (what)SolutionA value of zer.pdfA Correlation of zero means that (what)SolutionA value of zer.pdf
A Correlation of zero means that (what)SolutionA value of zer.pdf
 
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdfA bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
A bank had 5024 depositers, with an avevrage account of $512. Assume.pdf
 
You cut your finger, and your skin cells divide to heal up the wou.pdf
You cut your finger, and your skin cells divide to heal up the wou.pdfYou cut your finger, and your skin cells divide to heal up the wou.pdf
You cut your finger, and your skin cells divide to heal up the wou.pdf
 

Recently uploaded

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 

Recently uploaded (20)

Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 

Please I want a detailed complete answers for each part.Then make.pdf

  • 1. Please I want a detailed complete answers for each part.Then make sure you provide clear picture(s) of soultions that I can read. Try making all numbers and letters clrearly readable easy to recognize. You also can type it which I prefer so I can copy all later, paste them in Microsoft Word to enlarge & edit if needed. Thanks for all :) 1. Sort the record 9, 34,17,6, 15, 3:8 by using the following sorting techniques, respectively, 1) QuickSort with a good call for the first pivot value 2) MergeSort 3) HeapSort (including the details for building 1st Heap, and all 6 heaps) 4) Binsort (Choose Bins as: 0-9; 10-19, 20-29, 30-39) 5) Radix sort The details of each sorting step should be ncluded The details of each sorting step should be included Solution QuickSort: QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quickSort that pick pivot in different ways. The key process in quickSort is partition(). Target of partitions is, given an array and an element x of array as pivot, put x at its correct position in sorted array and put all smaller elements (smaller than x) before x, and put all greater elements (greater than x) after x. All this should be done in linear time elements: 9 34 17 6 15 38 9 34 17 6 15 38 9 34 17 6 15 38 9 34 17 6 15 38 9 34 17 6 15 38 9 34 17 6 15 38 9 6 17 34 15 38 swapping 15 and 34 15 is choosing pivot compare with i-1 value Program def quickSort(alist): quickSortHelper(alist,0,len(alist)-1) def quickSortHelper(alist,first,last):
  • 2. if first= pivotvalue and rightmark >= leftmark: rightmark = rightmark -1 if rightmark < leftmark: done = True else: temp = alist[leftmark] alist[leftmark] = alist[rightmark] alist[rightmark] = temp temp = alist[first] alist[first] = alist[rightmark] alist[rightmark] = temp return rightmark alist = [9,34,17,6,15,8] quickSort(alist) print(alist) Mergesort: MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one. See following C implementation for details. 9 34 17 6 15 38 divide two parts 9 34 17 6 15 38 divide separate parts 9 34 17 6 15 38 compare two elements in each section 9 34 17 6 15 38 compare section to section 9 17 34 6 15 38 compare two section 6 9 15 17 34 38 Merges two subarrays of arr[]. # First subarray is arr[l..m] # Second subarray is arr[m+1..r]
  • 3. def merge(arr, l, m, r): n1 = m - l + 1 n2 = r- m # create temp arrays L = [0] * (n1) R = [0] * (n2) # Copy data to temp arrays L[] and R[] for i in range(0 , n1): L[i] = arr[l + i] for j in range(0 , n2): R[j] = arr[m + 1 + j] # Merge the temp arrays back into arr[l..r] i = 0 # Initial index of first subarray j = 0 # Initial index of second subarray k = l # Initial index of merged subarray while i < n1 and j < n2 : if L[i] <= R[j]: arr[k] = L[i] i += 1 else: arr[k] = R[j] j += 1 k += 1 # Copy the remaining elements of L[], if there # are any while i < n1: arr[k] = L[i] i += 1 k += 1 # Copy the remaining elements of R[], if there # are any while j < n2: arr[k] = R[j] j += 1 k += 1 # l is for left index and r is right index of the
  • 4. # sub-array of arr to be sorted def mergeSort(arr,l,r): if l < r: # Same as (l+r)/2, but avoids overflow for # large l and h m = (l+(r-1))/2 # Sort first and second halves mergeSort(arr, l, m) mergeSort(arr, m+1, r) merge(arr, l, m, r) Output: Heapsort: def heapsort( aList ): # convert aList to heap length = len( aList ) - 1 leastParent = length / 2 for i in range ( leastParent, -1, -1 ): moveDown( aList, i, length ) # flatten heap into sorted array for i in range ( length, 0, -1 ): if aList[0] > aList[i]: swap( aList, 0, i ) moveDown( aList, 0, i - 1 ) def moveDown( aList, first, last ): largest = 2 * first + 1 while largest <= last: # right child exists and is larger than left child if ( largest < last ) and ( aList[largest] < aList[largest + 1] ): largest += 1 # right child is larger than parent if aList[largest] > aList[first]: swap( aList, largest, first ) # move down to largest child first = largest; largest = 2 * first + 1 else:
  • 5. return # force exit def swap( A, x, y ): tmp = A[x] A[x] = A[y] A[y] = tmp BinSort: Time Complexity of