You currently work in an algorithm development group for a large multimedia, mobile device corporation. Your group has been tasked with creating an app that will play an audio file backwards (from end

APA format

You currently work in an algorithm development group for a large multimedia, mobile device corporation. Your group has been tasked with creating an app that will play an audio file backwards (from end to beginning rather than the standard beginning to end). Because this app is likely to be used on a mobile device, your group figures that this algorithm should use as little memory and space as possible. Your group has therefore decided to construct this reversal order algorithm such that it is an "in-place" algorithm. This simply means that the audio file will be loaded to memory and reversed using the same memory locations (because you must use memory sparingly).

Your company has been researching ways to improve the efficiency the mobile devices that it produces. Your group is tasked with finding a way to reduce media retrieval time from a playlist that is in alphabetical order. Your Algorithm Group has recently been reviewing the divide-and-conquer paradigm and has decided to test a divide and conquer approach.

Assignment (total 6 page)

  • Part 1: Before attempting this implementation, you choose to develop a simple prototype version of this algorithm in C++. Specifically, you will build an in-place, order reversal algorithm. This algorithm will take as an input an array of ints and will reverse the order of the elements in the array, in place (essentially using only the memory in the array). For example, if the array contains five elements [1,2,3,4,5], the output of the algorithm will be [5,4,3,2,1]. Comment your program.

  • Part 2: Using this prototype, you will analyze the time complexity and space complexity of your algorithm in the worst case. Specifically, for time complexity, count the number of steps for each line of code, and write down the total lines executed as a mathematical expression where n is the size of the input array. For space complexity, write an expression for the number of memory locations and components that are required for algorithm in the worst case. (Assume that each int is one location.)

  • Part 3: Program a function, method or class that will track the true runtime of your algorithm. Find the true runtime of your algorithm using arrays of varying sizes (e.g., n = 500, n = 1,500, and n= 2,500) using your new tool. Plot, on a Cartesian plane, the runtime of your algorithm as a function of the size of the input array, n

Part 4 (1 page)

  • 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, for your assignment, you will build and algorithm that splits the list into 3 sublists during each step.

Part 5 (0.5 page)

  • 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)?



Part 6 (1 page)

  • Design a greedy algorithm using pseudocode that solves this optimization problem of transferring files to disk while minimizing unused storage. The inputs to this algorithm are the number of files n, corresponding sizes (in MBs) s1, ... snm the number of disks, and corresponding storages amounts t1, ..., tm. The algorithm should return an array map[i] which contains the disk index of which the ith media file should be stored.

  • Comment your pseudocode for increased readability.

Part 7(0.5 page)

  • Discuss the optimality of your algorithm. Is it guaranteed to return an optimal result?

  • What is the Big-O time complexity of this algorithm in terms of m and n? Justify your answer.

Part 8(0.5 page)

  • If you were to solve this problem using a brute force or exhaustive search method, what would be the time complexity? Justify your response.