instruction stringlengths 0 29.8k ⌀ |
|---|
null |
My suggestion:
You have to start the algorithm from T,
in order to find a negative cycle in your residual network. The result should be the same, but then you can reach the circle |
When I read NP-completeness for the first time, I really wondered why is the concept of Reductions given such high emphasis, after all we have been looking at concepts such as reductions and 'special case of one another problem' in mathematics since elementary algebra. What I mean by reductions in Algebra is following ... |
Difference between 'Reductions' in algebraic problems vs "Reductions" in Computational Intractability |
|complexity-theory|np-complete|np-hard| |
I have a question about inheritance in Java-like OO programming languages. It came up
in my compiler class, when I explained how to compile methods and their invocation. I was using Java as example source language to compile.
Now consider this Java program.
class A {
public int x = 0;
void f (... |
Inheritance, and dynamic access to members/attributes and methods in Java-like languages |
|semantics|java|object-oriented|c++| |
null |
Remembering that inheritance is a form of saying `B` "is a" `A`, except the functionality of `A` might be extended, inherited member variables can be considered *attributes* of the object. Intuitively, the way we are taught about inheritance (admittedly from a Java-ish point of view), member variables are like attribut... |
Reductions in computational complexity are similar to the reduction you described, but are usually give with bounds on the time or space. To be useful, these bounds are usually inconsequential (ie. the same or smaller) to the bounds of solving the problem.
Reductions in computational complexity are about convertin... |
Taking a NP-Complete problem like vertex cover if we can find a reduction which is exponential and not polynomial and the reduction we do to a problem can be solved in Polynomial time, then what would be it's implications
|
What would an exponential reduction from NP-Complete problem to P signify? |
|complexity-theory|np-complete|p-vs-np| |
I have a question about inheritance in Java-like OO programming languages. It came up
in my compiler class, when I explained how to compile methods and their invocation. I was using Java as example source language to compile.
Now consider this Java program.
class A {
public int x = 0;
void f (... |
There would be no implications, and indeed I will now exhibit just such a reduction. The reduction takes an instance of vertex cover, finds the optimal value (in exponential time), and then reduces it to the language $\{0\} \in P$ (the language consisting of the single string $0$), by outputting $0$ if there is a verte... |
I suspect that this is intimately related to _shadowing_ of fields in Java.
When writing a derived class, I can, as in your example, write a field `x` that shadows the definition of `x` in the base class. This means that in the derived class, the shadowed definition is no longer accessible via name `x`. The reason J... |
Taking a NP-Complete problem like vertex cover if we can find a reduction which is exponential and not polynomial and the reduction we do to a problem can be solved in Polynomial time, then what would be it's implications
Edit:
Based on Yuval's answer, I wanted to throw this scenario into the place also.
IF we h... |
I have to sketch an IP proof for the minSAT problem. The minSAT problem is define in this way:
- For a given formulae find a satisfying assignment with a min subset of variables assigned to True;
My sketched IP protocol is:
1. Prover and Verifier share the input formula
2. Prover sends to the Verifier ... |
Sketch an IP proof for minSAT |
|satisfiability|interactive-proof-systems| |
I suspect that this is intimately related to _shadowing_ of fields in Java.
When writing a derived class, I can, as in your example, write a field `x` that shadows the definition of `x` in the base class. This means that in the derived class, the original definition is no longer accessible via name `x`. The reason J... |
Reductions in computational complexity are similar to the reduction you described, but are usually given with bounds on the time or space. To be useful, these bounds are usually inconsequential (ie. the same or smaller) to the bounds of solving the problem.
Reductions in computational complexity are about converting... |
I have a question about inheritance in Java-like OO programming languages. It came up
in my compiler class, when I explained how to compile methods and their invocation. I was using Java as example source language to compile.
Now consider this Java program.
class A {
public int x = 0;
void f (... |
null |
To expand upon my comment, remember, this algorithm for finding Min-Cost-Flow relies on the fact that $f$ is maximal. By first running Ford-Fulkerson to find $f$ and the resulting residual network $G_f$, the cost $f$ is then reduced by finding negative cycles in $G_f$. That is, by finding negative cycles in $G_f$ we do... |
A film producer is seeking actors and investors for his new movie. There are $n$ available actors; actor $i$ charges $s_i$ dollars. For funding, there are $m$ available investors. Investor $j$ will provide $p_j$ dollars, but only on the condition that certain actors $L_j \subseteq \{1,2,...,n\}$, are included in the ca... |
Linear programming/optimal solution |
Integer LP formulation and the existence of a solution |
A [generalization of Matrix chain multiplication](http://en.wikipedia.org/wiki/Matrix_chain_multiplication#Generalizations) is defined as:
> Given a linear sequence of objects, an associative binary operation on those objects, and a way to compute the cost of performing that operation on any two given objects (as we... |
Chained operations on sequences with two operators |
|optimization|binary-trees|dynamic-programming|efficiency| |
A [generalization of Matrix chain multiplication](http://en.wikipedia.org/wiki/Matrix_chain_multiplication#Generalizations) is defined as:
> Given a linear sequence of objects, an associative binary operation on those objects, and a way to compute the cost of performing that operation on any two given objects (as we... |
I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional programming it might be useful, however I reckon that it's not really needed for learning functional programming, what do you... |
Lambda calculus outside functional programming? |
|lambda-calculus|functional-programming| |
Without knowing more about it, I hear that linguists are using lambda calculus.
http://www.sfu.ca/~jeffpell/Ling406/LambdaAbstractionOH.pdf, https://files.nyu.edu/cb125/public/Lambda/ |
The lambda calculus is fundamental in logic, category theory, type theory, formal verification, ... Basically, anything to do with programming language semantics and formal logic. It is such a fundamental formalism that people working in these fields do not even question the benefit of it.
I think that it is extrem... |
One way of looking at $\lambda$-calculus is as a simple and terse model of parametersing programs. You parameterise code in almost any programming language that has functions, procedures or methods, and in any language that has modules or that enables you to parameterise types. Parameterisation is a form of reuse. Beca... |
null |
You are asking for an application outside of computer science and logic. That is easily found, for example in algebraic topology it is convenient to have a cartesian closed category of spaces, see [convenient category of topological spaces][1] on nLab. The formal language corresponding to cartesian closed categories i... |
null |
How can i modify the data structure if I used Dijikstra's alogrithm, and improve the time complexity of O(v+e) |
If i have directed graph with edge weights of certain range from [1..K] where K is constant and I have to find the shortest path |
|search-trees|weighted-graphs| |
I know that Euclid's algorithm is the best algorithm for get the GCD (great common divisor) for a list the positive integer numbers.
But, in the practice, you can write two codes por evaluate the gcd (for my case, i decided use java, but c/c++ may be another option).
I need to get the most efficient code of two... |
I assume here that K is an integer and the edge weights are integral. Otherwise it doesn't really buy you anything, you can always rescale weights so that the min edge has cost 1 and the max has cost K, so the problem is identical to the standard shortest path problem.
Algorith/proof sketch: Implement the priority... |
I know the term **order** of a B-tree. Recently I heard a new term **B tree with minimum degree of 2.**
We know the degree is related with a node but what is degree of a tree.
Is degree imposes any kind of a restriction on height of a B-tree? |
B-Tree Is degree and order both are the same thing related to a B-Tree |
|trees| |
Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using [Dijkstra's algorithm][1], how can I modify the algorithm / data structure and improve the time complexity to $O(V+E)$?
[1]: http://en.wikipedia.org/wiki/Dijkstra... |
Modifying Dijkstra's algorithm for edge weights drawn from range $[1,…,K]$ |
|algorithms|search-trees|weighted-graphs| |
null |
I have ordered a few leather sheets from which I would like to build juggling balls by sewing edges together. I'm using the Platonic solids for the shape of the balls.
I can scan the leather sheets and generate a polygon that approximates the shape of the leather sheet (as you know, it's animal skin, and it doesn't ... |
How to pack polygons inside another polygon? |
|computational-geometry| |
I assume here that K is an integer and the edge weights are integral. Otherwise it doesn't really buy you anything, you can always rescale weights so that the min edge has cost 1 and the max has cost K, so the problem is identical to the standard shortest path problem.
Algorith/proof sketch: Implement the priority... |
if it has more than (n-1)(n-2)/2 edges.
I am a bit confused about this question, since i can always prove that for a graph to connected you need edges E>V-1 , or E>n-1 .. |
simple undirected graph with n vertices is connected |
|graphs| |
I think your problem might be to prove that you CANNOT construct an undirected graph with (n-1)*(n-2)/2 edges that is not connected. You are thinking about it the wrong way. The E = n - 1 formula about how few edges can you use to connect all the vertexes.
Imagine you are an adversary trying to design a horrible h... |
I am not sure what bothers you but as I see it you are confused about the following two facts
1. If a graph is connected then $e \geq n-1.$
2. If a graph has more than $e > \frac{(n-1)(n-2)}{2}$ then it is connected.
Notice that the implications in 1 and 2 are in opposite directions.
For a proof of 2. you ... |
There are no general algorithms for your problem but what one usually does (for graphs of small orders) is
1. Use [nauty][1] to generate graphs satisfying some rough constraints (you can make nauty only generate connected graphs, regular graphs, triangle/quadrangle free graphs,..)
2. Use an external program to ... |
if it has more than (n-1)(n-2)/2 edges.
I am a bit confused about this question, since i can always prove that for a graph to connected you need more than E>n-1 edges. |
null |
If a graph with $n$ vertices has more than $\frac{(n-1)(n-2)}{2}$ edges then it is connected.
I am a bit confused about this question, since I can always prove that for a graph to connected you need more than $|E|>n-1$ edges. |
Every simple undirected graph with $$ is connected |
Every simple undirected graph with $(n-1)(n-2)/2$ edges is connected |
Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using [Dijkstra's algorithm][1], how can I modify the algorithm / data structure and improve the time complexity to $O(|V|+|E|)$?
[1]: http://en.wikipedia.org/wiki/Dijk... |
|algorithms|data-structures|shortest-path|weighted-graphs| |
I don't think that **degree** of a tree is a standard term in either graph theory nor data structures. A degree is usually a property of a node/vertex of a graph, which denotes the number of its incident edges. For trees you sometimes consider only the edges to the children.
I suppose "B-tree with minimum degree of ... |
|terminology|trees| |
I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional programming it might be useful, however I reckon that it's not really needed for learning functional programming, what do you... |
I have ordered a few leather sheets from which I would like to build juggling balls by sewing edges together. I'm using the Platonic solids for the shape of the balls.
I can scan the leather sheets and generate a polygon that approximates the shape of the leather sheet (as you know, it's animal skin, and it doesn't ... |
There are no general algorithms for your problem but what one usually does (for graphs of small orders) is
1. Use [nauty][1] to generate graphs satisfying some rough constraints (you can make nauty generate only (bi)connected graphs, regular graphs, triangle/quadrangle free graphs,..)
2. Use an external program... |
null |
Let us say you have a group of guys and and a group of girls. Each girl is either attracted to a guy or not, and vice versa. You want to match as many people as possible to a partner they like.
Does this problem have a name? Is it feasibly solvable? Sounds hard to me...
Ps. note that since the attraction is not n... |
Matching girls with boys without mutual attraction (variant of maximum bipartite matching) |
|algorithms|graphs|bipartite-matching| |
I have ordered a few leather sheets from which I would like to build juggling balls by sewing edges together. I'm using the Platonic solids for the shape of the balls.
I can scan the leather sheets and generate a polygon that approximates the shape of the leather sheet (as you know, it's animal skin, and it doesn'... |
|computational-geometry|packing| |
I am studying formal languages and playing with writing my own parsers for them. I have a context free grammar parser already that works well. I am wondering if anyone can point me towards actually implemented examples of rewriters. For example, suppose I had the rules
WORD: [A-Z]+
QUOTE: "
And I wanted to inp... |
Example of a parsing/rewriting system? |
|formal-languages|parsers|term-rewriting| |
Why LL(k) and LL(∞) are incompatible with left-recursion? I understand that a LL(k) language can support left-recursivity provided that with k-overahead tokens can be resolved any ambiguity. But, with a LL(∞) grammar, why type of ambiguities can't be solved? |
LL grammars and left-recursiviity |
|formal-grammars|compilers| |
I think it is still the standard bipartite maximum matching problem, which can be solved by the algorithm of [Hopcroft and Karp](http://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm).
You put an edge in the bipartite boys-girls graph, iff you have mutual attraction. Then you maximize your matching and voilà.... |
I think it is still the standard bipartite maximum matching problem, which can be solved by the algorithm of [Hopcroft and Karp](http://en.wikipedia.org/wiki/Hopcroft%E2%80%93Karp_algorithm).
You put an edge in the bipartite boys-girls graph, iff you have mutual attraction. Then you maximize your matching and voilà.... |
I've been searching google scholar for references and narrowed down the first mention to somewhere around [1963][1] with a very weird jitter in 1949.
So, I'm trying to track down the original paper introducing interval graphs for citation, but it's been rather elusive so far.
[1]: http://books.google.com/ngrams... |
Who (and when) first defined interval graphs? |
|graphs|history| |
null |
Considering the physical memory size remains constant. As the size of the page increases does the number of frames increase or decrease?
Also what is the effect of the number of frames on page faults when increased and decreased.
Please provide reference strings as example. |
How does increasing the page size decrease the number of page faults? |
|paging| |
For cholecystoduodenostomy/duodenocholecystostome, I notice that if you assigned a number to each character describing how much it was moved as a delta, you would have some thing like 7 7's, then 8 -7s, then 6 0's. That is not right because some chars may have been repeated (the second c only moved forward 2, not back ... |
We covered this in class today. I understand the mechanics of it, but aside from being a nice example of recursion does it serve any purpose?
![enter image description here][1]
[1]: https://i.stack.imgur.com/DOcD0.png
Searching the web reveals lots of pages with the formula and it's implementation in co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.