instruction stringlengths 0 29.8k ⌀ |
|---|
Draw a flowchart of a simple payroll system that will display an employee’s information |
|graphs| |
null |
Can I say that all languages in the class $\textbf{P}$ are just a padded version of some other problem in $\textbf{EXP}$?
I am familiar with the padding argument, which states that if $\textbf{P} = \textbf{NP}$, then $\textbf{EXP} = \textbf{NEXP}$. I describe the languages obtained by padding an exponential-time pro... |
Is PAD(EXP) = P? |
|complexity-theory|reductions|complexity-classes|polynomial-time| |
What is the probability of both being in slot 1, both being in slot 2, …., both being in slot m? And since these events are separate, you can add up those m probabilities and get the probability that two are the same. |
Can I say that all languages in the class $\textbf{P}$ are just a padded version of some other problem in $\textbf{EXP}$?
I am familiar with the padding argument, which states that if $\textbf{P} = \textbf{NP}$, then $\textbf{EXP} = \textbf{NEXP}$. I describe the languages obtained by padding an exponential-time pro... |
Can I say that all languages in the class $\textbf{P}$ are just a padded version of some other problem in $\textbf{EXP}$?
I am familiar with the padding argument, which states that if $\textbf{P} = \textbf{NP}$, then $\textbf{EXP} = \textbf{NEXP}$. I describe the languages obtained by padding an exponential-time pro... |
null |
Which function grows faster? f(n) = 4^(n^2 log base 2 (n)) or g(n) = (n!)^n ?
[![functions][1]][1]
[1]: https://i.stack.imgur.com/CHcci.png
Does f(n) = O(g(n)) or g(n) = O(f(n)) or both (i.e., f(n) = theta(g(n))$) or neither of the two?
For lower values of n, it looks like f(n) is bigger but i'm not sure ... |
Which one grows faster, an exponential function where the exponent grows faster than logarithmic or a factorial powered by n? |
|asymptotics|big-o-notation|polynomials|factorial| |
With some manipulations:
$$
f(n) = 4^{n^2 \log n} = (2^2)^{n^2 \log n} = (2^{\log n})^{2n^2} = n^{2 n^2}.
$$
and:
$$
g(n)= (n!)^n \le (n^n)^n = n^{n^2}.
$$
Taking the limit:
$$
\lim_{n \to \infty} \frac{f(n)}{g(n)} \ge \lim_{n \to \infty} \frac{n^{2 n^2}}{n^{n^2}} = \lim_{n \to \infty} n^{n^2} = +\infty.
... |
{"Voters":[{"Id":6759,"DisplayName":"Steven"}],"DeleteType":1} |
{"Voters":[{"Id":6759,"DisplayName":"Steven"}]} |
Which function grows faster:
$$f(n) = 4^{n^2 \log_2 n} \text{ or } g(n) = (n!)^n$$
Which is true?
* $f(n) = O(g(n))$
* $g(n) = O(f(n))$
* i.e., $f(n) = \Theta(g(n))$
* none of the above?
For lower values of $n$, it looks like $f(n)$ is bigger, but I'm not sure for very big values of $n$. |
**The following a small-scale example meant to illustrate the general problem**
Suppose we have 60 marbles that we want to distribute into 3 bowls.
The marbles can take 4 distinct colors and we have: 15 red, 10 yellow, 20 blue, and 10 green marbles.
The bowls have the marble capacities: 15, 20, and 25.
Th... |
Max flow with a minimal in-degree objective on certain nodes (for edges with non-zero flow) |
|algorithms|graphs|optimization|combinatorics|network-flow| |
null |
At our school, we have a schedule that looks like the following (simplified):
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/MJTMs.png
Remarks:
- One course can be taught multiple times a week (to different class-groups, like 1A, 1B and 2A)
- Multiple lessons (even from the same... |
Minimize overlap in class schedule |
|optimization|scheduling| |
We were given this practice question to do in a lecture and its solution afterwards. I have spent hours upon hours trying to understand the solution but still do not understand.
From my knowledge when we are reducing SAT to clique we don't focus on its compliment, so why are we trying to derive the formula from the co... |
Constructing an SAT formula from a Clique graph |
|np-complete|np|3-sat|clique| |
null |
I wouldn't get too trapped in this question as it is only an example. Let's think about the general case. How can we build a formula $\varphi(G, k)$ out of a graph $G$ and an integer $k$ such that $G$ has a $k$-clique if, and only if, $\varphi(G, k)$ is satisfiable? Here's a general construction:
We start by constru... |
You might consider the following instance of an NP-hard problem: [Eternity II][1]. This particular instance has been unsolved for more than 15 years, despite dozens of papers about it. Solving this problem would get significant attention, and if it comes with a claim of having a polynomial time algorithm for it, people... |
null |
null |
I came up with this algorithm for finding all prime numbers from 1 to n. This algorithm could already exist, if it does I don't know what it is called.
primes = []
n = int(input("Enter number : "))
for j in range(2,n+1):
flag = True
for i in primes:
if i*i>j:
... |
What is the time complexity of this algorithm |
|complexity-theory|time-complexity|algorithm-analysis|primes| |
Given a network with flow on the nodes. How can we find min s-t cut in a network with flow on the nodes?
We know how to find min s-t cut whenever there’s a network with flow on the edges (Ford Fulkerson, Edmonds Karp) |
Finding min s-t cut of network with flow on the nodes |
|algorithms|graphs|weighted-graphs|network-flow| |
[![enter image description here][1]][1]
It is mentioned in 22 - 23 Number of Channels which will be 1 if mono, 2 if stereo. So why 22 and 23 (that is 2 bytes) allocated here? With 1 byte, we can put either 1 or 2.
[1]: https://i.stack.imgur.com/X7bSR.jpg |
WAV file header: Why 2 bytes for channel? |
|filesystems| |
Suppose $x$ is divided by $y$, and the quotient is $q$ and remainder is $r$. Then, it means the following:
$$x = q \cdot y + r \quad \quad \textrm{where} \quad r < y. \quad \quad (1)$$
Consider the case when $x = even$. Then, $x = 2x'$. Suppose that $x'$ when divided by $y$ gives quotient $q'$ and remainder $r'... |
null |
The complete statement about completeness for complexity classes is "Problem A is complete for complexity class B under C-reductions."
In many cases it is clear from the context what notion of reducibility we are using, and so we can get away with not mentioning it explicitly. For P-completeness, it is clear that we... |
The dry and somewhat unhelpful answer is: The creators of the WAV file specification deemed 65535 to be a reasonable maximum number of channels.
Any reasonable surround sound system (3.1, 5.1, 7.1) has less than 255 speakers. So the creators must have had other applications of channels in mind, like perhaps [Multitr... |
null |
null |
null |
I'm reading Michael Sipser's "Introduction to the Theory of Computation", and it says:
> THEOREM 1.26
The class of regular languages is closed under the concatenation operation
In [the video][1], if we scroll to the last section, he said that we cannot prove this by "concatenating" `m1` and `m2` together and poi... |
Why can't I prove that the regular language is closed under concatenation by this way? |
|regular-languages| |
I'm trying to understand de construction of a DFA from the book "Introduction to Automata Theory, Languages, and Computation by John Hopcroft and Jeffrey Ullman 1st ed"
It says:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/gqPfj.png
Where it says "If the remainder of i/3 is p, then t... |
Question about remainder in automata construction that checks devisibility |
|finite-automata| |
Actually, that works if you had $\varepsilon$-transitions between final states of $M_1$ and the initial state of $M_2$.
His argument of "maybe the cut of $w$ was wrong and you should have waited longer" is flawed if you consider nondeterministic automata, which are made to explore all possibilities at once.
What ... |
null |
Given the following theorem and definitions from *Introduction to Algorithms* 3rd edition by CLRS:
**Theorem 22.5: (Correctness of breadth-first search**)
Let $G = (V, E)$ be a directed or undirected graph, and suppose that $BFS$ is run on $G$ from a given source vertex $s \in V$. Then, during its execution, $BF... |
Question about step in proof that predecessor subgraph forms a breadth-first tree |
|algorithms|shortest-path|graph-traversal| |
|algorithms|graphs|shortest-path|graph-traversal| |
Actually, that works if you add $\varepsilon$-transitions between final states of $M_1$ and the initial state of $M_2$.
His argument of "maybe the cut of $w$ was wrong and you should have waited longer" is flawed if you consider nondeterministic automata, which are made to explore all possibilities at once.
What ... |
[![file_system_structure_example][1]][1]
As per the author,
>...In this case, we generally need to use a garbage collection scheme to determine when the last reference has been deleted and the disk space can be reallocated. Garbage collection involves traversing the entire file system, marking everything that can... |
How does garbage collection works in operating systems? |
|operating-systems| |
Is your question: "Why $i/3 \equiv_3 p $ implies $2i/3 \equiv_3 2p$?
If so, the premise means that $i/3 = 3k + p$ for some integer $k$. Now, $2i/3 = 2 \cdot 3k + 2p = 3 \cdot (2k) + 2p$, so if you take $k' = 2k$ you have that $2i/3 = 3k' + 2p$, which is exactly the definition of $2i/3 \equiv_3 2p$. |
null |
null |
null |
null |
null |
**The following a small-scale example meant to illustrate the general problem**
Suppose we have $n = 60$ marbles that we want to distribute into 3 bowls, $B = \{bowl_1, bowl_2, bowl_3\}$
The marbles can take the distinct colors $C = \{red, yellow, blue, green\}$ where we have: $n_{red} = 15$, $n_{yellow} = 10$, ... |
null |
null |
I would assume you are familiar with regular expressions since that was introduced in the video you linked. Now consider two regular expressions $a^*$ and $ab$. The first one represents the language that contains 0 or more "a", while the other represents the language that simply contains "ab". Lets assume we have machi... |
null |
I would assume you are familiar with regular expressions since that was introduced in the video you linked. Now consider two regular expressions $a^*$ and $ab$. The first one represents the language that contains string made up of 0 or more "a", while the other represents the language that simply contains "ab". Lets as... |
I would assume you are familiar with regular expressions since that was introduced in the video you linked. However, it seems like nondeterminism hasn't been introduced.
Consider two regular expressions $a^*$ and $ab$. The first one represents the language that contains string made up of 0 or more "a", while the ot... |
I would assume you are familiar with regular expressions since that was discussed in the video you linked. However, it seems like nondeterminism hasn't been introduced.
Consider two regular expressions $a^*$ and $ab$. The first one represents the language that contains string made up of 0 or more "a", while the oth... |
null |
A possibly more efficient algorithm would use dynamic programming. For any subset of the clips $S\subseteq C$ and starting time $t$, calculate and memoize the minimum number of cuts needed to extract the clips in $S$ from the recording starting at time $t$. This gives an algorithm with $O(|R| \cdot 2^{|C|})$ worst-case... |
null |
So a process have scheduler context and trapframe and both of them are allocated in the kernel stack (kstack).
When process wants to transition from user mode to kernel mode, usually due to traps (software interrupts), and while interrupt routines execute, it saves the context of main process in **trapframe**. But ... |
Trapframe vs Scheduler Context in Process Management |
|operating-systems|process-scheduling| |
I'm also learning about Operating Systems. One thing that I observed is that there is lack of quality lectures around this topic due to this topic being extremely tough. So, I tried a new experiment.
I'll now read multiple books and form an opinion. That's the most optimal way in this case.
The books that I've b... |
I think call by value may be pure function or impure function...
And pure function can be written through call by value or call by reference....
|
Call by value is known as pure function how ?give reason |
|functional-programming| |
Typically (from what I can tell) reduction operations produce a "number". This makes them easy to deal with since there isn't really any memory overhead.
However, I have something that I'm working on where I want to combine instances of a nontrivial data structure. That is, if `x` and `y` are instances of some class... |
Parallel reductions with complex objects |
|parallel-computing| |
[![enter image description here][1]][1]I think call by value may be pure function or impure function...
And pure function can be written through call by value or call by reference....
[1]: https://i.stack.imgur.com/Wkz5g.jpg |
[![enter image description here][1]][1]I think call by value may be pure function or impure function...
And pure function can be written through call by value or call by reference....
So according to the facts (c) should be correct ans...
[1]: https://i.stack.imgur.com/Wkz5g.jpg |
null |
The following complexity is not tight; however closeby:
The complexity of the algorithm is at least $\Omega(n \sqrt{n}/\log^2 n)$ and at most $O(n \sqrt{n}/\log n)$.
For any natural number $x$, the number of primes smaller than $x$ is given by prime-counting function $\pi(x)$. It is known that $\pi(x) = \Theta(x/... |
The following complexity is not tight; however closeby:
The complexity of the algorithm is at least $\Omega(n \sqrt{n}/\log^2 n)$ and at most $O(n \sqrt{n}/\log n)$.
For any natural number $x$, the number of primes smaller than $x$ is given by prime-counting function $\pi(x)$. It is known that $\pi(x) = \Theta(x/... |
What is the time complexity of this algorithm of finding all prime numbers? |
I'm trying to order some data in real-time (in an API call) where my item count is on the order of a few million.
I'm using Go, so my pseudo code may resemble that. My input items look like this:
```go
type Item struct {
// SetID is the set this item belongs to. This may be in the
// 100,000s in unique sets.... |
Algorithm for grouping set items into ordered buckets without crossing boundaries between same set items |
|sorting|partitions| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.