View the step-by-step solution to:

Part 1 In C++, code a search algorithm that searches a list of strings for a particular song. The searching algorithm will have two inputs:

Part 1

  • In C++, code a search algorithm that searches a list of strings for a particular song. The searching algorithm will have two inputs: the playlist, which is a string array that contains a list of songs in alphabetical order; and a particular song, which is a string. If the song is found in the list, the algorithm will return the index of the song, and it will return -1 otherwise.
  • This searching algorithm will employ a divide-and-conquer approach similar to that in binary search, but with a slight variation. In binary search, a list is split in 2 sublists during each step; however, build and algorithm that splits the list into 3 sublists during each step.

Part 2

  • What is the time complexity (in Big-O notation) of your algorithm with respect to the size of the playlist?  
  • How does this time complexity compare to the time complexity of binary search (in terms of Big-O)?

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question