Solution Found!
Compare the number of comparisons used by the insertion
Chapter 2, Problem 48E(choose chapter or problem)
Compare the number of comparisons used by the insertion sort and the binary insertion sort to sort the list 7, 4, 3, 8, 1, 5, 4, 2.
Questions & Answers
QUESTION:
Compare the number of comparisons used by the insertion sort and the binary insertion sort to sort the list 7, 4, 3, 8, 1, 5, 4, 2.
ANSWER:Solution:Step1Given thatThe list 7, 4, 3, 8, 1, 5, 4, 2.Step2To find We have to compare the number of comparisons which is used by the insertion sort and the binary insertion sort to sort the given list .Step3Insertion sort is a basic sorting algorithm that assembles the final sorted array one item at a time.Binary insertion sort is a variation of Insertion sorting in which appropriate location to insert the selected element is found using the binary search.Step4We have The list 7, 4, 3, 8, 1, 5, 4, 2.Sorting using insertion sortCompare the first two element 7 and 4 means 7>44, 7, 3, 8, 1, 5, 4, 2.Again compare third element with first element means 3 and 44>3 then3,4, 7, 8, 1, 5, 4, 2.Again com