instruction stringlengths 0 29.8k ⌀ |
|---|
Here is what I think works:
$\qquad \begin{align}
I = &\phantom{\land}\ A \text{ is sorted and has not been changed} \\
&\land\ j \geq i \\
&\land\ \forall i' \lt i.\ \forall j' \gt j.\ A[i'] + A[j'] \neq b \\
&\land\ \forall i' \lt i.\ b > A[i'] + A[j] \\
&\land\ \forall j' \gt j.\ b ... |
Let me start off by noting **this is a homework problem, please provide only advice and related observations, NO DIRECT ANSWERS please**. With that said, here is the problem I am looking at:
> Let HALF-CLIQUE = { $<$G$>$ | G is an undirected graph having a complete
> subgraph with at least n/2 nodes, where n is th... |
HALF CLIQUE - NP Complete Problem |
|np-complete|reductions| |
Perhaps something like this?
> After `k` iterations of the loop, `A[i...j]` contains a sorted subarray of size `n - k`, with `k` of the original elements, none of which summing to `b` with any other element of `A`, having been removed.
Perhaps a clearer way of stating this is simply:
> After `k` iterations of ... |
Let me start off by noting **this is a homework problem, please provide only advice and related observations, NO DIRECT ANSWERS please**. With that said, here is the problem I am looking at:
> Let HALF-CLIQUE = { $\langle G \rangle$ | $G$ is an undirected graph having a complete
> subgraph with at least $n/2$ node... |
null |
You seem a little lost. You want to show that HALF-CLIQUE $\ge$ CLIQUE, which means that you are looking for a poly-time algorithm that takes CLIQUE instances as the input and outputs HALF-CLIQUE instances with the property that "yes" inputs map to "yes"es and "no" inputs map to "no"s.
So, basically, the task is to... |
You seem a little lost. You want to show that HALF-CLIQUE $\ge$ CLIQUE, which means that you are looking for a poly-time algorithm that takes CLIQUE instances as the input and outputs HALF-CLIQUE instances with the property that "yes" inputs map to "yes"es and "no" inputs map to "no"s.
So, basically, the task is to... |
As someone who came from a computer science background and led a team developing a product involving bioinformatics I can sympathize with the challenge of picking up the domain - but it is a fascinating area to work in.
As @JCEHR has pointed out, it is not an absolute requirement to study biology but it is helpful t... |
First simplification: this algorithm, by inspection, cannot say YES when it shouldn't. It always terminates, since $i$ and $j$ move in a monotone way up and down respectively, and one always moves. It never says YES unless it actually finds $x$ and $y$ so that $A[x] + A[y] = b$.
So let's assume that that answer is... |
null |
For a broad US-centric dataset of nearly 2000 recipes you could look at the [Armed Forces Recipe Service][1]. This does not answer your question, but would provide you with real-world training data.
The requirements for the problem are probably difficult to articulate for most people and the selected approach will l... |
There are always infinitely many valid loop invariants. The trick is to find one that suffices to prove what you want to prove about the algorithm, and that you can prove (usually by induction over the number of loop iterations).
There are three parts in proving the correctness of this algorithm:
* The algorithm... |
I have developed the following pseudocode for the sum of pairs problem:
> Given an array $A$ of integers and an integer $b$, return YES if there are positions $i,j$ in $A$ with $A[i] + A[j] = b$, NO otherwise.
Now I should state a loop invariant that shows that my algorithm is correct. Can someone give me a hint ... |
Co-operative multitasking implies that an executing context must explicitly relinquish control to the scheduler, and if it wishes, can prevent a context switch from occurring.
Most implementations explicitly perform a context switch for any system call that does not return promptly, and often even if they do, to inc... |
Adding the task to a round-robin scheduling queue multiple times opens up the problem of ensuring that the entries remain reasonably evently distributed. This is easy to ensure if the system does not permit dynamic task creation or deletion, but not possible in general.
In addition to the more complex process of re... |
Judging by your description and comments, you might be helped the best by an exact description on how reductions can be used to prove NP-completeness:
A problem is NP-complete iff it is in NP and it is NP-hard. This means that any proof of NP-completeness has two parts: a proof that the problem lies in NP and a proo... |
The differentiability requirement doesn't change the nature of the problem: requiring $\mathcal{C}^0$ (continuity) or $\mathcal{C}^{\infty}$ (infinite differentiability) gives the same lower bound for the length and the same order of points, and is equivalent to solving the traveling salesman problem.
If you have a ... |
null |
The differentiability requirement doesn't change the nature of the problem: requiring $\mathcal{C}^0$ (continuity) or $\mathcal{C}^{\infty}$ (infinite differentiability) gives the same lower bound for the length and the same order of points, and is equivalent to solving the traveling salesman problem.
If you have a ... |
|complexity-theory|np-complete|reductions| |
Loop invariant for an algorithm |
null |
null |
Algorithms for finding an element in some specified data-structure (most commonly, in a tree). |
null |
Theory of dynamic processes with several competing actors that try to achieve some goal in a strategic way. |
Questions about techniques that infer valid or preferred options from existing data with the goal to make helpful suggestions automatically. |
Necessary properties of formal langagues in certain classes that rely on closure against repetition of certain subwords. |
Questions about the algorithmic problems of finding shortest paths between nodes in a graph. |
Questions about methods and techniques for determining requirements for a (software) system. |
Questions about how operating systems decide which process to execute at which time. |
null |
Here is what I think works:
$\qquad \begin{align}
I = &\phantom{\land}\ A \text{ is sorted and has not been changed} \\
&\land\ 1 \leq i,j \leq n \\
&\land\ j \geq i \\
&\land\ \forall i' \lt i.\ \forall j' \gt j.\ A[i'] + A[j'] \neq b \\
&\land\ \forall i' \lt i.\ b > A[i'] + A[j] \\
... |
There is no foolproof way to derive a helpful invariant; note that the problem is not computable (otherwise we could solve the halting problem). Therefore, your are back to trial and error with heuristics trained by experience. See Gilles' answer for an exemplary thought process. In general, you need the desired *post ... |
There are always infinitely many valid loop invariants. The trick is to find one that suffices to prove what you want to prove about the algorithm, and that you can prove (usually by induction over the number of loop iterations).
There are three parts in proving the correctness of this algorithm:
* The algorithm... |
I once had a veteran in my course that created an algorithm that would suggest cooking recipes. At first, all sort of crazy recipes would come out. Then, she would train the cooking algorithm with real recipes and eventually it would suggest very good ones.
I believe she used something related to Bayes Theorem or C... |
In the discussion around [this question](http://cs.stackexchange.com/q/1157/98), Gilles mentions correctly that any correctness proof of an algorithm that uses arrays has to prove that there are no out-of-bounds array accesses; depending on the runtime model, this would cause a runtime error or access to non-array elem... |
How do deal with arrays during Hoare-style correctness proofs? |
|logic|proof-techniques| |
I dont really understand what do you demend, from tags it seems you are looking for an algorithm.
if so, what is the expected time complexity? by saying: "If we solve this problem using the naive approach it will not be efficient and run practically forever for n=50." it seems to me that your naive approach solves i... |
First simplification: this algorithm, by inspection, cannot say YES when it shouldn't, since saying YES is immediately after a test verifying that the sum at the current positions is $b$.
Second simplification: It always terminates, since $i$ and $j$ move in a monotone way up and down respectively, and one always ... |
I am interested in calculating the $n$'th power of a $n\times n$ matrix $A$. Suppose we have an algorithm for matrix multiplication which runs in $\mathcal{O}(M(n))$ time. Then, one can easily calculate $A^n$ in $\mathcal{O}(M(n)\log(n))$ time. Is it possible to solve this problem in lesser time complexity?
Matrix e... |
null |
**<a href="http://cs.stackexchange.com/a/1114/72">Henry's solution</a> is both simpler and more general than this one!**
----
E[V]$ is roughly half the expected number of comparisons performed by randomized quicksort.
**Assuming the sticks have distinct heights**, we can derive a closed-form solution for $E[Y]$ ... |
**<a href="http://cs.stackexchange.com/a/1114/72">Henry's solution</a> is both simpler and more general than this one!**
----
$E[V]$ is roughly half the expected number of comparisons performed by randomized quicksort.
**Assuming the sticks have distinct heights**, we can derive a closed-form solution for $E[Y]$... |
As someone who came from a computer science background and led a team developing a product involving bioinformatics I can sympathize with the challenge of picking up the domain - but it is a fascinating area to work in.
As @JCEHR has pointed out, it is not an absolute requirement to study biology but it is helpful t... |
null |
As someone who came from a computer science background and led a team developing a product involving bioinformatics I can sympathize with the challenge of picking up the domain - but it is a fascinating area to work in.
As @JCEHR has pointed out, it is not an absolute requirement to study biology but it is helpful t... |
Most of the sortings methods have to move data around in short steps (for example, merge sort makes changes locally, then merges this small piece of data, then merges a bigger one. ..). In consequence, you need many data movements if data is far from its destination.
Quicksort, on the other side tries to interchange... |
Software engineering includes many features. Two of them are human factor and quality measure.
Let’s say I want to do productivity analysis. The data collection would be hard comparing to algorithm analysis because the data is about human productivity. Also the objective measure of quality is not easy to achieve.
... |
[*The Pattern On The Stone: The Simple Ideas That Make Computers*](http://en.wikipedia.org/wiki/The_Pattern_on_the_Stone:_The_Simple_Ideas_That_Make_Computers_Work), by [Daniel Hillis](http://en.wikipedia.org/wiki/W._Daniel_Hillis), is a very good introduction, starting from the logic building blocks up to programming,... |
As a Computer Scientist who did their minor in Biochemistry, my recommendation would be [Larry Gonick's Cartoon guide to Genetics][1].
This is not a joke. I know of several respectable Bioinformaticians who learnt genetics this way. The book explains most of what, if not everything, you will need to know and supplie... |
null |
I think [problem solving strategy][1] is interesting book exactly for teens. It doesn't need deep mathematical background. However If its math is hard for startup, you can find some interesting and small discrete-mathematical book and start reading them, then switch to this book. I read it when I was in high school and... |
Your axiom is not really an axiom, it's missing hypotheses. Simple presentations of Hoare logic manipulate formulas of the form $\{P\} C \{P'\}$ where $P$ and $P'$ are logical formulas and $C$ is a command. You do need to **ensure that $C$ is well-formed**. In simple languages such as the ones often used for a first in... |
|proof-techniques|semantics|arrays|hoare-logic| |
How to deal with arrays during Hoare-style correctness proofs |
null |
|proof-techniques|semantics|arrays|hoare-logic|software-verification| |
Questions about methods and techniques to prove correctness of programs. |
A sequential random-access data structure whose size can typically not be changed after creation. |
Questions about Hoare's logical framework for program correctness proofs and variants. |
I think [Problem-Solving Strategy][1] is an interesting book for teens. It does not need a deep mathematical background. However, if its math is too hard you can find an interesting and small book about discrete mathematics¹ to read first and then switch back to this book. I read it when I was in high school and this b... |
null |
null |
I think [Problem-Solving Strategy][1] is an interesting book for teens. It does not need a deep mathematical background. However, if its math is too hard you can find an interesting and small book about discrete mathematics¹ to read first and then switch back to this book. I read it when I was in high school and this b... |
Hmm, using Bayes Theorem to make new recipes out of old recipes. I imagine you first would want the algorithm to pull apart the ingredients into a form it understands (not sure if we are using NLP for that, or if you manually enter the data in yourself, that's neither here nor there.) From there...
I envision someth... |
Search the inter-webs.
[SNAP][1] is a set of networks hosted by a prof at Stanford. Several real world examples in a variety of settings.
[Net Wiki][2] is hosted by a UNC math prof., again several links to real datasets as well as links to other data resources.
[OpenFlights][3] Has airports and routes between... |
I would like to write a simple program that accepts a set of windows (width+height) and the screen resolution and outputs an arrangement of those windows on the screen such that the windows take the most space. Therefore it is possible to resize a window, while maintaining its initial size and aspect ratio. So for wind... |
How to devise an algorithm to arrange (resizable) windows on the screen to cover as much space as possible? |
|algorithms| |
Having a set $A$ of $n$ elements, let's say I want to calculate a function $f(A)$ that depends on every single element of $A$. For example, $f$ could be the sum or the average.
Is there a result that proves that, under some conditions, calculating $f$ will be $\Omega(n)$? |
Lower bounds of calculating a function of a set |
|complexity-theory| |
You have to be specify the model of computation and properties of $f$. In the following argument I will state the assumptions that I need. It can be generalized a little bit further but I think it should be sufficient give you the idea.
Assume that the machine $M$ never reads the value of one of the members of the $... |
Having a set $A$ of $n$ elements, let's say I want to calculate a function $f(A)$ that depends on every single element of $A$. For example, $f$ could be the sum or the average.
Is there a result that proves that, under some conditions, the time necessary to a deterministic Turing machine to compute $f$ will be $\Ome... |
|algorithms|computational-geometry|packing|user-interface| |
You have to be specify the model of computation and properties of $f$. In the following argument I will state the assumptions that I need. It can be generalized a little bit further but I think it should be sufficient to give you the idea.
Assume that the machine $M$ never reads the value of one of the members of th... |
You have to be specify the model of computation and properties of $f$. In the following argument I will state the assumptions that I need. It can be generalized a little bit further but I think it should be sufficient to give you the idea.
Assume that the machine $M$ never reads the value of one of the members of $A... |
Having a set $A$ of $n$ elements, let's say I want to calculate a function $f(A)$ that is sensitive to all parts of the input, i.e. depends on very member of $A$ (i.e. it is possible to change any member of $A$ to something else to obtain a new input $A'$ s.t. value of $f$ on $A$ and $A'$ are different).
For example... |
null |
null |
[Computable analysis][1] studies questions like computability and complexity of real numbers, real functions and operators. A major difference with classical computability theory is that inputs and outputs can be infinite objects (like a real number) whereas in classical computability theory the input and the outputs a... |
null |
questions related to computability and complexity in analysis |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.