instruction
stringlengths
0
29.8k
⌀
|algorithms|time-computation|
Since permuting two rows within a single block of a valid, completed sudoku produces another valid, completed sudoku, you can take any completed board (81 clues) and remove the first two rows (81-18=63 clues), which will give you an incomplete sudoku with two solutions. Note that even if you remove all but one of the 1...
I've not gone much deep into CS. So, please forgive me if the question is not good or out of scope for this site. I've seen in many sites and books, the big-O notations like $O(n)$ which tell the time taken by an algorithm. I've read a few articles about it, but I'm still not able to understand how do you calculate ...
|algorithms|reference-request|time-computation|
Since permuting two rows within a single block of a valid, completed sudoku produces another valid, completed sudoku, you can take any completed board (81 clues) and remove the first two rows (81-18=63 clues), which will give you an incomplete sudoku with two solutions. Note that even if you remove all but one of the 1...
> What is the time complexity of finding a diagonal of a graph > $G=(V,E)$?
The time complexity of finding a diagonal of a graph
|time-complexity|graph|
A statement like "Algorithm $A$ takes $\cal{O}(n)$ time." does not say much about the actual runtime of the algorithm on a given instance. You (usually) have to read it like this: "For a fixed $n_0 \in \mathbb{N}$ and for all $n \geq n_0$ the runtime of $A$ on a worst-case instance of size $n$ is bounded from above ...
|algorithms|algorithm-analysis|runtime-analysis|
> What is the time complexity of finding the diagonal of a graph > $G=(V,E)$? The diagonal of a graph $G$ is the longest distance in graph.
> What is the time complexity of finding the diagonal of a graph > $G=(\cal V,E)$? > > - $\cal{O}(|V|^2)$ > - $\cal{O}(|V|^2+|V| \cdot |E|)$ > - $\cal{O}(|V|^2\cdot |E|)$ > - $\cal{O}(|V|\cdot |E|^2)$ <sup>The diagonal of a graph $G$ is the longest distance in graph. </sup> I have no idea what to do ...
I have been working on dynamic programming in a general setting for some time. The canonical way to evaluate a dynamic programming recursion is by creating a table of all necessary values and filling it row by row. See for example [Cormen, Leiserson et al: "Introduction to Algorithms"](http://mitpress.mit.edu/catalog/i...
A Case Distinction on Dynamic Programming: Example Needed!
|dynamic-programming|
|applied-theory|category-theory|
This part of computer science is called analysis of algorithms. Many times people are satisfied when they are given a guarantee that an algorithm’s performance is not worse than a specified bound and they dont’t care about the exact performance. This bound is conveniently denoted with the [Landau-notation][1] (or bi...
This part of computer science is called analysis of algorithms. Many times people are satisfied when they are given a guarantee that an algorithm’s performance is not worse than a specified bound and they dont’t care about the exact performance. This bound is conveniently denoted with the [Landau-notation][1] (or bi...
Compressing a non-mutable data structure so that it does not duplicate any structurally equal subterm is known as [**hash consing**](http://en.wikipedia.org/wiki/Hash_consing). This is an important technique in memory management in functional programming. Hash consing is a sort of systematic memoization for data struct...
Big O notation ($\mathcal{O}$) ignores all constants so that you're left with the largest growth rate: - For a single line statement like assignment, where the running time is independent of the input ($n$), the time complexity would be $\mathcal{O}(1)$: > int index = 5; *//constant time* int ite...
> What is the time complexity of finding the diameter of a graph > $G=(\cal V,E)$? > > - $\cal{O}(|V|^2)$ > - $\cal{O}(|V|^2+|V| \cdot |E|)$ > - $\cal{O}(|V|^2\cdot |E|)$ > - $\cal{O}(|V|\cdot |E|^2)$ <sup>The diameter of a graph $G$ is the longest distance between two vertices in graph. </sup> I hav...
I assume you mean the *diameter* of $G$ which is the longest shortest path found in $G$. Finding the diameter can be done by finding all pair shortest paths first and determining the maximum length found. [Floyd-Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm) does this in $\Theta(...
Big O notation ($\mathcal{O}$) ignores all constant factors so that you're left with the largest growth rate. For a single line statement like assignment, where the running time is independent of the input size $n$, the time complexity would be $\mathcal{O}(1)$: int index = 5; //constant time int i...
Big O notation ($\mathcal{O}$) ignores all constants so that you're left with the largest growth rate: - For a single line statement like assignment, where the running time is independent of the input ($n$), the time complexity would be $\mathcal{O}(1)$: > int index = 5; *//constant time* int ite...
Big O notation ($\mathcal{O}$) ignores all constant factors so that you're left with an upper bound on growth rate. For a single line statement like assignment, where the running time is independent of the input size $n$, the time complexity would be $\mathcal{O}(1)$: int index = 5; *//constant time* ...
How to come up with the runtime of algorithms?
The time complexity of finding the diameter of a graph
|time-complexity|graph|
Is this finite graph problem decidable? What factors make a problem decidable?
|undecidability|graphs|
Let me give a graphical representation. Consider two functions $f(n)$ and $g(n)$ that looks something like below: ![normal][1] When you say a function $f(n)$ is bound by $O(g(n))$ i.e. ($f(n)=O(g(n))$) what you actually mean is there exists a constant $c$ and $n_0$ such that $f(n)\geq c*g(n)$, $\forall n\geq n_0...
|computability|undecidability|
Let me give a graphical representation. Consider two functions $f(n)$ and $g(n)$ that looks something like below: ![normal][1] When you say a function $f(n)$ is bound by $\mathcal{O}(g(n))$ i.e. ($f(n)=\mathcal{O}(g(n))$) what you actually mean is there exists a constant $c$ and $n_0$ such that $f(n)\geq c*g(n)$...
|formal-languages|computability|regular-languages|finite-automata|
|sudoku|combinatorics|
|algorithms|dynamic-programming|
|algorithms|time-complexity|graphs|
|algorithms|computability|undecidability|graphs|
O, Theta and Omega all denote some sort of expression, with it's constant factors stripped off. The difference is that the O notation sets an upper bound on the algorithm's running time, the Omega notation sets a lower bound, and the Theta notation "sandwiches" the algorithm's running time. To calculate the running ...
$\cal{O}$, $\Theta$ and $\Omega$ all denote some sort of expression, with it's constant factors stripped off. The difference is that the O notation sets an upper bound on the algorithm's running time, the Omega notation sets a lower bound, and the Theta notation "sandwiches" the algorithm's running time. To calculat...
**1 -** Quick sort is inplace (doesn't need extra memmory, other than a constant amount.) **2 -** Quick sort is easier to implement than other efficient sorting algorithms. **3 -** Quick sort has smaller constant factors in it's running time than other efficient sorting algorithms.
This is exactly not the search space you are looking for but i've an idea of the top of my head which might be of help. **Problem :** Given a $n × n$ matrix say, $M$ with distinct integers in which the entries of each row (from left to right) and each column (from top to bottom) are both sorted in increasing orde...
Let me give a graphical representation. Consider two functions $f(n)$ and $g(n)$ that looks something like below: ![normal][1] When you say a function $f(n)$ is bound by $\mathcal{O}(g(n))$ i.e. ($f(n)=\mathcal{O}(g(n))$) what you actually mean is there exists a constant $c$ and $n_0$ such that $f(n)\geq c*g(n)$...
Moggi's paper [Notions of computation and monads][1] pretty much seals the deal: monads are incredibly natural and useful for describing in a unified way computational effects. [Wadler][2] and others' work in translating these notions to deal with computational effects in functional programming languages adds the icing...
Let $L_1$, $L_2$, $L_3$, $\dots$ be an infinite sequence of context-free languages, each of which is defined over a common alphabet $Σ$. Let $L$ be the infinite union of $L_1$, $L_2$, $L_3$, $\dots $; i.e., $L = L_1 + L_2 + L_3 + \dots $. Is it always the case that L is a context-free language? Does the properties o...
Does the properties of regular languages (intersection, concatenation, etc.) apply on context free languages as well?
|finite-automata|
The union of infinitely many context-free languages may not be context free. In fact, the union of infinitely many languages can be just about anything: let $L$ be a language, and define for every $l \in L$ the (finite) language $L_l = \{ l \}$. The union over all these languages is $L$. Finite languages are regular, b...
Let $L_1$, $L_2$, $L_3$, $\dots$ be an infinite sequence of context-free languages, each of which is defined over a common alphabet $Σ$. Let $L$ be the infinite union of $L_1$, $L_2$, $L_3$, $\dots $; i.e., $L = L_1 + L_2 + L_3 + \dots $. Is it always the case that L is a context-free language?
Is it always the case that L is a context-free language?
Let $L_1$, $L_2$, $L_3$, $\dots$ be an infinite sequence of context-free languages, each of which is defined over a common alphabet $Σ$. Let $L$ be the infinite union of $L_1$, $L_2$, $L_3$, $\dots $; i.e., $L = L_1 + L_2 + L_3 + \dots $. Is it always the case that L is a context-free language? Does the properties o...
Does the properties of regular languages (intersection, concatenation, etc.) apply on context free languages as well?
|formal-languages|finite-automata|context-free|
Let $L_1$, $L_2$, $L_3$, $\dots$ be an infinite sequence of context-free languages, each of which is defined over a common alphabet $Σ$. Let $L$ be the infinite union of $L_1$, $L_2$, $L_3$, $\dots $; i.e., $L = L_1 + L_2 + L_3 + \dots $. Is it always the case that L is a context-free language?
Is an infinite sequence of context-free languages, context-free?
|finite-automata|context-free|
Are the context-free languages closed under infinite union?
Let $L_1, L_2, L_3, \dots \subseteq \Sigma^*$ be an infinite sequence of context-free languages. Is $$L = \bigcup_{i \in \mathbb{N}} L_i$$ (always) a context-free language?
We know that DFAs are equivalent to NFAs in expressiveness power; there is also a known algorithm for converting NFAs to DFAs (unfortunately I do now know the inventor of that algorithm), which in worst case gives us $2^S$ states, if our NFA had $S$ states. My question is: what is determining the worst case scenario...
null
Let $L_1$, $L_2$, $L_3$, $\dots$ be an infinite sequence of context-free languages, each of which is defined over a common alphabet $Σ$. Let $L$ be the infinite union of $L_1$, $L_2$, $L_3$, $\dots $; i.e., $L = L_1 + L_2 + L_3 + \dots $. Is it always the case that L is a context-free language?
Is an infinite sequence of context-free languages, context-free?
Yes, there are plenty of studies on this topic. Of course, the question is too general to answer for all kinds of software development projects, but there is evidence from several contexts that support the notion that properly doing requirements analysis will have a positive impact on the implementation stage. This evi...
Why in computer science any complexity which is at most polynomial is considered efficient? For any practical application<sup>(a)</sup>, algorithms with complexity $n^{\log n}$ are way faster than algorithms that run in time, say, $n^{80}$, but the first is considered inefficient while the latter is efficient. Where...
Why polynomial time is efficient?
|algorithm-analysis|complexity|efficiency|
This doesn't fit case 3 exactly, but I don't know if any of your cases capture a very common problem used to teach dynamic programming: [Matrix Chain Multiplication][1]. To solve this problem, (and many others, this is just the canonical one) we fill up the matrix diagonal by diagonal instead of row by row. So th...
In theory, we care for the asymptotic behaviour, and describe classes of problems and algorithms based on their asymptotic behaviour. The keyword here is *asymptotic*. $O(n^{80})$ is faster than $O(n^{\log n})$ asymptotically, i.e., starting from $n > 1208925819614629174706176$ (which by the way is called: septillion!)...
|formal-languages|finite-automata|context-free|
|algorithms|complexity-theory|efficiency|
A binary tree is a tree type data structure having (two) child nodes on each parent node. The image shows the rough model of binary tree. ![Single parent or single level, complete binary tree][1] A binary tree is usually used in binary search. [Further reading of binary search trees on Wikipedia][2]. There are...
null
A binary tree is a tree type data structure having (two) child nodes on each parent node.
null
A compiler is a program that reads a program in one language (source language) and translates into an equivalent program in another language (target language).
null
A compiler is a program that transforms source code written in a programming language (the source language) into another language (the target language). ***Example:** A C++ compiler transforms your C++ code into equivalent Assembly Language or Machine Code.* ***A rough sketch of working of compilers*** Source...
null
A programming language is an artificial language designed to communicate instructions to a machine. They are create programs that control the behavior of a machine using given instructions.
null
A programming language is an artificial language designed to communicate instructions to a machine. They are used to create programs that control the behavior of a machine using given instructions.
A computation model which allows to rely on quantum-mechanic phenomena, such as entanglement and superposition. This gives generalization to the probabilistic model of computation.
null
[Structured Query Language][1], a programming language designed for managing data in relational database management systems (RDBMS). It is based upon relational algebra and tuple relational calculus, its scope includes data insert, query, update and delete, schema creation and modification, and data access control. ...
null
[Structured Query Language][1], a programming language designed for managing data in relational database management systems (RDBMS). It is based upon relational algebra and tuple relational calculus. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control. ...
Structured Query Language, a programming language designed for managing data in relational database management systems (RDBMS).
null
The amount of time resources (number of atomic operation; machine steps) required to solve a problem or run an algorithm with respect to the size of the input.
null
Why polynomial time is called "efficient"?
If the graph is directed this is rather complex, [here is some paper][1] claiming faster results in the dense case than using algorithms for all-pairs shortest paths. However my main point is about the case the graph is *not* directed and with non-negative weigths, I heard of a nice trick several times: 1. Pick ...
Another perspective on "efficiency" is that polynomial time allows us to define a notion of "efficiency" that doesn't depend on machine models. Specifically, there's a variant of the Church-Turing thesis called the "effective Church-Turing Thesis" that says that any problem that runs in polynomial time on on kind of ma...
As the notes indicate, the way to define a QTM is to define the transition function as a unitary transform of state and letter. So in each step, you imagine multiplying the (state,letter) vector by a transformation to get a new (state, letter). It's not particularly convenient, but it can be defined.
Moggi's paper [Notions of computation and monads][1] pretty much seals the deal: monads are incredibly natural and useful for describing computational effects in a unified way. [Wadler][2] and others' work in translating these notions to deal with computational effects in functional programming languages adds the icing...
Asking whether an occurrence of monad is _natural_ is similar to asking whether a group (in the sense of group theory) is natural. Once you formalise something, in this case as an endofunctor, either it satisfies the axioms of being a monad or not. If it does satisfy the axioms, then one gets a lot of technical machin...
Asking whether an occurrence of monad is _natural_ is similar to asking whether a group (in the sense of group theory) is natural. Once you formalise something, in this case as an endofunctor, either it satisfies the axioms of being a monad or not. If it does satisfy the axioms, then one gets a lot of technical machin...
|formal-languages|context-free|