instruction stringlengths 0 29.8k ⌀ |
|---|
1. Why is thetotal number of leaves in $\Theta(n)$? Because each level in recursion tree corresponds to a splitting of an array's range. When we have one element we can't split it any more so we stop. That's $\Theta(1)$ per leaf. How many 1-element areas are there in an $n$ element array? The answer is $n$.
2. He... |
>Third, since $\sf{L} \subseteq \sf{NC}^2$, is there an algorithm to convert any logspace algorithm into a parallel version?
It can be shown (Arora and Barack textbook) given a $t(n)$-time TM $M$, that an oblivious TM $M'$ (i.e. a TM whose head movement is independent of its input $x$) can construct a circuit $C_n$ ... |
Converting a context free grammar to a PDA -- is my solution correct? |
>Third, since $\sf{L} \subseteq \sf{NC}^2$, is there an algorithm to convert any logspace algorithm into a parallel version?
It can be shown (Arora and Barak textbook) given a $t(n)$-time TM $M$, that an oblivious TM $M'$ (i.e. a TM whose head movement is independent of its input $x$) can construct a circuit $C_n$ t... |
>Third, since $\sf{L} \subseteq \sf{NC}^2$, is there an algorithm to convert any logspace algorithm into a parallel version?
It can be shown (Arora and Barak textbook) given a $t(n)$-time TM $M$, that an oblivious TM $M'$ (i.e. a TM whose head movement is independent of its input $x$) can construct a circuit $C_n$ t... |
|programming-languages|semantics|functional-programming|object-oriented| |
Overloading is when two or more methods have the same name but different signature (different argument types, different number of arguments). Overloading is resolved statically, depending only on the static types of the arguments. (The interaction of overloading and overriding, in Java, for example, makes the story a l... |
null |
Ahh, the ever persistent question of how to design a language. For years I never had a good solid answer to that until I fond [Cognitive dimensions of notations][1].
The author list out various dimensions, think orthogonal properties, which should be considered when designing a language. I wish I had found this deca... |
As far a as my understanding goes:
Multimethods are a generalization of method polymorphism.
A multimethod consists of 2 parts
1. A name
2. A `dispatch method`: which will produce a `dispatch value`
Overloading is a special case of multimethods where the dispatch method will return the static type as... |
As far a as my understanding goes:
Multimethods are a generalization of method polymorphism.
A multimethod consists of 2 parts
1. A name
2. A `dispatch method`: which will produce a `dispatch value`
Based on this dispatch value, the appropriate method will be chosen.
Overloading is a special case of ... |
|algorithms|graphs|data-structures|search-algorithms| |
I teach computing to 18 year olds. After having reverse polish notation explained to them one asked why is it significant enough to be in the public exam. I explained the historical significance of 70s calculators but this failed to really address the issue. So are there and concurrent practical or theorhetical applica... |
What is the significance of reverse polish notation? |
|education| |
this is an area that admittedly Ive always found subtle about CS and occasionally trips me up, and clearly others. recently on tcs.se a user asked an apparently innocuous question about [N-Queens being NP hard](http://cstheory.stackexchange.com/questions/12682/is-the-n-queens-problem-np-hard), but it got downvoted ther... |
complexity of decision problems vs computing functions |
|algorithms|complexity-theory|reference-request|time-complexity|np-complete| |
this is an area that admittedly Ive always found subtle about CS and occasionally trips me up, and clearly others. recently on tcs.se a user asked an apparently innocuous question about [N-Queens being NP hard](http://cstheory.stackexchange.com/questions/12682/is-the-n-queens-problem-np-hard), but it got downvoted ther... |
>Third, since $\sf{L} \subseteq \sf{NC}^2$, is there an algorithm to convert any logspace algorithm into a parallel version?
It can be shown (Arora and Barak textbook) given a $t(n)$-time TM $M$, that an oblivious TM $M'$ (i.e. a TM whose head movement is independent of its input $x$) can construct a circuit $C_n$ t... |
this is an area that admittedly Ive always found subtle about CS and occasionally trips me up, and clearly others. recently on tcs.se a user asked an apparently innocuous question about [N-Queens being NP hard](http://cstheory.stackexchange.com/questions/12682/is-the-n-queens-problem-np-hard), but it got downvoted ther... |
>Third, since $\sf{L} \subseteq \sf{NC}^2$, is there an algorithm to convert any logspace algorithm into a parallel version?
It can be shown (Arora and Barak textbook) given a $t(n)$-time TM $M$, that an oblivious TM $M'$ (i.e. a TM whose head movement is independent of its input $x$) can construct a circuit $C_n$ t... |
## All-Pairs-Shortest Path ##
Given a graph $G = (V, E)$ find the shortest path between _any_ two nodes $u,v \in V$. It can be solved by [Floyd-Warshall's Algorithm](http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm) in time $O(|V|^3).$ Many believe the APSP problem requires $\Omega(n^3)$ time, but it rema... |
Combinatorics plays an important role in computer science. We frequently utilize combinatorial methods in both analysis as well as design in algorithms. For example one method for finding a $k$-vertex cover set in a graph might just inspect all $\binom{n}{k}$ possible subsets. While the binomial functions grows exponen... |
null |
Doesn't that language simply recognize any string in $\{0,1\}^*$ that has at least three $1$s in it?
If so, you just need a regular finite deterministic automaton with that can count up to three in order to recognize it.
![finite automaton that counts to three][1]
-------
This is because I'm not on the mood... |
I am designing a small DSL and I know that implementing dynamic scoping (with a simple global stack) is easier then using full lexical scoping (each function needs its own scope/closure). What kind of features can be added that do not care how scope is implemented and what features would require a particular kind of sc... |
When are Dynamic and Lexical Scoping equivalent? |
|programming-languages| |
If there is someone can prove that the problem "is P equals to NP?" is a NP-COMPLETE problem, what we can conclude from this? |
If the “is P equals to NP?” is a NP-COMPLETE, what does it tell us?. Some conclusions? |
|untagged| |
|complexity-theory|p-vs-np| |
Doesn't that language simply recognize any string in $\{0,1\}^*$ that has at least three $1$s in it?
If so, you just need a regular finite deterministic automaton with that can count up to three in order to recognize it.
![finite automaton that counts to three][1]
-------
This is because I'm not on the mood... |
null |
Consider a Büchi automaton $\mathcal{A}$ with the modified acceptance condition, that an $\omega$-word $\mathcal{w}$ is accepted by $\mathcal{A}$ iff every run $\rho$ of $\mathcal{A}$ on $\mathcal{w}$ is accepting (rather than at least one run being accepting). I need to show that this automaton also accepts only $\ome... |
Büchi automaton with modified acceptance condition |
|formal-languages| |
I m doing project on face detection in c#, i want to find skin area by using skin color segmentation, for that pupose i have to extract skin area, now i can use HSI & YCbCr , what is the exact difference between these. |
what is difference between HSI & YCbCr related to skin color |
|image-processing| |
A quick highlight to underline how easily the time complexity of a *function* problem (calculate $f(x)$) can differ from the time complexity of the corresponding *decision* problem (is $f(x)=^?y$).
If we take $f(x) = 2^x$, then in order to calculate $f(x)$ we need exponential time, but the corresponding decision pro... |
A quick highlight to underline how easily the time complexity of a *function* problem (calculate $f(x)$) can differ from the time complexity of the corresponding *decision* problem (is $f(x)=^?y$).
If we take $f(x) = 2^x$, then in order to calculate $f(x)$ we need exponential time, but the corresponding decision pro... |
Am I correct in my observation that the cardinality of the maximum matching $M$ of a bipartite graph $G(U, V, E)$ is always equal to $\min(|U|, |V|)$?
Thank you! |
Maximum Matching in Bipartite Graph |
|graphs| |
I am doing a project on face detection in C#. I want to find the skin area by using skin color segmentation. For that purpose, I have to extract the skin area.
I know I can use HSI & YCbCr, but what is the exact difference between these? |
What is the difference between HSI & YCbCr as related to skin color? |
null |
Given a bipartite graph $G = (U,V,E)$ and a maximum matching $M$ of $G$, via [Konig's Theorem][1] we see that $|M| = |C|$ where $C$ is a minimum vertex cover for $G$. Your statement is merely an upper bound on the size of the possible matching, not a strict equality.
[1]: http://en.wikipedia.org/wiki/K%C3%B6ni... |
|formal-languages|automata|buchi-automata| |
I am doing a project on face detection in C#. I want to find the skin area by using skin color segmentation. For that purpose, I have to extract the skin area.
I know I can use [HSI](http://en.wikipedia.org/wiki/HSI_color_space) or [YCbCr](http://en.wikipedia.org/wiki/YCbCr), but what is the exact difference between... |
Difference between HSI and YCbCr for pattern recognition by color |
|pattern-recognition|image-processing| |
Given a bipartite graph $G = (U,V,E)$ and a maximum matching $M$ of $G$, via [Konig's Theorem][1] we see that $|M| = |C|$ where $C$ is a minimum vertex cover for $G$. Your statement is merely an upper bound on the size of the possible matching, not a strict equality.
The image on the wikipedia page provides a nice c... |
No. For example, consider the case where the two sides are disconnected $|E| = 0$ or the case where a large group of nodes are all connected to the same single node:
$U = u_1, u_2, ..., u_n$
$V = v_1, v_2, ... , v_n$
$E = u_1v_1, u_2v_1, ... u_nv_1,$
$ v_1u_1, v_2u_1, ... v_nu_1$ |
Given a bipartite graph $G = (U,V,E)$ and a maximum matching $M$ of $G$, via [Konig's Theorem][1] we see that $|M| = |C|$ where $C$ is a minimum vertex cover for $G$. Your statement is merely an upper bound on the size of the possible matching, not a strict equality.
The image on the wikipedia page provides a nice c... |
null |
I just had this interesting question. What is the fastest growing function known to man? Is it Busy Beaver?
We know functions such as `x^2`, but this function grows slower than `2^x`, which in turn grows slower than `x!`, which in turn grows slower than `x^x`. We can then combine functions, to have `(x^x)!` that gro... |
Is Busy Beaver the fastest growing function known to man? |
|computability| |
I just had this interesting question. What is the fastest growing function known to man? Is it [busy beaver](http://en.wikipedia.org/wiki/Busy_beaver)?
We know functions such as $x^2$, but this function grows slower than $2^x$, which in turn grows slower than $x!$, which in turn grows slower than $x^x$. We can then ... |
Is busy beaver the fastest growing function known to man? |
The busy beaver function grows faster than any [computable function][1]. However, it can be computed by a Turing machine which has been given access to an oracle for solving the halting problem. You can then define a "second order" busy beaver function, that grows faster than any function that can be computed even by a... |
The number of `foo()` calls is the number of 1 bits in all numbers from 0 to n (or all even numbers between 0 and 2*n - same thing).<br>
Asymptotic, it's O(n*logn), because the number of 1 bits is around log2(n)/2.<br>
I don't have an exact function. It won't be a smooth function - for example, f(1023)-f(1022)=10 but... |
I have this little exercise:
for ( i = 0; i < 2 * n; i += 2 )
for ( j = 1; j <= n; j <<= 1 )
if ( j & i )
foo ();
I am supposed to determine how many times will the *foo* function be called for some *n*. The result should be both an exact number (or the most accurate approximation pos... |
How many times will this function be called? |
|time-complexity| |
|time-complexity|imperative-programming|binary-arithmetic| |
I have this little exercise:
for ( i = 0; i < 2 * n; i += 2 )
for ( j = 1; j <= n; j <<= 1 )
if ( j & i )
foo ();
(`j <<= 1` means `j = (j << 1)`, where `<<` is the bitwise left shift operator. `&` is the bitwise and operator.)
I am supposed to determine how many times will the *... |
Double-nested loop with bitwise operation |
I have this simple 'assignment' problem:
We have a set of agents $A = \{a_1, a_2, \dotso, a_n\}$ and set of tasks $T= \{t_1, 1_2, \dotso, t_m\}$. Note that $m$ is not necessarily equal to $n$. Unlike the general assignment formulation in Wikipedia, a task $t_c$ can only be assigned to an agent based on the task's pr... |
Simple Task-Assignment Problem |
|proof-techniques|correctness-proof| |
|algorithms|graphs|proof-techniques|assignment-problem| |
As I stated on the CSTheory post, this is solved via maximum matching. First, construct the graph $G$. Now, for each agent $a_i$ and quota $q_i$, make a new graph $G'$ that has $q_i$ copies of $a_i$. That is to say, if agent $a_i$ has quota $q_i = 3$, make 2 new nodes $a_i', a_i''$ that have the same tasks as $a_0$.
... |
I have this simple 'assignment' problem:
We have a set of agents $A = \{a_1, a_2, \dotso, a_n\}$ and set of tasks $T= \{t_1, 1_2, \dotso, t_m\}$. Note that $m$ is not necessarily equal to $n$. Unlike the general assignment formulation in Wikipedia, a task $t_c$ can only be assigned to an agent based on the task's pr... |
As I stated on the CSTheory post, this is solved via maximum matching. First, construct the graph $G$. Now, for each agent $a_i$ and quota $q_i$, make a new graph $G'$ that has $q_i$ copies of $a_i$. That is to say, if agent $a_i$ has quota $q_i = 3$, make 2 new nodes $a_i', a_i''$ that have the same tasks as $a_0$.
... |
There is no such thing as "the fastest growing function". In fact, there is even no sequence of fastest growing functions. This was already shown by Hausdorff. Given two functions $f,g\colon \mathbb{N} \longrightarrow \mathbb{N}$, say that $g$ grows faster than $f$ if $$ \lim_{n\rightarrow\infty} \frac{g(n)}{f(n)} = \i... |
As I stated on the CSTheory post, this is solved via maximum matching. The following should give enough intuition to show that each agent $a_i$ has a $q_i$-matching iff a transformed graph $G'$ has a matching. First, construct the graph $G$. Now, for each agent $a_i$ and quota $q_i$, make a new graph $G'$ that has $q_i... |
null |
I have this simple 'assignment' problem:
We have a set of agents $A = \{a_1, a_2, \dotso, a_n\}$ and set of tasks $T= \{t_1, 1_2, \dotso, t_m\}$. Note that $m$ is not necessarily equal to $n$. Unlike the general assignment formulation in Wikipedia, a task $t_c$ can only be assigned to an agent based on the task's pr... |
the Hartmanis-Stearns [Time](http://en.wikipedia.org/wiki/Time_hierarchy_theorem) and [Space](http://en.wikipedia.org/wiki/Space_hierarchy_theorem) hierarchy theorems
prove that there is no "fastest growing" function in terms of Time or Space because the scale is unbounded. but it does give an _ordering_ such that al... |
null |
null |
If you allow one function to call another, then you have enough power to distinguish a lexically defined variable from a dynamically defined one.
def scope {
var x = 10
def f() {
return g()
}
}
def g() {
return x;
}
scope.f()
If `x` is dynamically scop... |
null |
In helping someone understand phrase generators for use with testing grammars, think compiler test cases, I noted that I have never found a phrase generator that is knowledgeable of the grammar, and is deterministic. The phrase generators I am talking about rely on the grammar of the language as input so that the user ... |
Phrase generators for use with testing grammars that don't use a seed |
|reference-request|software-testing| |
Is there an algorithm for finding the shortest path in an undirected weighted graph? |
|terminology|education| |
Am I correct in my observation that the cardinality of the maximum matching $M$ of a bipartite graph $G(U, V, E)$ is always equal to $\min(|U|, |V|)$?
|
Size of Maximum Matching in Bipartite Graph |
|graphs| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.