Question: This is a c++ program STL Activity #2 . Using only the STL, Write a function BiasedSort that accepts a vector by reference and sorts

 This is a c++ program STL Activity #2 . Using only

This is a c++ program

STL Activity #2 . Using only the STL, Write a function BiasedSort that accepts a vector by reference and sorts the vector lexicographically (fancy way of saying alphabetically or normally), except that if the vector starts with the string Me First," that string is always at the front of the sorted list. o This may seem like a silly problem, but can come up in some circumstances. o For example, if you have a list of songs in a music library, you might want songs with the title "Untitled" to always appear at the top. So write a custom sort method that compares two strings: (Write a custom myList; myList.push_back("Song 1"); myList.push_back("Song 5"); myList.push_back("A Song 2"); myList.push_back("Song 2"); myList.push_back("Song 3"); myList.push_back("Me First Song 3"); myList.push_back("Song 7"); myList.push_back("Song 8"); myList.push_back("Me First Song 2"); myList.push_back("Song 4"); myList.push_back("Song 6"); myList.push_back("A Song 1"); myList.push_back("Me First Song 1"); // Print out the vector before the sort cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!