Question: I need to write in C++ code for a search algorithm that searches a list of strings. The searching algorithm needs to be two inputs

I need to write in C++ code for a search algorithm that searches a list of strings. The searching algorithm needs to be two inputs a playlist, which is a string array that contains a list of songs in alphabetical order; and a particular song, which is a string. The algorithm will return as index of the song, and it will return -1.

The searching algorithm Needs to be divide-and-conquer same as in a binary search, but with a slight variation. In binary search, a list should be split in 2 sublists for each step and I need to build an algorithm that splits the list into 3 sublists during each step.

Once the solution is done i then need to figure out what is the time complexity (in Big-O notation) with respect to the size of the playlist.

Then compare the time complexity to the time complexity of binary search in terms of Big-O.

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 Mathematics Questions!