Q.1. Implement insertion sort using C++ STL with following constrain and write a program : The insertion sort procedure uses searching procedure to find the position of the unsorted array elements in sorted array. This searching procedure can start from the beginning index of the sorted array or ending index of the sorted array. Here your program should consider the searching procedure that should starts from beginning index of the sorted array.

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

Q.1. Implement insertion sort using C++ STL with following constrain and write a program :

The insertion sort procedure uses searching procedure to find the position of the unsorted array elements in sorted array. This searching procedure can start from the beginning index of the sorted array or ending index of the sorted array. Here your program should consider the searching procedure that should starts from beginning index of the sorted array.

Q.2.  Implement insertion sort using C++ STL with following constrain and write a program :

To find the position of the unsorted-array elements in insertion sort, it is depending on searching procedure. In this procedure it stops at a position after identifying the first occurred element (in sorted-array) which is greater than the element (in unsorted-array). Here the programmer should apply intelligence in such a way that, the position of an element can be identified after finding the closet element in sorted-array.

Example: Let the elements in unsorted array are: 5,2,4,6,1,3

The sorted-array after few iterations of insertion sort is: 2,5,4,6,1,3. Here the elements 2 and 5 are in sorted-array and the elements 4, 6, 1 and 3 are in unsorted-array. While identifying the position of element – 4, we can compare it with element – 5, then it concludes that 5 > 4. So, it will proceeds further and compare with element – 2 in sorted-array. Here 4 is very close to 5 than 2. You need to stop this procedure at element – 5 and perform the rotation to include 4 insorted-array.

Q.3.  Implement insertion sort using C++ STL with following constrain and write a program :

Use binary searching procedure to find the position of the unsorted-array elements in sorted-array. Perform the rotations procedure to insert elements in sorted-array after finding the position using binary search.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education