np-complete

Need Algorithm to group files of varying sizes into approximately equal blocks

Hey folks, I'm trying to figure out an algorithm that will help me group an assortment of files of varying sizes into say, 'n' groups of approximately equal size. Any ideas on how to achieve this? ...

Is it correct to ask to solve an NP-complete problem on a job interview?

Today there was a question on SO, where the author was given an NP-complete problem during an interview and he obviously hadn't been told that it was one. What is the purpose of asking such questions? What behavior does the interviewer expect when asking such things? Proof? Useful heuristics? And is it even legitimate to ask one if ...

Is the board game "Go" NP complete?

There are plenty of Chess AI's around, and evidently some are good enough to beat some of the world's greatest players. I've heard that many attempts have been made to write successful AI's for the board game Go, but so far nothing has been conceived beyond average amateur level. Could it be that the task of mathematically calculating ...

Simple reduction (NP completeness)

hey guys I'm looking for a means to prove that the bicriteria shortest path problem is np complete. That is, given a graph with lengths and weights, I need to know if a there exists a path in the graph from s to t with total length <= L and weight <= W. I know that i must take an NP complete problem and reduce it to this one. We have at...

Best-case Running-time to solve an NP-Complete problem?

What is the fastest algorithm that exists up with to solve a particular NP-Complete problem? For example, a naive implementation of travelling salesman is O(n!), but with dynamic programming it can be done in O(n^2 * 2^n). Is there any perhaps "easier" NP-Complete problem that has a better running time? I'm curious about exact solutions...

Question about NP-Completeness of the Independent Set Problem.

I thought that, when proving that a problem P is NP-Complete, we were supposed to reduce a known NPC problem to P. But, looking at the solution to the Independent Set problem, it seems to not go this way. To prove that Independent Set is NP-Complete, you take a graph G, find its inverse G', and then compute CLIQUE(G'). But, this is doin...

Are all scheduling problems NP-Hard?

I know there are some scheduling problems out there that are NP-hard/NP-complete ... however, none of them are stated in such a way to show this situation is also NP. If you have a set of tasks constrained to a startAfter, startBy, and duration all trying to use a single resource ... can you resolve a schedule or identify that it cannot...

Given a collection of consumers competing for a limited resource, allocate that resource to maximize it's applicability.

Sorry the question title isn't very clear, this is a challenging question to ask without providing a more concrete example. Consider the following scenario: I have a number of friends whose birthdays are coming up on dates (d1..dn), and I've managed to come up with a number of gifts I'd like to purchase them of cost (c1..cn). Unfortunat...

Is this problem NP, and does it have a name?

This problem came up in the real world, but I've translated it into a more generic "textbook-like" formulation. I suspect it is NP, but I'm particularly interested in knowing if it has a name or is well known since I think I can't be the first one to encounter it. ;-) Imagine there is a potluck party with N guests. Each guest may bring ...

Tricky programming problem that I'm having trouble getting my head around

First off, let me say that this is not homework (I am an A-Level student, this is nothing close to what we problem solve (this is way harder)), but more of a problem I'm trying to suss out to improve my programming logic. I thought of a scenario where there is an array of random integers, let's for example say 10 integers. The user will...

The subsets-sum problem and the solvability of NP-complete problems

I was reading about the subset-sums problem when I came up with what appears to be a general-purpose algorithm for solving it: (defun subset-contains-sum (set sum) (let ((subsets) (new-subset) (new-sum)) (dolist (element set) (dolist (subset-sum subsets) (setf new-subset (cons element (car subset-...

Can NP-Intermediate exist if P = NP?

My understanding is that Ladner's theorem is basically this: P != NP implies that there exists a set NPI where NPI is not in P and NPI is not NP-complete What happens to this theorem if we assume that P = NP rather than P != NP? We know that if NP Intermediate doesn't exist, then P = NP. But can NP Intermediate exist if P = NP?...

Where does optical character recognition (OCR) fall on the scale of problem difficulty?

How hard is Optical Character Recognition (OCR), formally? Let's assume an error tolerance comparable to a human (which is, I believe, around 98%). In other words, where would it fit in the P/NP scale of problem complexity and intractability? Or would it fit on that scale? Just what kind of problem is it? I'm not terribly familiar wit...

Optimizing a Parking Lot Problem. What algorithims should I use to fit the most amount of cars in the lot?

What algorithms (brute force or not) would I use to put in as many cars (assume all cars are the same size) in a parking lot so that there is at least one exit (from the container) and a car cannot be blocked. Or can someone show me an example of this problem solved programmatically. The parking lot varies in shape would be nice but if ...

np-complete but not "hard"

Is there some language that is NP-complete but for which we know some "quick" algorithm? I don't mean like the ones for knapsack where we can do well on average, I mean that even in the worst case the runtime is something like 2^n^epsilon, where the result holds for any epsilon>0 and so we can allow it to get arbitrarily close to 0. ...

3-cnf-sat with a twist question

If you change the 3-cnf-sat problem as follows: For each ci, ci = -xi1 OR -xi2 OR xi3 meaning exactly one of the variables appears without a negation. You are also given values (0 or 1) to some (or all) of the x's. You should be able to solve the problem (finding values of the x's that satisfy the problem or prove that it is unsatisfiabl...

Is this problem np-complete?

Say there is a line of x bins filled with trinkets (random amount), in plain-sight (you can see how many trinkets there are in each bin). Now there are two players who can when it's their turn pick a bin from either end. They cannot forgo a turn. Come up with a strategy for a player to get the maximum amount of trinkets. x is even. Is ...

Find set of numbers in one collection that adds up to a number in another.

For a game I'm making I have a situation where I have a list of numbers say [7, 4, 9, 1, 15, 2] (named A for this) and another list of numbers say [11, 18, 14, 8, 3] (named B) provided to me. The goal is to find all combinations of numbers in A that add up to a number in B. For example: 1 + 2 = 3 1 + 7 = 8 2 + 9 = 11 4 + 7 = 11 1...

Splitting a Domain name into constituent words (if possible)?

I want to break a domain name into constituent words and numbers e.g. iamadomain11.com = ['i', 'am', 'a', 'domain', '11'] How do i do this? I am aware that there may be multiple sets possible, however, i am currently even ok, just getting 1 set of possibilities. ...

Algorithm/approximation for combined independent set/hamming distance problem

Input: Graph G Output: several independent sets, so that the membership of a node to all independent sets is unique. A node therefore has no connections to any node in its own set. Here is an example path. since clarification was called for here another re phrasal: divide a given graph into sets so that i can tell a node from all oth...