-2

Here is my problem: Given numbers x1, ... xn. Numbers meet n files size and memory disk capacity D. We must understand, can we that files divided into 3 disks. The amount of file size recorded on any disc cannot exceed the disk capacity D. Let’s estimate that this computational task is in class NP. What is extra information (certificate), that in this case is required for check algorithm?

Here is my idea, but I am really not sure:

Extra information: 3 sets in one set, that contains x1, ..., xn files. That sets could be recognized if string supplement by variables y1,y2,y3, which would be placed at the beginning of the thought set and contain a symbol, which is different from a number so that it doesn't interfere with the file size string.

Checker: Must be able to check if the total size of each set of files does not exceed the disk D capacity. The algorithm might be simple for this by introducing a variable. To variable would add the downloaded file size until either this amount exceeds the capacity of the D disk or until the new set start symbol is reached. At the moment when the capacity of D disk is exceeded, a negative response is issued, otherwise positive. The time consuming of this algorithm is O (n).

I don’t know how to estimate that this algorithm is class NP. Because NP can be solved by a non-deterministic Turing machine in O(n^k) time.

  • Your problem can be construed as an instance of the BIN-PACKING decision problem which is known to be NP-complete. – collapsar May 17 '19 at 17:14
  • If I understand correctly, this is an example of the [bin packing problem](https://en.wikipedia.org/wiki/Bin_packing_problem). You can search for more information about it on the Internet, it is a very studied problem. If you can access it, [this book](https://link.springer.com/book/10.1007/3-540-29297-7) seems to make reference to the proof (see [this preview](https://link.springer.com/chapter/10.1007%2F3-540-29297-7_18)). – jdehesa May 17 '19 at 17:15
  • I'm voting to close this question as off-topic because it belongs on cs.stackexchange.com. – Jim G. May 17 '19 at 20:21

1 Answers1

1

Informally, NP means "given the answer to the problem, it is possible to check whether the answer is correct in polynomial time". The checking algorithm in your post has complexity O(n), which is polynomial. Therefore, your problem is in NP.

Note: The set of NP-complete problems is a subset of NP. Your problem also belongs to the set of NP-complete problems. However, you don't need to prove that. In a context of computer science learning, attempting to do that would hint to the teacher that you don't understand your task.

anatolyg
  • 26,506
  • 9
  • 60
  • 134