instruction stringlengths 0 29.8k ⌀ |
|---|
|algorithms|reference-request|np-complete|efficiency| |
I know that the 2D and 3D Knapsack problems are NPC, but is there any way to solve them in reasonable time if the instances are not very complicated? Would dynamic programming work?
By 2D (3D) Knapsack I mean I have a square (cube) and a I have list of objects, all data are in centimeters and are at most 20m. |
Algorithms for two and three dimensional Knapsack |
|algorithms|np-complete|computational-geometry| |
|algorithms|np-complete|computational-geometry|knapsack-problems| |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_R$ for *reverse multiplication* by transposing it...
$A_R$
> <pre>
> <... |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_R$ for *reverse multiplication* by transposing it...
$A_R$
> <pre>
> <... |
null |
You could use any function that gives a lower weight to older entries. For example, if data consists of scores, $s_1,\ldots,s_i,\ldots,s_n$, where the index $i$ corresponds to the 'time of arrival' of the entry, that is, newer entries have larger indices, then you could use a weight function that increase as $i$ increa... |
|algorithms|complexity-theory|np-complete|computational-geometry|knapsack-problems| |
You could use any function that gives a lower weight to older entries. For example, if data consists of scores, $s_1,\ldots,s_n$, where the index corresponds to the 'time of arrival' of the entry, that is, newer entries have larger indices, then you could use a weight function that increase as $i$ increases. So any 'i... |
It seems that your main problem is utilising nondeterminism, so let me elaborate on that.
> The basic idea the others utilise is that a nondeterministic machine can *guess* the final result.
Let us consider your small example $abc$ and Gilles' construction idea. The automaton "computing" the right-to-left product... |
I have started to study non deterministic automata using the book of [Hopcroft and Ullman][1]. I'm stuck in a problem that I found very interesting:
> Give a non deterministic finite automaton accepting all the strings that
> have the same value when evaluated left to right as right to left by
> multiplying accord... |
I really think "formal" methods are not a very good idea for educational purposes. For that matter, programming a computer is a "formal" method. Does it succeed as an educational tool?
What is needed is understanding, intuition, and the ability to deal with abstraction. Formal methods hinder all that. Rather, th... |
There are a number of well-studied strategies; which is best in your application depends on circumstance.
* ***Improve worst case runtime***
Using problem-specific insight, you can often improve the naive algorithm. For instance, there is an $O(c^n)$ algorithm for Vertex Cover with $c \approx 1.2$ (will look up r... |
|algorithms|complexity-theory|reference-request|np-complete|efficiency| |
There are a number of well-studied strategies; which is best in your application depends on circumstance.
* ***Improve worst case runtime***
Using problem-specific insight, you can often improve the naive algorithm. For instance, there are $O(c^n)$ algorithms for Vertex Cover with $c < 1.3$ [1]; this is a [*huge*... |
|formal-languages|automata|closure-properties| |
|formal-languages|automata|closure-properties| |
Notable examples are closure properties of formal languages; for instance, the class of regular languages is closed against union, that is the union of two regular languages is again regular. |
Questions about operations on objects of some kind that result in objects of the same kind. |
|formal-languages|context-free|closure-properties| |
null |
null |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_T$ ("$T$" for transpose) for *reverse multiplication* by transposing it...
... |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_T$ ("$T$" for transpose) for *reverse multiplication* by transposing it...
... |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_T$ ("$T$" for transpose) for *reverse multiplication* by transposing it...
... |
The first trick here is to think of the multiplication table as the transition table of an automaton $A$ with each state representing a letter in your multiplication table, but not worrying about acceptance yet. Then construct the automaton $A_T$ ("$T$" for transpose) for *reverse multiplication* by transposing it...
... |
null |
A state machine with a stack |
null |
null |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $O(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The orig... |
Complexity of finding the largest $m$ numbers in an array of size $n$ |
|time-complexity|sorting| |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $O(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The orig... |
null |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $O(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The orig... |
null |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $O(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The orig... |
Your algorithm taken $O(n + mn)$ time. I suspect that your professor is looking for something that takes $O(n+ n\log m)$ time, which should be doable, maybe using a heap. |
Your algorithm take $O(n + mn)$ time. I suspect that your professor is looking for something that takes $O(n+ n\log m)$ time, which should be possible, maybe by using a heap. |
null |
Your algorithm takes $O(n + mn)$ time. I suspect that your professor is looking for something that takes $O(n+ n\log m)$ time, which should be possible, maybe by using a heap. |
|algorithms|time-complexity|runtime-analysis| |
Your algorithm takes $\Theta(n + mn)$ time. I suspect that your professor is looking for something that takes $O(n+ n\log m)$ time, which should be possible, maybe by using a heap. |
Your algorithm takes $\Theta(n + mn)$ time. I suspect that your professor is looking for something that takes $O(n+ n\log m)$ time, which should be possible, maybe by using a heap...
**Edit:** The source of your disagreement with the professor is that he or she doesn't appear to think $m$ is a constant, despite how ... |
null |
**Correctness** <br>
Missing from your presentation is the loop invariant to establish correctness: you maintain the largest $m$ elements encountered so far in a linked list. Thus, by the end of your algorithm, you have tested *all* the elements, and so you have the largest $m$ elements in the array. Your algorithm is... |
Here is an $O(n)$ algorithm solving the problem.
1) Use the worst-case $O(n)$ *selection* algorithm to determine the $n-m+1$-th order statistics. Let $k$ be this number, which is the smallest of the $m$ largest numbers we are trying to determine.
2) Now partition the array around the pivot $k$ using the QuickSort... |
Here is an $O(n)$ algorithm solving the problem.
1. Use the worst-case $O(n)$ *selection* algorithm to determine the $n-m+1$-th order statistics. Let $k$ be this number, which is the smallest of the $m$ largest numbers we are trying to determine.
2. Now partition the array around the pivot $k$ using the QuickSort... |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $O(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The orig... |
What follows is my algorithm for doing this in what I believe to be $O(n)$ time, and my proof for that. My professor disagrees that it runs in $O(n)$ and instead thinks that it runs in $\Omega(n^2)$ time. Any comments regarding the proof itself, or the style (i.e. my ideas may be clear but the presentation not).
The... |
Assume that I am a programmer and I have an NP-complete problem that I need to solve it. What methods are available to deal with NPC problems? Is there a survey or something similar on this topic? |
Dealing with intractability: NP-complete problems |
What are efficient and accurate techniques for monitoring the recoverability and integrity of files in very large preservation archives?
|
Monitoring files in preservation archives |
|hash|filesystems| |
[Search problems](http://en.wikipedia.org/wiki/Search_problem) are a class of computational problems. Generally a search problem is of the form:
Given input x,
Find a y such that R(x,y) holds.
where R is a binary relation. The y does not need to be unique. By putting restrictions on the possible y's and... |
null |
[Search problems](http://en.wikipedia.org/wiki/Search_problem) are a class of computational problems. Generally a search problem is of the form:
> Given input $x$,
> Find a $y$ such that $R(x,y)$ holds.
where $R$ is a binary relation. The $y$ does not need to be unique. By putting restrictions on the pos... |
A class of computational problems. Where decision problems call for a yes-or-no answer, search problems are looking for an object satisfying a certain property. |
|filesystems|integrity| |
What are the complete specifications that must be documented in order to ensure the correct execution of a particular program written in Java? For instance, if one were archiving a program for long-term preservation, and no testing or porting would be done. |
Requirements for emulation |
|programming-languages|operating-systems|compilers|computer-architecture| |
null |
I have a [tree][1] ( in graph theory sense) such as this:
![enter image description here][2]
This is a directed tree with one starting node and many ending nodes. Each of the edge has a length assigned to it.
My question is, how to find the longest edge connecting from the starting node to any of the ending no... |
Find the longest edge in a tree |
|graphs| |
Do you know, any algorithm that calculate the efficient form Modulus?
For example, i want to programming:
factorial(100!) ( Mod 97)
I want to know algorithm.
Python, looks like grate with this problem, but i'm interesting the fundamentals.
Thanks, |
What is most efficient for $n!$? |
|algorithms|efficiency| |
Do you know, any algorithm that calculate the efficient form Modulus?
For example, i want to programming:
factorial(100!) ( Mod 101)
I want to know algorithm.
Python, looks like grate with this problem, but i'm interesting the fundamentals.
Thanks,
|
I have a [tree][1] ( in graph theory sense) such as this:
![enter image description here][2]
This is a directed tree with one starting node and many ending nodes. Each of the edge has a length assigned to it.
My question is, how to find the longest edge connecting from the starting node to any of the ending no... |
Do you know, any algorithm that calculate the efficient form Modulus?
For example, i want to programming:
factorial(100!) ( Mod 101)
I want to know algorithm.
Python, looks like grate with this problem, but i'm interesting the fundamentals. |
null |
Do you know, any algorithm that calculate the efficient factorial and after Modulus?
For example, I want to programming:
for(i=0; i<5; i++)
sum += factorial(p-i) % p;
But, p is a big number for applied factorial $(p \leq 10^ 8)$.
In Python, this task is really easy, but i really want to know how op... |
I have a [tree][1] ( in graph theory sense) such as this:
![enter image description here][2]
This is a directed tree with one starting node and many ending nodes. Each of the edge has a length assigned to it.
My question is, how to find the longest path connecting from the starting node to any of the ending no... |
Find the longest path in a tree |
Ran G. gave hints towards an efficient algorithm, though perhaps he left out some details. Computing all root-leaf paths is indeed a little inefficient if you are doing work over and over again, for example, if you compute each path and then compute the length.
Perform the following recursive algorithm starting with... |
|algorithms|graphs| |
Ran G. gave hints towards an efficient algorithm, though perhaps he left out some details. Computing all root-leaf paths is indeed a little inefficient if you are doing work over and over again, for example, if you compute each path and then compute the length.
Perform the following recursive algorithm starting with... |
Ran G. gave hints towards an efficient algorithm, though perhaps he left out some details. Computing all root-leaf paths is indeed a little inefficient if you are doing work over and over again, for example, if you compute each path and then compute the length.
Perform the following recursive algorithm starting with... |
Do you know any algorithm that calculates the factorial after modulus efficiently?
For example, I want to program:
for(i=0; i<5; i++)
sum += factorial(p-i) % p;
But, `p` is a big number for applying factorial directly $(p \leq 10^ 8)$.
In Python, this task is really easy, but i really want to kno... |
|algorithms|efficiency|integers| |
null |
I'm implementing a class which provides arbitrary-precision arithmetic (also called "bignum", "BigInteger", etc.).
My questions is about a practical implementation detail:
I'm wondering if there is a significant difference in implementation and computational complexity between an implementation which stores the m... |
Is it better to store the magnitude of an arbitrary-precision number in BigEndian or LittleEndian order in an integer array? |
|complexity-theory|time-complexity|optimization|mathematical-analysis| |
I'm implementing a class which provides arbitrary-precision arithmetic (also called "bignum", "BigInteger", etc.).
My questions is about a practical implementation detail:
I'm wondering if there is a significant difference in implementation and computational complexity between an implementation which stores the m... |
Consider a system of linear equations $Ax=0$, where $A$ is a $n\times n$ matrix with rational entries. Assume that the rank of $A$ is $<n$. What is the complexiy to check
whether it has a solution $x$ such that all entries of $x$ is stricly greater than 0 (namely, $x$ is a positive vector)? Of course, one can use Gaus... |
complexity of checking linear equation having a positve solution |
|algorithms|complexity-theory| |
Consider a system of linear equations $Ax=0$, where $A$ is a $n\times n$ matrix with rational entries. Assume that the rank of $A$ is $<n$. What is the complexiy to check
whether it has a solution $x$ such that all entries of $x$ is stricly greater than 0 (namely, $x$ is a positive vector)? Of course, one can use Gaus... |
Complexity of checking whether linear equations have a positve solution |
Consider a system of linear equations $Ax=0$, where $A$ is a $n\times n$ matrix with rational entries. Assume that the rank of $A$ is $<n$. What is the complexiy to check
whether it has a solution $x$ such that all entries of $x$ are stricly greater than 0 (namely, $x$ is a positive vector)? Of course, one can use Gau... |
Complexity of checking whether linear equations have a positive solution |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.