C++ class repositioned items

In many applications, the order of the data items in a list changes over time. Not only are new data items added and existing ones removed, but data items are repositioned within the list. The following operation is needed to move a data item to the beginning of an array. Do not use a vector for this assignment.

Precondition: the array is not empty.

Postcondition: This function removes the data item marked by a cursor from an array and reinserts the data item at the beginning of the array.

cursor is some indicator for the element to be moved.  It may be an index number or a search key.  For example, the function could take in the index number 4 to move the fifth element of the array to the front.  Alternatively, the function could take in the search string “Joe” and if found in the array, that “Joe” element would be moved to the front.  You can select the strategy you prefer for the cursor.

Minimum Requirements:

  • Create a class that has an arra

Leave a Reply

Your email address will not be published. Required fields are marked *