instruction stringlengths 35 29.1k |
|---|
The Problem
Find the shortest sequence of moves that makes up the optimal solution of a level. If there is more than one optimal solution, just find one of them.
Game Rules
The game level is made up of two types of tiles: walls and floors. The player's task is to paint the whole level using a ball that can be moved in ... |
I recently went through a interview session for a SWE/CS role at a well known company.
It wasn't specifically a "coding-round" but was titled a "domain interview" session, so I assumed the interviewer was interested in an discussion/high-level-solution related to the problem.
The problem:
You're given a computation gr... |
I always seem to have trouble finding a formal way to analyze this (be through proofs or whatever).
The problem statement is as such:
If A and B are friends, and B and C are friends, then A and C are friends too.
In a simple network like the following, this makes complete sense:
1 --- 2 --- 3
Analysis:
We can see that ... |
I have been looking for a maths operation that allows me to combine functions in a specific way. For example if we have functions f and g both with single mappings from o to e and v to c respectively, and we want to achieve whats below.
f ? g = {o -> e} ? {v -> c} = {(o,v) -> (e,c)}
I have been told that what I'm look... |
I'll keep the reasoning abstract.
If I start from a mathematical formulation of a problem $A$ known to be $NP$-hard, I add a set of constraints which creates a problem $A'$.
However, I do know that there exists some instance of the problem for which the new set of constraint is empty, which brings, for those instance, ... |
I'm asking about the question described here:
Knapsack Problem with exact required item number constraint
Can't we iterate over $\binom{n}{L}$ options (which is polynomial), and for each option check if the constraints are met?
|
The algorithm iteratively picks the vertex with maximum degree and removes it and every incident edge of the vertex, until only vertices with degree of $0$ are left.
Formally:
$\text{GreedyVertexCover}(G)$:
$C\leftarrow \emptyset$
While
$(E\neq\emptyset)$
$\hspace{10pt}\text{Pick a vertex }v \text{ that has maximum deg... |
I have a ×
rectangular grid of cells, and a set of rectangles within this grid. Each rectangle is a subset of the cells. (Alternatively, you can think of them as axis-aligned rectangles where each of the four corners has integer coordinates.) Some of these rectangles overlap and some of these rectangles are adjacent. ... |
In the Inclusive Vertex Cover problem, For a given graph $G=(V,E)$, each vertex $u\in V(G)$ has weight $u_{w} \in \mathbb{N}$ and value $u_{v}\in \mathbb{N}$. The value and weight of a set cover $S$ are defined as the sum of weight, value of the vertex in the cover, and its neighbors. Note that a vertex might be counte... |
I am trying to solve a problem efficiently.
The problem is to recurse over a set $\{0,1,\dots,n-1\}$ (as array) in ascending or descending order, while removing or re-adding items in $O(1)$ time.
A sample algorithm is shown below (pseudo-code):
function countswaps(n, x, y, unvisited)
{
c = 0;
remove(x, y from u... |
Design a grammar for the language
$$F = \{x^a y^b zx^b y^a\mid a, b\geq 1\}$$
I'm trying to get a stronger grasp of designing grammars for languages. A thorough explanation of how to design the grammar for this language would be very much appreciated.
|
I hope this question doesn't offend anyone. I start off by saying that I have and always had difficulty understand the language used in computer science so I have to interpret everything into the language of physics of electronics.
First what is termed as memory, I seem to think that it refers to energy that is held ba... |
Suppose you are given a directed acyclic graph $G$ with $n$ vertices and an
integer $k \leq n$. Each edge has an associated weight $w(u,v)$. We want to find $k-$vertex-disjoint paths that cover all vertices of the graph such that it minimizes the total sum of the weights of all edges in the paths. (assume such $k-$ pat... |
$C$ here represents combinations.
$$
C(n + m, m) = \frac{(n + m)!}{n! m!} = \frac{(n + m) * (n + m - 1) * \ldots * (n + 1)}{m!}
$$
In this formula it looks like it's $O(m)$ because both the numerator and denominator is $O(m)$, if I'm not mistaken.
Alternatively,
$$
C(n + m, m) = \frac{(n + m)!}{n! m!} = \frac{(n + m)... |
This is the PARTITION problem:
Given a multiset S of positive integers, decide if it can be partitioned into two equal-sum subsets.
This is the SUBSET SUM problem:
Given a multiset S of integers and an integer T, decide if any subset of S sums to T.
The positive variant of SUBSET SUM is NP-complete.
SUBSET SUM can... |
Let's consider the following simple algorithm for attacking the Travelling Salesman Problem:
Choose the pair of cities $(A,B)$ where $A\neq B$ and the distance between $A, B$ is minimal amongst all the distances of the cities. Start with $A$, then visit $B$, then in each step visit the nearest city not visited already... |
The book CLRS says that any comparision sort algorithm requires omega(nlgn) comparisions n the worst case. My question is that why for heapsort it's O(nlgn) not omega(nlgn) since heapsort is also a comparision based algorithm?
|
Given graph $G=(V,E)$ and weight function $w\,:\,E\to\mathbb{N}$, function $f(G,w)$ finds the heaviest clique in the graph, when the sum of a clique is the sum of the weights on all of the edges.
I want to prove that there is a Turing machine $M$ so I will get $L(M)=CLIQUE$, using function $f$, where $CLIQUE$ is the la... |
The output given by this nearest neighbor algorithm for the Travelling Salesman Problem can be arbitrarily bad. In the example constructed here, the triangle inequality doesn't hold in most cases.
Let $L$ be the set of positive real numbers $r\in\mathbb{R}_+$ such that for every setting of TSP such that the triangle eq... |
I'm new to the site.
I had a test a few days ago and failed it, I had a question I did not understand.
This is the question:
Let's look at the FALSE language: Collect all the verses P in the form of CNF so that any placement on the variables P will not satisfy P. We will mark the number of variables in N and the number... |
I'm looking at the methods posted in https://www.geeksforgeeks.org/program-to-find-whether-a-no-is-power-of-two/ for checking whether n is a power of 2.
Method 5, pasted below, in the link claims to be O(1) but shouldn't it be O(log n)? When we do n & (n - 1), that's a bitwise operation over 32 bits (since n is a 32 bi... |
I'm new to networking so please bear with me. My textbook gives 4 as an answer, but I'm not sure I understand the question:
What's a "/20-subnet"? My understanding is that a network mask (/20) is used to give structure to a classless IP-address, i.e provide a way to distinguish network bits from host bits. In this cas... |
In the answer to an earlier question "SAT algorithm for determining if a graph is disjoint" a formula is constructed that is satisfiable iff a given graph is connected.
The formula uses a lot of variables, as basically a breadth first search is performed and the variables code the number of steps needed to reach a vert... |
What's so hard about creating a piece of software with as minimal as possible mathematical axioms, defining a formal language in which one can create new constructs based on the existing ones, and then all research papers could be written in that language and its correctness verified by a computer?
|
I have an assignment problem where I need to assign resources to consumers. Each consumer has a list of resources it'd like to acquire, ordered by preference, and each consumer can have at most one resource. I'd like to find a mapping from the resources to the consumers that tries to satisfy each consumer's preferences... |
Given a boolean vector b representing a solution to the knapsack problem with n elements k capacity and where each element has integer weight and value.
Proving that the solution is a solution is trivial. You add all the weights multiplied by the selection coefficient and check if it adds to more than the capacity.
But... |
I am a student who wishes to research neural networks (ANN, CNN, RNN) and deep learning, write papers on those topics, and actively participate in forums like CVPR.
My question is:
Which professions are dedicated to researching the theories behind, and developing models of, deep learning and neural networks?
Taking the... |
Consider Intel x86 and AMD x86 Processors. As I understand, since they use the same Instruction Set, in theory an application compiled for Intel x86 processor would run without any modification on AMD x86 processor, even though these processors have different microarchitectures. Is my understanding correct? Or is ther... |
I'm trying to understand Figure 1 in this theoretical description for queues: https://www.cs.bgu.ac.il/~abraham/courses/Concurrency14/2(Logic)/3.Qexample.pdf
Key excerpts from the PDF:
I grasp everything except 3(c). How can a dequeue event have a preceding enqueue event which is not in the range of the gamma functi... |
Here is a question that I do not understand:
There is a list of items $E = e_1,\dots,e_m$. Suppose we have two players (the first and second).
Each item $e_j$ has a value $v(e_j) \ge 0$. The values are not necessarily integers.
The value of a set of items $A \subseteq E$ is $v(A) = \sum_{e_j \in A} v(e_j)$.
Let's look... |
The question is
Convert the following 16-bit binary numbers to two 8-bit signed
integers (two’s complement) in decimal.
i. 0b 0011 0110 1101 0100
I first flipped it and added 1 to it which equaled
0b 1100 1001 0011 1100 which is 51516 in decimal
Is this right? I don't really understand what the question is asking for... |
Let $w$ be a string over an alphabet $\Sigma$. It is obvious that $w \circ \epsilon = \epsilon \circ w = w$.
However I'm having a hard time coming up with a proof for that (which I assume should be fairly easy, I just don't know how to tackle it).
My first thought on how to do it is the following:
$\Sigma^{*}$ is the s... |
Consider an equations of the form: (a + x) * (b + y) - c = 0
Or: (a + x) * (b + y) = c
Or: x * y = c
Classifier evaluates these equations as binary quadratic type.
Are they can be solved only for exponential time? Or there is another way?
|
A few days ago I had a test and could not pass it. This is a question I did not understand in the test.
We will look at the Edge-Coloring problem, in which, as is well known, we get as input graph G = (V, E) and natural number k and ask "Is there a coloration in arcs of G which uses at most k colors?". Remember, while... |
The following English sentences have different forms (syntax):
Declarative: You are my friend.
Interrogative: Are you my friend?
Imperative: Be my friend!
Exclamative: What a good friend you are!
They also have different meanings (semantics):
Statement: You are my friend.
Question: Are you my friend?
Command: Be my ... |
Deteremine if $L = \{\langle M\rangle : L(M) \text{ consits of all words of prime length}\}$ is in $R$ or in $RE\setminus R$ or not in $RE$
I am trying to prove that $L$ is not in $RE$ by reduction from $L_{acc}^c = \{M,w: w\notin L(M)\}$ to $L$, but I it seems not works for one side and I have no idea how can I fix ... |
a few days ago I had a test and could not pass it. This is a question I did not understand in the test.
Recall the reduction we saw $SAT \leq _p 3SAT$. Given verse $\varphi$ in the form of $CNF$, we converted each fragment $C_i$ in $\varphi$ to verse $D_i$ in the form of $CNF$ by adding new variables. Then, we returne... |
Trying to get a fair understanding of our artificial immune systems. To do this I’ve been reviewing this paper, but the algorithm and mathematics is over my head, could someone explain the below to me in simple terms. Thank you
In the case of this paper, I’ve been able to understand that the system takes the IoT-Bot da... |
a) For $\sum =\{0,1\}$ , design a deterministic finite automaton $M$ accepting the language $L=\{a^ib^j:i,j\ge 1, \text{5 divides (2i+3j)}\}$
b) Prove that ypur automaton exactly accepts the language $L,$ i.e $L=L(M)$
I first find $i,j$ relation .
since $5|(2i+3j) \Rightarrow j=i+5k, k\ge 0(\in \mathbb{N})$
Theref... |
I understand how the UF algorithm works to detect a cycle in an undirected graph, but I don't understand why it always works. Could someone explain that intuitively?
Specifically, I don't understand why if you come across an edge that between nodes $u, v$, and if you see that $u$ and $v$ are already in the same disjoin... |
This is a cross-posting from here, on the mathematics Stack Exchange. I thought this might be a more appropriate venue.
The problem is this:
I have a list of sets $$S_1, S_2,... S_N$$ where each set contains $m$ elements, all drawn from some larger set $A$. The challenge is to find the largest set $$K\subseteq A$$ such... |
Problem A:
Given an algorithm $\mathcal{A}$ for $(I,k)$,$k\in \mathbb{N}$, $A$ return true $\iff$ There exist a subset $S\subseteq I$ s.t $|S| \le k$ some property hold.
Problem B:
Given an algorithm $\mathcal{A}$ for $(I,k)$,$k\in \mathbb{N}$, $A$ return true $\iff$ There exist a subset $S\subseteq I$ s.t $|S|=k$ some... |
I have a strongly connected component (SCC) of $n$ vertices. Let $n_1n_2$ be an edge between two vertices $n_1$ and $n_2$ in this SCC. Is there an efficient algorithm to check if removing the edge $n_1n_2$ splits the SCC into two SCCs or not? The graph I am using is a directed graph.
|
I have a question in complexities that I could not do.
There will be D, E, F, three languages belonging to NPH. Suppose that the reductions exist $D \leq _P E$ and $E \leq _P F$.
Determine which of the following statements is correct:
Inevitably there is a reduction $F \leq _P D$
If there was an $F \leq _P D$ reductio... |
I have a question I was unable to do, from a last test I had.
This is the question:
Suppose that there is a language $A \neq \emptyset ,\sum{_{}}^{*}$ such that $A \in CoNP - CoNPC$.
Determine which of the following statements is correct:
In this case it is possible to find a language $B$ such that $B \in CoNPC\... |
I couldn't help but notice the opening summary in Wikipedia's article on Bottom Types:
In type theory, a theory within mathematical logic, the bottom type is the type that has no values. It is also called the zero or empty type, and is sometimes denoted with the up tack (⊥) symbol.
Is the visual similarity to an act... |
I have a question from a test that I could not pass, I could not answer the question and I am looking for help with this question
This is the question
Will be $A\in \mathbf{NP}$
Suppose that $A\notin \mathbf{coNP}$. determine which of the claims is correct:
$\mathbf{P}=\mathbf{coNP}$
$\mathbf{P}=\mathbf{NP}$
$\mathbf{... |
Considering a dynamic array that grows by a constant factor $k$ (the new array has $k$ more cells than the last one) each time the array is full which initially has $n$ elements in it. Calculating the amortized time for insertion:
Consider a sequence $m$ worst case insert operations, then we have constant time for each... |
I am trying to understand the connection between The W-hierarchy as presented in chapter 13 of this book by Cygan et al. and the notion of the NP problems.
Is the existence of an FPT algorithm for a problem in W[1] suggests that P=NP? Why?
For example, assuming I have an FPT algorithm for the k-Clique problem. Can I pr... |
A few days ago I had a test that I failed to pass, and it had a question that I failed to do.
This is the question
Let's look at the language $L_\mathrm{loop} = ${
$\left \langle M,w \right \rangle$ | When $M$ is activated on the input $w$, the machine $M$ enters an infinite loop }
We will mark our input length: $|\lef... |
I have a question from a test that I failed to pass, I failed to do the question.
The question:
Let's look at the problem of the even-length traveling agent. Given graph $G = (V,E)$ and a weight function on the arcs of the graph $W:E \rightarrow \mathbb{R} ^ {+}$ we would like to find an easier route (of the routes of ... |
I had a test that I failed to pass, and it had a question that I failed to do.
This is the question:
Let us look at the language TAUTOLOGY: Collect all the phrases $\varphi$ so that each placement on the variables $\varphi$ will provide $\varphi$. We will denote the number of variables in n and the number of phrases in... |
Could someone explain me how the CPU address the secondary storage? If the CPU needs data that are stored on a HDD (for example), could the CPU address the HDD directly? And the data are transfered directly to the CPU or are first copied into RAM?
I'm talking about a system without DMA.
Thank you
|
A few days ago I had a test that I failed to pass, and it had a question that I failed to do.
the question:
given:
$A \in NPC$
$A \in CoNP$
Determine which of the following statements is correct:
$P\neq NP$
$P\neq CoNP$
$NP\neq CoNP$
$NP=CoNP$
None of the above claims are true.
My idea to solve this, is to choose a l... |
How can I reduce Subsetsum (or maybe other np-complete problem) problem to the problem below?
input : a weighted graph $G$ and numbers $l$ and $u$.
output : Does $G$ has spanning tree, $S$, such that $l \leq \mathrm{weight}(S) \leq u$?
|
I have a dataset with and ID and a date looking like:
+----+------------+
| ID | date |
+----+------------+
| A | 2021-07-20 |
| B | 2021-07-20 |
| C | 2021-07-20 |
| A | 2021-07-20 |
| A | 2021-07-21 |
| C | 2021-07-21 |
| C | 2021-07-21 |
| B | 2021-07-22 |
| C | 2021-07-22 |
| D | 2021-07-22 |
| . |... |
Suppose you're given a string $s$ that consists of lowercase alphabetic letters only. The length of the string is $n$. You are also given $n$ cards, which have lowercase alphabetic letters on the front and back. You want to arrange (shuffle and/or flip each card) the $n$ cards in an order that produces the string. You ... |
I want the algorithm to be in polynomial time and the correct answer rate is 0.5 or more. (True / false judgment is polynomial time)
All the methods I think of take exponential time(2^n).
Can anyone help me?
|
I have been practicing NP-Hardness reductions and have been particularly interested in the language $L = \{ (S,k) | \exists S' \subset S \text{ s.t } \forall x \neq y \in S' \gcd(x,y)=1 \text{ and } \sum_{s \in S'} s \geq k \}$. I am trying to prove that $L$ is NP-Hard and have come up with the following reduction from... |
I have an Object Pool and I will be using it to create Objects. I want to generate an unique id for each object. id should be an integer starting from 0. Ids should be continuous. When an object is deleted that id should be reusable. So that next object created can reuse that id instead of a new id.
And also if there ... |
I study complexity and computation independently.
I have a problem that I can not solve.
That's the problem:
Edge-Coloring problem, we get as input graph G = (V, E) and natural
number k and ask "Is there a coloration in arcs of G which uses at
most k colors?". While painting vertices to two neighboring vertices
must n... |
Prove: $n^{5}-3n^{4}+\log\left(n^{10}\right)∈\ Ω\left(n^{5}\right)$.
I always get stuck in these types of questions, where there is a $"-(xy^{z})"$ in the expression.
Whenever I see the solutions for these type of questions, I can't identify a single method that works every time and it's frustrating. How do I approac... |
Is it because it uses 3 way handshaking, it is reliable? Or is it due to other reasons? Like due to congestion control, flow control and error control in TCP? Why do we call TCP as reliable?
|
I am trying to prove the following statement.
if $\displaystyle \lim_{n\rightarrow\infty}\frac{f(n)}{g(n)}= \infty$, then $f(n) = \Omega(g(n))$ but $f(n) \neq O(g(n))$
What I've done so far
Using the definition of limit: $\forall M>0 \quad \exists n_0 : \forall n \ge n_0 \quad \displaystyle\frac{f(n)}{g(n)} > M$
So I... |
I have a question that is not clear to me, and I have not been able to answer it from a test I had.
This is the question
Let's look at the language $L_\mathrm{reject} = ${
$\left \langle M,w \right \rangle$ | When $M$ is activated on the input $w$, the machine $M$ reach to reject state }
We will mark our input length: ... |
The language given is $L = \{w_1xw_2\mid w_1,w_2\in \{a,b\}^* \text{ and } x \in \{a,b\}\}$. Is this language regular or not?
Since there is no pattern, so it should be non-regular?
Kindly help!
|
Studying for my finals and stuck on the following question:
Prove or disprove: Given an undirected and connected graph $G=(V,E)$ and three different vertices $u,v,w\in V$ then there exists some number $x$ so in any run of BFS from vertex $w$, the distance from $u$ to $v$ in BFS tree is always $x$.
I think it's not tr... |
I suspect that it is not true but I came across with the following statement:
For any direct graph $G(V,E)$, there is always an iteration of DFS algorithm on $G$ so the result does not have any cross edges.
Is it possible to show an example to disprove it?
|
I have a question that is not clear to me, and I have not been able to answer it from a test I had.
This is the question:
Let's look at the problem $Oclique$ , In it we get a graph $G = (V,E)$ , And an odd natural number $k \in N$ ( You can mark: $k = 2d + 1$ for $d \in N $) And ask: "Is there a $U \subseteq V$ clique... |
In the Erickson Algorithms textbook (file:///C:/Users/G068078/OneDrive%20-%20Kaiser%20Permanente/Algorithms_Technique_and_Theory_CS_388G/Undergraduate_CS331/Algorithms-JeffE.pdf)
it has pseudocode for 'momselect':
This is probably a really basic question but I do not get how it ever gets past the red part. It recurse... |
Why the grammar is not (LL1)? (e is the epsilon)
$$S \to a A \mid b B \mid a C c $$
$$A \to a A \mid a a A \mid e $$
$$B \to c C \mid D \mid e $$
CHOICE 1: The grammar is Left-Recursive (LR)
CHOICE 2: The grammar is Non-Deterministic (ND)
CHOICE 3: The grammar has FIRST-FOLLOW conflict(s)
CHOICE 4: Both 1 and 3
CHOICE ... |
Given an unweighted graph $G$, the problem is to add links to the graph with total minimum cost such that the diameter of the graph becomes at most a constant $k$? The cost of adding a link $(u,v)$ is the shortest path length between $u$ and $v$ in $G$.
Has the above problem been looked at? Is it NP-complete?
|
I study complexity and computation independently.
I have a problem that I can not solve.
That's the problem:
Edge-Coloring problem, we get as input graph G = (V, E) and natural
number k and ask "Is there a coloration in arcs of G which uses at
most k colors?". While painting vertices to two neighboring vertices
must n... |
I am solving an interview practice question:
Partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.
My solution is as below, and was accepted.
def partition(self, s: str) -> List[List[str]]:
ans = []
def bt(w, curr):
if not w:
... |
I study complexity and computation independently.
I have a problem that I can not solve.
That's the problem:
For the SAT problem, there is a version in which we receive as input phrase $\varphi$ in the form of CNF and we have to decide whether there is a placement in each of the closures $\varphi$ provides at least one... |
I have a question I was unable to do, from a last test I had.
This is the question:
Will be $A \in NP$
Let $c \in P$ be a language so that there exists $C \leq _pA$. Determine which of the following statements is correct:
$C \notin CoNP$
$A \in P$ if and only if $C \in P$
There is at least one case in which $A \in P$.... |
This was an algorithm problem but I am having problems in formulating it.
I have a certain approach but I do not know how to fully execute:
Given
26 letters in total
All possible strings of length n
Example
Find all possible strings of length 5 such that given [{a, b, c}, {d, g, h}], no two letters from each set can ... |
The pushdown automaton is given as the below diagram.
What I know are as below.
$$ 1,0 ~\texttt{->}~ \epsilon_{} ~~ \leftarrow~~ \text{As 1 is inputted then 0 will be popped from the stack} $$
$$ 0,1 ~\texttt{->}~ \epsilon_{} ~~ \leftarrow~~ \text{As 0 is inputted then 1 will be popped from the stack} $$
$$ 0, ... |
I'm an experienced Software Engineer but very weak in concurrency because of no prior experience in that. I've been interviewing with several companies in which I was asked similar kinds of questions as given below:
If you are designing a fantasy sports application in which there's a contest that can handle only 100 u... |
$f (n) = Θ(f (n/2))$
The counter example in the solutions was $f(n)=\sqrt{n}$.
But then we get for every $n\ge n_{0}$
$\sqrt{n}\le c_{0}\sqrt{\frac{n}{2}}\ \ ->\ \ n\le c_{0}^{2}\cdot\frac{n}{2}\ \ \ ->\ \ 2n\le c_{0}^{2}\cdot n\ \ ->\ 2\le c_{0}^{2}$
and I don't see a problem with that, as we can choose $c_{0}=2$. S... |
$(3 \cdot d) \mod 8=1$. I know the answer is $d=3$ by common sense. But what is the mathematical approach to solve this problem? How do I solve this mathematically?
How do we get this value of 125^107 mod 187=5?
|
Problem. Given positive integers $a$ and $b$, obtain $\frac{a}{b}$ without using division ($/$) directly, though addition ($+$), subtraction ($-$), multiplication ($\times$) and bit-shifts ($\gg$ and $\ll$) are allowed.
Is there a good algorithm to solve the aforementioned problem? This algorithm does not have to be v... |
The following seems to me to be relevant to this question, but to me is an interesting exercise, especially since I have not formally worked with complexity before, but I want to learn more:
Suppose that A is NP-Complete, but B is in P. I claim that A\B is NP-Complete and B\A is NP-Complete as well. To see this, assume... |
My question has to do with the disagreement coefficient in active learning. I've been trying to solve the following question, where I need an algorithm to derive a confidence interval for $\theta$, the disagreement coefficient of a given distribution $\cal D_\cal X$, defined in these notes by Shai-shalev shwartz:
Let $... |
If the complexity of my problem is $O(f_n(n))$ begins at $n =4$ and increases in this sequence:
At
$n = 4$ the number of operations = $(n - 2)$,
$n = 5$ the number of operations = $((n - 2) (n-2)(n-3)/2)$
$n = 6$ the number of operations = $((n - 2) (n-2)(n-3) (n-3)(n-4)/4))$
$n = 7$ the number of operations = $((n-... |
I've came across the optimization bellow
$\phi=argmin_{\theta} \displaystyle\sum_{i=1}^{N}f(x_i,\theta)$
Can i say that minimizing this summation by minimizing each term $\left(\displaystyle\frac{df(x_i,\theta)}{d\theta}=0\right)$ as a such author did is a example of greedy approach? Since i'm minimizing the "whole thi... |
I have a question from a test that I failed to pass, I failed to do the question.
The question is about the reduction between Clique and Subset Sum. I tried to find an explanation for this on the internet and in the books but could not find anything.
Recall the expression problems:
$Clique(G, k)$ - Is there graph G wi... |
I have a directed acyclic graph. Where each node is a task and each edge denotes a dependency.
I want a method to effectively parallelize these tasks. One way would be to topological sort them based on depth. Node a which has no precedents will have depth 0. For other nodes, depth will be the depth of precedent with t... |
I have a question from a test that I failed to pass, I failed to do the question.
The question:
Let A and B have two languages so that there is a reduction function f: $A\leq _pB$.
Suppose that $A \in NP$. We will mark the verification algorithm for A in $M_A$. We will now provide a verification algorithm showing that ... |
Studying for my finals. So I'm reading the "Introduction to Algorithms (Third Edition)" book. In the DFS section there is the following section:
Depth-first search yields valuable information about the structure of a graph. Perhaps
the most basic property of depth-first search is that the predecessor subgraph
$G_{\pi}... |
Alice has a list of secret numbers. Alice wants to give Bob the opportunity to choose one of her secret numbers, and then Alice has to share that specific secret number, but in such a way that Alice can’t know which secret number Bob got to know. Is this known to be possible?
|
I have been given some problems like:
Determine if each of the following strings belongs to the corresponding regular language.
i. ‘10100010’ and L((0*10)*).
iv. ‘011100101’ and L(01*10*(11*0)*)
I just wanted to know the strategy to answer such questions. Show me the working for two of them. Thanks.
|
The set of all words contained in $\{0,1\}^*$ that have an even number of 0’s and an odd number of 1’s.
I came to discover that it is possible but not sure how. Can anyone express it in a regular expression?
|
Large portions of the possible research areas in Automatic Differentiation have broadly defined known solutions; most of which were derived in the 80s and 90s.
Compute vector jacobian products: use reverse mode.
Compute jacobian vector products: use forwards mode.
(other things are a bit less solved, but still, we have... |
Consider:
Constants and variables
If-then-else-elseif statements
Procedures and loops
The very fact that a program is comprised of two or more files (instead just from one large file)
Each one of these features indicates "modularity" but what really makes a program modular by any rigorous standard of computer science... |
I understand uncountably many such languages exist, and the rationale for it is clear to me.
I just cannot think of one trivial, easy-to-prove example.
For instance, the complement of a^nb^nc^n is CF, and for more complicated examples I'm often not even sure what the complement is.
|
In my book,the $O$-notation is given as:
$$O(g)=\{f:\mathbb N\rightarrow \mathbb R_{\geq 0}:\exists \alpha\in \mathbb R_{>0},\exists n_0 \in \mathbb N : \forall n\geq n_0 f(n)\leq \alpha g(n)\}$$
The algorithm(in pseudocode) for simple primality is given as:
input: $n\in \mathbb N$
output: $result$
main code:
if($n<2$)... |
On Hackerrank I found a test that asks to check what the following algorithm computes:
If $x > y$ then $x = x - y$
If $y > x$ then $y = y - x$
If $x \neq y$ then goto 1
Print $x$
Constraints: $x$ and $y$ are greater than $0$
So I think/guess this algorithm returns the product of common factors, so 1 when they do not ... |
I am a tenth grader. I currently learnt about sorting algorithms in java in school. I started with the book "Algorithmic Mathematics" so as learn about algorithms mathematically. I know very little calculus(just started limits) and thus, I had difficulty following it knowing that I am not mature enough to read it .Thus... |
According to Tanenbaum's Modern operating systems,
The purpose of this field is to detect replay attacks. These sequence numbers may not wrap around. If all $2^{32}$ are exhausted, a new security association must be established to continue communication.
According to Forouzan's Data communications and networking,
In... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.