Chapter IV algorithm practice report

Analysis program storage problems. content include:

       1. Practice topic

        N with the program to be stored in a length L of the tape. Various programs stored on the tape length are listed. Storage procedures required to determine n so that instructions can be stored on a magnetic tape as a plurality of program storage solution.

      2. Description of the problem

       Selecting the minimum required length of each program into a magnetic tape so that the program can be loaded up to an amount of

      3. The algorithm description (state your greedy strategy, and reference venue arrangements, required to prove that the use of greedy choice and optimal substructure property)

       Each time you select the rest of the program, the minimum length of the program, such as the venue arrangements, according to a small set of top to traverse, that is "greedy strategy."

 If selected minimum length, will take up more space, you can not put down more.

      4. algorithm time and space complexity analysis (analysis have)

    Time complexity is O (nlogn) because single cycle algorithm for (i = 0; i <n; i ++) i.e. O (n), are ordered by flash sort is O (nlogn).

 

  Space complexity is O (1) because the algorithm is only applied in a space count

      5. feelings and experiences (for this practice of harvesting and doubts summarize)

      Think clearly write the algorithm, we must pay attention to detail!

Guess you like

Origin www.cnblogs.com/twojiayi/p/11874887.html