C Programming. (C++ or any other language will NOT work.) MUST USE USER DEFINED
ID: 3540094 • Letter: C
Question
C Programming. (C++ or any other language will NOT work.)
MUST USE USER DEFINED FUNCTIONS.
DO NOT USE STRINGS/POINTERS
USE ARRAYS/LOOPS/STATEMENTS ETC.
Problem: The Move Sort algorithm will move an identified element to the rear of the array. All elements in between the selected element and the end of the data set will move one position to the left (an index one less than its previous position in the array). Unlike the Selection, Bubble, and Insertion sorting algorithms the Move Sort algorithm will terminate immediately when the array is sorted. There will be no passes through the Move Sort algorithm that fails to make any moves.
Given a data set of non-negative integers apply the Move Sort algorithm to order the data from smallest to largest in as few moves as possible. The maximum number of elements input is 20, but the user can enter a -1 to indicate that no more input will follow if less than 20 elements is desired.
Note: Input will always be non-negative, but elements in the data set do not have to be unique
Example Execution #1:
Number of moves: 4
Description of Example Execution #1:
>>>The first move identifies that the 3 must be sent to the rear of the array. All other elements shift one position to the left.
>>>The second move identifies that the 4 must be sent to the rear of the array. The 6, 2, and 3 elements move one position to the left.
>>>The third move identifies that the 5 must be sent to the rear of the array and all other elements shift one position to the left.
>>>The fourth and final move identifies that the 6 must move to the rear of the array and elements 2, 3, 4, and 5 move one position to the left.
Example Execution #2:
Number of moves: 4
Example Execution #3: Entire array filled, no -1 needed to terminate input.
Number of moves: 11
I need the code. Will award full points and stars
OUTPUT SHOULD BE THE SAME!
Explanation / Answer
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.