instruction stringlengths 35 29.1k |
|---|
Assume we are given a binary tree with an integer sitting at each node. I am looking for an efficient way to find for every path from the root to a leaf every possible product with exactly one node omitted. I am looking for a solution without divisions (i.e. integers can be zero).
One way to go about this I thought of ... |
According to my understanding the difference between them is that in process contention scope there is a contention within the process for mapping user threads to kernel threads and for system contention scope there is a contention within the system for what certain kernel thread to run on the processor. First of all i... |
Are the following well-defined formal languages (in these cases: subsets of {0,1}*) ?
An argument w is a member of L under the following rules...
Example1:
If more than half of w's digits are 1's --> it is a member of L iff it is a member of language A (fill in your favorite decidable A to complete example).
If more t... |
Rather a simple question I guess, though makes me wonder. The standard form I've found in the book (and on wiki) is something like this:
$\min f(x)$
s.t.
$h_i(x) = 0$
$g_i(x) \le 0$
Is this considered a "standard form" for nonlinear optimization problems? And if it is why it's defined like this? Why it has to be exactl... |
Is P/poly known to be in RE?
If yes what other classes is it known to be part of.
|
Let $G$ be an undirected graph.
Find a greedy algorithm that finds a cut $S$ which at least half of the edges cut.
I tried to think about something like choosing the vertex with the highest degree, add it to $S$, remove it from the graph and then repeat this process until I'm done.
However, this is nothing more than a ... |
The definition of binary heaps says that it should be a complete binary tree and it should follow the heap property where according to the heap property, the key stored in each node is either greater than or equal to or less than or equal to the keys in the node's children.
In the above tree, the node with value 70 i... |
The classic solution for the membership problem of a language generated by a PDA is to convert said PDA to a CFG and then to use CYK or a similar algorithm. I was wondering if there are any known algorithms to solve this problem without a conversion to a CFG.
My attempt at a naive solution was to "emulate" a PDA, but i... |
If I want to build an NDTM to enumerate a list (of all Turing machines, for example) is there a way to use non-determinism to "speed this up" or take advantage of it somehow?
What types of of r.e. sets are amenable to this--Where having multiple computational branches helps with the enumeration?
Enumeration is a pretty... |
I recently started studying algorithms on my own using Cormen and MIT algo videos in YouTube. I am going thru Bellman-Ford.
I have 2 doubts about the correctness of the algorithm:
Why are we relaxing (num of vertices - 1) times all the edges? Why not some finite number of times till earlier values and new values rem... |
Say I have two sets of values $A$ and $B$ and for each set I have a computable function from that set to a third set $C$. Now suppose that I want to construct a function from $A$ to $B$, such that if I compose that function with the $B$ to $C$ function mentioned above I get a function that produces the same results as ... |
I am trying to understand the logic of this algorithm so I can implement my own but I am not understanding this diagram I see appearing many times in a fair few articles on the topic. I am teaching myself so I don't have a computer science degree to help. I understand the general idea behind the algorithm, but this but... |
Assume an array a of length $n$. I am wondering how to characterize the difference between time- and space complexity of 32-bit arrays of length $n$ and bit-arrays of length $n$.
Normally, you'd just state the array uses $O(n)$ space and algorithms run in $O(n)$, $O(n^2)$ and so on. But isn't there some difference be... |
I know that strong component in a graph means between any 2 vertices there should be bi-directional path.
My doubt is cycle is always a strong component. can there be any other subgraph with some property P so that it is strong component ie., P implies strong component.
|
Is it possible to construct a not fully turing complete version of a turing machine such that a regular turing machine can solve the halting problem for the Turing Submachine but the Turing Submachine cannot solve it's own halting problem.
|
I have three positive integers, a, b, and c. I know that $a\oplus b\oplus c=0$, so I got that each pairwise xor has to be the other positive integer. $a\oplus b=c$, $b\oplus c=a$, and so on, but I can't find a, b, and c.
There are lots of solutions, (I'm pretty sure), I'm just trying to code a quick way to find all of... |
What's the complexity class of determining the halting problem of a finite memory Turing machine?
What is the computational complexity class of determining whether a machine halts on any input if it is allowed to access no more than $n$ bits of memory.
I know this problem is decidable because due to the limited memory,... |
I'm trying to find a PDA for $L$ which modifies the stack height at most one.
$L=\{a^ib^i\mid i\geq 0\}$
I think there is no such PDA but how can I prove it?
My attempt is for a given string, find a relationship between stack height in PDA and leftmost derivation in CFG then prove that there's no CFG which satisfies ... |
Context:
I have two polyhedra, $A = V_1\times F_1$ and $B=V_2\times F_2$ where $V_i$ is set of vertices (which are just coordonate in $\mathbb R^3$) and $F_i$ is a set of faces (tuples of length $\geq 3$ such as $(i_1,...,i_k) \in F_i$ iff there is a face formed by the $i_1$-th,...,$t_k$-th vertices of $A_i$).
Then, if... |
Can a pushdown automaton solve the halting problem for another Pushdown automaton?
It's already shown here turing machine can solve the halting problem for a pushdown automaton.
Decidability of halting problem for DPDAs with $\epsilon$-transitions?
But can a pushdown automaton do the same?
|
I'm having hard time proving building a balanced BST out of sorted array is $\Theta(n)$
I got the following formula: $$T(n)=2T(\frac{n}{2})+\Theta(1)$$
I tried to prove it by induction but got stuck with the case in which $n$ is an odd number.
Is there a better way to prove it? Substitution wouldn't be considered a val... |
I know that to show that a language is not regular, you are supposed to use the pumping lemma, but I cannot figure out how can I show that a language is regular.
How would I show that the following language is regular?
$$
L=\{0^k1^l∣k+l\geq20, \ k,l \in\ \ N\}
$$
|
Given an $n$ x $n$ board, assume that $n \geq 5$ and that $n$ is not divisible by $2$ or $3$. Prove that the following positioning of $n$ queens $Q_0, Q_2, ..., Q_{n-1}$ works, i.e no two queens threaten each other:
For $0 \leq i \leq n-1$ we position the queen $Q_i$ on the field $(i, 2i \text{ } \pmod n)$.
Here we're... |
I am learning the Quicksort algorithm and I am struggling with understanding the time complexity.
Here is the JavaScript ES6 code for the partition function that is used in the algorithm:
let partition = function(arr, low, high) {
let pivotValue = arr[low];
let i = low;
let j = high;
while (i < j) {
while ... |
I was going through the text, "Discrete Mathematics and its Application" by Kenneth Rosen where I came across the analysis of the Dijkstra Algorithm and felt that the values at some places of the analysis are not quite appropriate. The main motive of my question is not the analysis of the Dijkstra Algorithm in general(... |
I'm given a function which is defined based on a condition, for example
$$
f(n)
= \begin{cases}
4n+1, \ \text{n is even}\\
3n^2+2, \ \text{n is odd}
\end{cases}.
$$
I have to prove or disprove that $f(n)$ is $\mathcal{O} (n^2)$. Do I have to show $f(n) < c n^2$ for all $n > n_0$ for both expressions or do... |
Why this Question is False ?
NP-complete problems are the hardest problems in NP.
if L is in NP-complete then [L must be in NP, all problems in NP can be transformed to L].
Does this mean that L2 is also NP-complete ?
and if so does this also mean that L1 is NP-complete by transitivity ?
|
if A is in P and B is NP, then is A polynomial time reducible to B?
Could anyone prove a prove or disprove for it?
|
I am trying to understand the concept of arithmetic coding, i understand how the range is subdivided after each character is read from the string. But i am unable to understand why using a more accurate model compresses the string. Whether the model is static/adaptive either way the number of characters in the compress... |
I am trying to understand the constraints-based Hindley–Milner type inference algorithm described in the Generalizing Hindley-Milner paper. The function $\text{S}\small{\text{OLVE}}$ is defined as follows:
$$
\begin{array}{l}
\text{S}\small{\text{OLVE}} :: Constraints → Substitution \\
\text{S}\small{\text{OLVE}} (\emp... |
Given an array $A$ of positive integers with size $m$ and an array index $c$ (indexing starts at $1$). Prove using mathematical induction over $m$ that there always exists a contiguous subarray $S$ in $A$ such that the (sum of the elements of $S$) $\pmod {i} = 0.$
I'm unable to find the correct approach to solve this... |
Can someone explain what is Event Detection? What activities or events fall under the purview of event detection? I have searched for some definitions but I am unable to understand. Are events like accident detection, waving hands, building collapse come under event detection?
|
Is $NC_1$ vs PP still an open problem?
I done a few searched but I can't find an answer.
|
I would like to add an additional constraint to the traveling salesman problem: that a given city is visited within a given distance (say 100) from start. Is there a way to do this? My question is related to this unanswered CS question.
I have a mixed integer program using the R package CVXR that find the shortest rou... |
I can't think of any counterexample but I can't find any such statement on the internet or my textbook either. I know that for each uniquely decodable code, there exists a prefix code with the same average length.
|
I have question for you guys. In this question is there something else that I should do ? When i try to solve with the way that my professor thought , its unsolveable. What should i do to solve this ?
'*' means there will be no assignment for that person to that job
|
We recently delved into the concept of "Soft Updates" as a mean of maintaining a Filesystem as consistent. The solution, as we learned it, calls for 3 basic rules:
We'll create a pointer to a file only after the file (Inode) has been created.
To reuse a block, we will first remove all Inode pointers to it.
For rename(... |
I've encountered a Dynamic Programming problem which is a variation of the thief one.
Say you are a thief and you are given a number of houses in a row you should rob :
$$House_1,House_2 \dots House_N$$
with each house having the following values : $$(x_i \geq y_i \geq z_i \gt0)$$
You profit X if you rob a house but ... |
I know why A is irregular by Closure properties of irregular language. I also know the complement of $ \{ 0^n 1^n | n \in \mathbb{N}\}$ is $A = \{ 0^i 1^j| i \neq j\} \cup (0 \cup1)^*(1)(0 \cup1)^*0(0 \cup1)^*$, but I don't see how $A^* = \sum^*$. Any help would be appreciated!
|
I seem to be not understanding correctly what reductions means for Languages.
for example, Lets say there is a Language called LM.
I want to see if LM is recursive or not, to do that lets say I find a reduction from L-Halting problem to LM.
and I assume that LM is recursive, so I show that then L-Halting problem is als... |
is co-NP-hard contained in EXPTIME-hard or vice-versa?
|
Is there a name for the following variant of BFS that operates on trees with non-root starting point?:
Instead of a single queue that all neighbor nodes are added to when processing a node, two queues are used ($Q_A$ and $Q_B$).
Children nodes are added to $Q_A$, and parent nodes are added to $Q_B$.
When selecting the... |
I'm coding an application with a mechanism that performs routine disk cleanup (on smartphone devices, which all use solid-state drives). I want to limit the disk usage to a certain threshold and see two approaches:
Whenever disk usage goes above the threshold by even a single byte, delete as many files as needed until... |
I'm looking for additional constraints that get rid of fractional solutions for the LP relaxation of the Cluster Deletion problem:
Given an undirected graph $G = (V, E)$, find a min. sized $E' \subset E$ s.t. the induced graph with edge set $E-E'$ is a cluster graph, i.e. one in which all connected components are cliqu... |
The idea is to pick a problem category in Co-NP, where the correct answer is hard to verify because of circuit complexity, express it as 1-in-k SAT formula, and show there also exists a short certificate, whose length in bits is exactly twice the number of clauses. It might be true or false that all of Co-NP problems h... |
A language L is verifiable iff there is a two-place predicate R ⊆ Σ∗ × Σ∗ such that R is computable, and such that for all x ∈ Σ∗: x ∈ L ⇔ there exists y such that R(x, y)
A language is semi-decidable iff there is some Turing machine that accepts every string in L
and either rejects or loops on every string not in L.
H... |
Let's say we have the language L = {w $\in$ {a,b}$^*$ : ($\exists n \in \mathbb{N} $)[$w|_b = 5^n$]}. I want to know if this is a regular language or not. How do I go about doing this? I'm familiar with the Myhill-Nerode theorem but I don't know how to apply it.
|
I'm confused about how to know the time / space efficiency.
If there is an array whose size is n, do a for loop on this array, so that time efficiency should be O(n) = n, where n is array size. then if I have two indexof methods in the loop, indexOf and lastIndexOf, should the O(n) become n*(2n)? because each of the ... |
Does an NDTM have the power to combine computational branches ie. can a result from branch A be used in the next step in the computation along branch B? Can branches use each others' results, diagrammatically 'merging'?
Example:
Branch i arrives at the number b after n steps, branch j arrives at the number c after 2n s... |
There exists a variation of the pumping lemma with necessary and sufficient conditions for a language to be Regular.
According to that lemma:
A language $L$ is regular iff $\exists k$, $\forall x\in \Sigma^k$, $\exists u,v,w\in \Sigma^*$, $ x=uvw \cap |v|\ge 1$ such that:
$$\forall i \ge 0,\ \forall z\in \Sigma^*: uvw... |
If I have $f(n) = 2n + 1$ and I have to prove $f(n) \in O(n^2)$, by proving there exists positive constants $c$ and $n_0$ such that $f(n)<cn^2, \forall n\ge n_0$, can I do this all in one step by putting in values of $c$ and $n_0$ at once or do I have to put in values of c first and then get n on one side and put in v... |
I have an integer matrix of size 4n x 4n. I need to select a part of the matrix of size n^2 from which adds up to the most.
For example if n = 3. I have a matrix of size 12 x 12. In the below picture, you can clearly see that n^2 square (outlined in red) adds up to the most. For simplicities sake, I made all the number... |
Lets say we have the following problem:
$$\mathcal{L}_1 = \{\langle \mathcal{M} \rangle | \mathcal{M}\ \text{is a Turing machine and $\mathcal{L}(\mathcal{M})$ contains a string with exactly three zeros}\}$$
We would like to prove that $\mathcal{L}_1$ is undecidable. I would generally use Rice's theorem to prove that a... |
Can order notation on its own imply:
$O(D(n)) + O(t(H)) - t(H) = O(D(n))$
My guess is that you cannot since the constant in the O(t(H)) would still exist after the subtraction if the constant is > 0.
Well, this is actually the case, but there are underlying factors. This equation appears in Fibonacci heap analysis in ... |
I found this How do I verify that a DFA is equivalent to a NFA? but as it states it is not really a good question more of how can I check myself during an exam. Because as you might know to do this by hand for < 5 states is really hard to do without any mistake and I only get credit for a correct construction and not u... |
I know the reason as to why $O(\sqrt{n\log n})$ referee nodes are required. What I don't understand is how to arrive at that value, when I have $7\log n$ candidate nodes. Please forgive me if this is common knowledge, I am new to the field.
|
Another question is about the reasons for calling P/poly "P/poly". My question is instead about its (verbal) syntax rather than its compositional semantics:
How is "P/poly" pronounced (in English)?
Like "p polly"?
Like "p slash polly"?
Like "p given polly"? (Maybe the slash for advice is analogous to slash or vertic... |
M.Sipser's Introduction to the Theory of Computation offers the following problem in its chapter on decidability:
Let A be a Turing-recognizable language consisting of descriptions of Turing machines, {⟨M1⟩,⟨M2⟩, ...}, where every Mi is a decider. Prove that some decidable
language D is not decided by any decider Mi wh... |
A group of students is divided into trios - groups of 3 members. Each student can be assigned to more than more trio. We want to assign their representatives, by choosing exactly one member of each trio. Is such assignment possible?
My goal is to use polynomial-time reductions to transform 3-coloring of a graph into ... |
We want to implement a Queue which has two special operations besides the regular Queue operations: $getMiddle$(returns the element from the middle of the Queue, for example, if the Queue has 7 elements, it returns the 4th element, if the Queue has 6 elements, it returns the 3rd or the 4th) and $popMiddle$(removes the ... |
I have tried solve the recurrence $T(n) = 5T(\frac{n}{2}) + n^2\lg^2 n$ using substitution. Apparently, it is exact for some $n$ and the order of the general solution can be found from this exact solution.
By substitution I got the following (not sure if it is correct):
$$T(n) = 5^kT(1) + \sum_{i = 0}^{k}{5^{i}\left(\f... |
My challenge is to derive three mapping scenarios separately for each memory module of the MPEG-4 to the 2-D mesh, so each task is mapped to a different core, and tasks are executed in parallel.
Here is the graph of tasks - blue circles, rectangles represent memory modules and numbers between memory modules and tasks a... |
I am interested in the mathematical foundations of Artificial Intelligence and Machine Learning. Are there any books which will describe and present the mathematical foundations in detail? I am not that interested in coding and would prefer a text which is heavy in mathematics and the theory.
|
I'm reading through Computer Architecture: A Quantitative Approach, Sixth Edition, and I'm trying to understand the issues surrounding tag storage in using HBM as an L4 cache. The primary concern mentioned in the book is "where do the tags reside?", since the sheer capacity (1 GiB) of the HBM with a small block size (6... |
Show that $O(\text{max}\{f(n),g(n)\})=O(f(n)+g(n))$
Can I keep the same constant $c$ in each of the cases?
Consider two cases:
$$1)f(n)>g(n);O(\text{max}\{f(n),g(n)\})⇒O(f(n))\Rightarrow d(n) ≤c⋅f(n);c>0$$
$$2)f(n)≤g(n);O(\text{max}\{f(n),g(n)\})⇒O(g(n))\Rightarrow e(n)≤c⋅g(n);c>0$$
Combining the 2 cases yields:
$$d(n... |
Please suggest a good for mathematical section of studying cryptocurrency.
|
This question was asked and answered but I cannot understand the solution.
Why is it sufficient to test all strings of |Q| + 1 length?
Why should special state q be found?
the original question:
Show that the set of all TMs that move only to the right and loop for some input is decidable
L2={ M | M is a TM and there ... |
I have a cubic-order algorithm which must be executed sequentially; there appears to be no way of making it parallel.
I need to come up with an estimate of maximum input size that can be solved using today's technology. So, the essential problem seems to be how to relate the cost of a single step to execution time on a... |
Partition Problem:
Input: $A:=$ {$a_{1}, ..., a_{n} $}. $a_{i} \in \mathbb{N}$ $\forall i \in$ $\{1, \ldots, n\}$.
Question: Exists a subset $A_{1} \subset A$ with: $\sum_{a_{i} \in A_{1}} a_{i} = \sum_{a_{i} \in A\setminus A_{1}} a_{i}$ ?
Output: Yes or No.
Makespan Problem:
Input: Jobs $J$ and $b \in \mathbb{N}$.
Que... |
For A,B that are not decidable, does AB U BA not necessarily decidable?
I think that the answer is NO. Not necessarily.
I thought about the following example, but it does not refute exactly:
If we take A and A complement, and without losing generality the empty word is in A, than every word in A' is also in AA' U A'A, ... |
In the Figure 24.13 of Data Communications and Networking, 5/e the first ACK message from the server holds y-1 in it's Sequence no. field. Note that the first FIN message from the client message had y in it's Acknowledgement no. field. So shouldn't the first ACK message from the server be holding y in it's Sequence no... |
I cannot see whether the implication in my question title holds. To me, it sounds reasonable to assume that, but I cannot find any source stating that this is true, false, or unknown at the moment.
So, does $\mathcal{P}\neq\mathcal{NP}$ imply $\mathcal{NP}\neq\mathcal{NP}^{\mathcal{NP}}$?
|
Given a Binary Search Tree and two elements $e1$ and $e2$ which are in the tree, find the length of the shorted path between them. Give the representation of the Binary Search Tree(use a linked representation with dynamic allocation without an attribute for parent or height). Implement the required operation and specif... |
Let's consider an undirected graph with two special vertices: start and finish. The graph is relatively sparse. The edge count is expected to be three times or four times higher than the vertex count.
I am looking for an algorithm that decides whether there exists some path between start and finish and if it is unique.... |
The problem is that you want to travel from the top left corner of a grid to the bottom right corner (You are initially at the top left corner). Now, there are some walls in some cells, and you have a magic wand which you can use $k$ times to destroy a wall. How do we find the shortest path from the top left corner to ... |
I'm struggling to understand one part from the book "Cracking the coding interview".
The author states inserting an element in a dynamic array is $O(1)$ most of the time, except when the array is full and we have to reallocate.
Inserting $X$ elements take $O(2X)$ (because $\frac{X}{1} + \frac{X}{2} + \frac{x}{4} + \ldo... |
While proving the correctness of the Bellman-Ford algorithm, we prove the following lemma:
After k (k >= 0) iterations of relaxations, for any node
u that has at least one path from s (the start node) to u with at most k edges, the distance of from s to u is the smallest length of a path
from s to u that contains ... |
(Practice exam question in computational models)
Definition: A word $w\in \{0,1\}^*$ is called balanced if it contains the same number of $0$s as $1$s.
Let $L = \{w\in \{0,1\}^*\mid |w|$ is even and the first half of $w$ is unbalanced$\}$. Determine whether or not $L$ is context-free and prove your answer. You may do s... |
I want to stress that i am not looking for a proof of this question, but rather if someone(that is familiar with the proof and it's context) can explain to me what the symbol 'e' means in the context.
the letter 'e' first appears in line 6:S $\rightarrow $e...
This is crucial for me, because i am not able to deduct fr... |
My professor taught us that channel capacity of AWGN channel is infinite without any input power constraints. The noise is $Z \sim \mathcal{N}(0,\sigma^2) $. There is no constraint on input signal. I don't understand how the professor can directly say the channel capacity is infinite. Don't we need to maximize mutual i... |
I know that Median of medians itself is $O(n)$.
With a good pivot, QuickSelect is $O(n)$, too -- but with a bad one, it's $O(n^2)$.
But if I now were to use the element gotten through median of medians as the pivot for QuickSelect, what would the new worst-case runtime of QuickSelect be? Would it be $O(n)$ guaranteed t... |
I'm working on an optimization algorithm that I think could be considered machine learning, but I'm not sure. Basically I have a model that I want to optimize by adjusting its parameters. I don't have any target data to compare the output of my model to, so I don't know the loss factor. However, I'm able to generate... |
I have $m$ equations of the following form:
$$x_1+x_2+\cdots+x_n=s,$$
where each variable is either 1 or 0, and the total number of variables is $m\approx3{,}000$. So I’m thinking of modeling each variable as a binary variable and each equation as a CNF formula so that, once I combine all formulas into one CNF, I can s... |
Consider a TCMP system with, say, a 4x4 mesh Network on Chip (NoC) where each tile has a superscalar processor. It is given that that the TCMP uses 64-bit words and the inter-router link bandwidth is 128 bits. So, the size of each flit passing through this network would be equal to 64 bits or 128 bits? I know that flit... |
Special Turing Machine is defined just like standard Turing Machine, only that each step is made according to the content of the tape starting from the left edge to the head position in tape.
(The transition function in this case belongs to Q X Γ* -> Q X Γ X {L,R})
Which of the following is true:
A. Every language L ha... |
Let a changing TM be a TM which is not able to write the same symbol which is being read.
Formal: $M^*=(Q,\Sigma,\Gamma,\delta,q_{accept},q_{reject})$,$\delta(q,a)=(q^*,a^*,c),a \neq a^*$ with $q,q^* \in Q, a,a^* \in \Gamma, c \in \{R,L\}$ .
Now I need to proof that a changing TM is equivalent to a normal TM.
My g... |
I have the following question:
Given graph $G=(V,E)$ with given order on its vertices, I mean $v_1<v_2<...<v_n$ I need to find minimal colors ordered paining of the graph vertices s.t neighbor vertices don't have the same color, I mean:
$(v_1,v_2,...,v_j)$ - painted in fist color and non of them are neighbors.
$(v_{j+1... |
I think I can't understand the meaning of language being decidable.
The next case makes no sense to me:
Considering I have language L1 which is regular, and language L2 which is in RE\R (in particular, it cannot be decided).
The right-division of any regular language with some language is regular, and in particular in... |
Given these in-order traversal lists:
1. 53, 1, 64, 23, 3, 29, 17, 2, 9, 19
2. 49, 32, 51, 71, 32, 10, 21, 8, 13, 11, 41, 17
I need to determine whether each one of those lists represent a valid BST / min or max heap, or none.
I was trying to figure how to approach this, but besides brute-forcing every possible option... |
In s-grammar all productions are in form of A → , A∈V , a∈T , ∈V*
"... and any pair (A, a) occurs at most once in P." [P. Linz, 6th ed. , p. 144]
s-grammar is Unambiguous and i think (not sure) we can describe all Unambiguous-CFL by s-grammar. I want to know can s-grammar describe all possible DCFL or not ? accordi... |
The task is to create a PDA for this language. The |u| a reffers to the number of a's in that word. I have tried working on it as two separate languages that I can later combine, but I fail to even do any of the two.
I would appreciate any help.
|
Is the travelling salesman problem (TSP) $FNP$-complete or is it $FP^{NP}$-complete?
|
In the Theory of Computation tutorial offered by Complexity Tree (I just began the 2nd video), it talks about how the Halting problem was developed to show that mathematics could not be automated. Lately, I've heard quite a bit about automated/automatic theorem proving--some people are even positing that some day math... |
Important note
I know that this question may seem too simple for you scientists; however, here is the best place that I know to post it.
Question
Suppose we have an int with all bits being 0, except for the last which is 11101000. How does my computer understand to return its two's complement i.e. -24 as value and not ... |
I'm interested to visualize how a simple quantum computation can be done, step by step. Can you help me?
I need any simple example of how qubits can be used to make a computation.
|
Given an undirected graph, We need to convert it into a connected graph by adding/removing the edges keeping the summation of absolute difference of change in degree of nodes minimum.
There can be multiple edges.
Formally, we need to minimize: $$\sum_{i = 1}^{i = n} |d_i - e_i|$$
Where, $e_i$ is the new degree of nod... |
I would like to design an algorithm to pack closed paths into a rectangle. An example of one of these paths is below:
The rectangle will have a fixed width, but the height will expand to accommodate the paths.
A Simple Approach I Already Tried:
Calculate the smallest rectangle that inscribes the path. (Results were lat... |
Suppose I have an array of n values I want to apply nested for-loops over to an arbitrary depth m.
const array = [1, 2, 3];
// 2-depth for-loop
for (const i of array) {
for (const j of array) {
// do the thing
}
}
// 3-depth for-loop
for (const i of array) {
for (const j of array) {
for (const k of arra... |
I'm learning the dynamic programming approach to solve the coins change problem, I don't understand the substitution part
Given: amount=9, coins = [6,5,1],
the instructor simplified it with this function:
minCoins = min {(9-6)+1 , (9-5)+1, (9-1) +1} = min{4, 5, 9} = 4
I don't understand the logic of this min method: w... |
It seems to me that Unicode is the "final" character encoding. I cannot imagine anything else replacing it at this point. I'm frankly confused about why UTF-16 and UTF-32 etc. exist at all, not to mention all the non-Unicode character encodings (unless for legacy purposes).
In my system, I've hardcoded UTF-8 as the one... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.