instruction
stringlengths
0
29.8k
⌀
Placement of Tasks from Dataflow Graph on a Physical Graph
|graphs|optimization|linear-programming|integer-programming|constraint-programming|
I've come up with a greedy algorithm proof for the minimum denominations problem, and I'm curious if someone can verify the correctness of the proof for me. I have simplified the problem by restricting the denomination set to the US Coinage System. Thank you very much in advance. **A Formal Definition of the Problem...
To understand this proof you must first understand 1. NP vs P problem 2. The quantum eraser experiment 3. True randomness Before we start I must first assert things that have been proven to be true, if you question any of my assertions feel free to research them yourself. - True randomness does exist (demo...
null
I've come up with a greedy algorithm proof for the minimum denominations problem, and I'm curious if someone can verify the correctness of the proof for me. I have simplified the problem by restricting the denomination set to the US Coinage System. Thank you very much in advance. **A Formal Definition of the Problem...
I've come up with a greedy algorithm proof for the minimum denominations problem, and I'm curious if someone can verify the correctness of the proof for me. I have simplified the problem by restricting the denomination set to the US Coinage System. Thank you very much in advance. **A Formal Definition of the Problem...
null
I study computer science and I was taught that sometimes one can test tests. The lecturer did not used citations. One other programmer told that this is not useful. Is there any research showing pros and cons of testing tests?
Should oneu test tests?
|testing|
Should one test tests?
It seems like you misunderstand what NP stands for and what the 3SAT problem is. NP stands for Nondeterministic Polynomial, which means that a non-deterministic Turing machine can guess a solution to the problem and determine the solution is correct in polynomial time ("Nondeterministic Polynomial Time", 2019). A probl...
It seems like you misunderstand what NP stands for and what the 3SAT problem is. NP stands for Nondeterministic Polynomial, which means that a non-deterministic Turing machine can guess a solution to the problem and determine the solution is correct in polynomial time ("Nondeterministic Polynomial Time", 2019). A probl...
It seems like you misunderstand what NP stands for and what the 3SAT problem is. NP stands for Nondeterministic Polynomial, which means that a non-deterministic Turing machine can guess a solution to the problem and determine the solution is correct in polynomial time ("Nondeterministic Polynomial Time", 2019). A probl...
In practice, this is not done. In fact, in the work place, people joke about testing the tests. However, if your tests utilize a modular piece of code that can use some testing, then write some unit tests for it. In this scenario, you are not really testing the tests, but you are testing a piece of code that is utilize...
In practice, this is not done. In fact, in the work place, people joke about testing the tests. However, if your tests utilize a modular piece of code that can use some testing, then write some unit tests for it. In this scenario, you are not really testing the tests, but you are testing a piece of code that is utilize...
In practice that happens as soon as the software you are testing is good enough (during development) that it should pass the test, and the test declares failure. At that point you know that software or test are faulty and find the fault. And if I want to make sure your test detects faults in my software, then I wil...
Theorem: given a graph $G$ with $k$ components, the number of edges $m$ is inside the range $$ n - k \leq m \leq \frac{(n-k+1)(n-k)}{2} $$ You can find the proof of this theorem in Chapter 3 of "Graph Theory " by Robin J. Wilson. So I will skip the proof, if you need I will edit the answer. If a graph has two ...
null
I know that an algorithm can't decide whether another algorithm halts on an input or not (a Turing machine can't decide whether another Turing machine will halt on an input). But I, as an human, can: I mean you just don't end up in your activity as a programmer with a looping algorithm and you don't know why! To do thi...
Why can't humans translate all of their abilities into an algorithm? Will that hold true in the future?
|turing-machines|computability|artificial-intelligence|philosophy|
I know that an algorithm can't decide whether another algorithm halts on an input or not (a Turing machine can't decide whether another Turing machine will halt on an input). But I, as an human, can: I mean you just don't end up in your activity as a programmer with a looping algorithm and you don't know why! To do...
null
You are essentially reasoning on the language $A_{TM}$ rather than on $PCP$ instances. An algorithm such as the one you mention will show that $A_{TM}$ (i.e. the language of pairs of Turing machines a words such that the Turing machine accepts the word) is a semi-decidable language. Now, the complement of $A_{TM}$ is n...
A problem in NP with the answer “yes” can be solved by getting a clever hint followed by a polynomial time verification. We could solve it very very slowly by enumerating all possible hints. Which means it is semidecidable, since solving the “yes” cases is enough to be semidecidable.
Given a set of $n$ numbers $\{a_1,\ldots,a_n\}$ and a target $T$, find a subset $S$ from $\{a_1,\ldots,a_n\}$ of contiguous elements, that is $S=\{a_i,a_{i+1},a_{i+2},\ldots\}$ for some $i$, such that $|S|$ is minimum and $\sum_{a\in S}a\geq T$. My algorithm is an exhaustive search one. - Generate all subsets of...
Find the smallest subarray with sum larger than a threshold
|algorithms|subset-sum|maximum-subarray|
Assuming that the $a_i$ are non-negative, you can solve your problem in linear time using a "sliding window" algorithm. I will also assume $T>0$ (otherwise the problem is trivial). Let $i,j$ be two pointers initialized to $1$, and denote by $\sigma(i,j)$ the sum $a_i + a_{i+1} + \dots + a_{j}$. As long as $i < n$ do...
You can solve your problem in linear time using a "sliding window" algorithm. Let $i,j$ be two pointers initialized to $1$, and denote by $\sigma(i,j)$ the sum $a_i + a_{i+1} + \dots + a_{j}$. As long as $i < n$ do the following: - If $\sigma(i,j) <T$ and $j<n$, increment $j$ by $1$. - Otherwise, increment $i$ b...
Given a set of $n$ positive numbers $\{a_1,\ldots,a_n\}$ and a positive target $T$, find a subset $S$ from $\{a_1,\ldots,a_n\}$ of contiguous elements, that is $S=\{a_i,a_{i+1},a_{i+2},\ldots\}$ for some $i$, such that $|S|$ is minimum and $\sum_{a\in S}a\geq T$. My algorithm is an exhaustive search one. - Gener...
null
null
I have a question that I am trying to work through. I have a program: 1. program Pass 2. var b:integer; a:integer; v :array[5] of integer ; 3. procedure P (x:integer, y:integer ) ; 4. var z:integer ; 5. begin 6. z := x ; 7. x := y ; 8. ...
Results of a Program After Call By Reference Vs. Call By Value-Result
|programming-languages|evaluation-strategies|
The greedy algorithm is optimal if it only picks 1c coins. It is optimal if it picks a 5c coin as the highest because the alternative is five 1c. It is optimal if it picks one or two 10c because the alternative is two or four 5c. And it is optimal if it picks 25c coins because the alternative is two 10c and replacing o...
|terminology|programming-languages|semantics|evaluation-strategies|
Just to clean up some confusion: What you call “call by reference” was “call by name” in Algol. In newer languages, “call by reference” will take the address of an object and the function accesses the object through the reference. Call by value/result locates the object, passes a value, gets a value back and stores it ...
**EDIT** My answer assumes you mean write automated tests for your automated tests. In practice, this is not done. In fact, in the work place, people joke about testing the tests. However, if your tests utilize a modular piece of code that can use some testing, then write some unit tests for it. In this scenario,...
I know that, in general, the Shortest Hamiltonian Path Problem in a general weighted graph is NP-complete. I am wondering, however, if the restriction to a complete weighted graph admits an algorithm in P. Being in a complete graph does give the knowledge that a Hamiltonian path exists in the first place. My guess i...
null
**EDIT** My answer assumes you mean write automated tests for your automated tests. In practice, this is not done. In fact, in the work place, people joke about testing the tests. However, if your tests utilize a modular piece of code that can use some testing, then write some unit tests for it. In this scenario,...
My answer assumes you mean write automated tests for your automated tests. In practice, this is not done. In fact, in the work place, people joke about testing the tests. However, if your tests utilize a modular piece of code that can use some testing, then write some unit tests for it. In this scenario, you are not...
So my question is about when we want to find the total derivative of the NLL Loss function $L$ w.r.t. $w_i$. So the "pipeline" is often expressed as: $$\frac{\partial L}{\partial w_i} = \frac{\partial L}{\partial z} \cdot \frac{\partial z}{\partial w_i}$$ Where $L$ is the NLL Loss function, $w_i$ is the contex...
Confusion on the use of the chain-rule for the total derivative of the NLL Loss function
|algorithms|algorithm-analysis|derivation|
null
null
I am designing a simple algorithm to be used at hardware level. And I want to find its time complexity. i=1 while(i<=n) { i=i*2; } # How I'd go about finding time complexity of this?(And I'm wrong). i=1,2,4,8....n =$2^{n-1}$ So the time complexity is $2^n$ But I am wron...
How do I find time complexity of while loops?
|algorithms|time-complexity|
every determinant should be candidate key, so write down candidate keys, then write down functional dependencies. after that check whether on the left hand side of '->' what you have, if all of them are candidate keys(whole candidate keys, not part of it) then it is in BCNF, otherwise it violates BCNF property, where ...
First, this is not an opinion question. I'm interested in if there is some kind of objective answer. If there isn't, then the answer would be "no". Is bytecode ("virtual machine code" for a "virtual processor") inherently faster to compile and/or interpret, than higher level (above Assembly) languages? What I mean i...
Is bytecode ("virtual machine code") inherently faster to compile and/or interpret, than higher level (above Assembly) languages?
|compilers|interpreters|
The time complexity is dependent on the number of times the while loop loops. Since the value of i is increasing exponentially, the number of loops will be logarithmic. - If the value of n=1, then the loop count = 1. - If the value of n=2, then the loop count = 2. - If the value of n=4, then the loop count = 3. -...
The time complexity is dependent on the number of times the while loop loops. Since the value of i is increasing exponentially, the number of loops will be logarithmic. - If the value of n=1, then the loop count = 1. - If the value of n=2, then the loop count = 2. - If the value of n=4, then the loop count = 3. -...
I decided to write a python script that generates all the optimal solutions for all the change. You can literally scroll through the solutions and observe there are no denomination expansions. So, my proof is indubitably correct at this point. ``` If change is 2, then the optimal solution is: [1, 1] If change is 3...
Given array $a$ of size $n$ and array $p$ of size $m$. How we can for every $i < m$ find $p_i$-th order statistics of array $a$ in $O(m log(n) + n)$? We can find order statistics separately, but it will be $O(mn)$. How can we do better?
Find multiple order-statistics of an array
|algorithms|
|algorithms|time-complexity|search-algorithms|
null
null
null
null
I have found two formulas in the [work][1] on pages 5 and 6, of which I am trying to develop a recursive implementation. The similarity to the DFT or FFT might be useful here. I divide this question into two sections, in the first part I explain my thoughts, in the second section there are open questions. The most i...
Implementation of the divide-and-conquer principle using a summation formula
|recursion|divide-and-conquer|fast-fourier-transform|
Implementation of the divide-and-conquer principle for a specific summation formula
null
function fun(n) { let i, j, p, q = 0; for (i = 1; i <= n; ++i) { p = 0; for (j = n; j > 1; j = j / 2) { ++p; } for (k = 1; k < p; k = k * 2) { ++q; } } return q; } let val_q = fu...
Find the value of return variable based on the value of n?
|algorithms|algorithm-analysis|
I have found two formulas in the [work][1] on pages 5 and 6, of which I am trying to develop a recursive implementation. The similarity to the DFT or FFT might be useful here. I divide this question into two sections, in the first part I explain my thoughts, in the second section there are open questions. **The most...
null
I wrote a pseducode for the Algorithm I am interested in its time complexity. Here is algorithm: ``` SolveDominoes(n, dominoes_data): ListA for dominoes in dominoes_data: ListA.add(dominoes) ListP = Red Domino from starting domino for(int i = 1; i < n; i *= 2) ListB = ListA.copy() ListC ...
What's the time complexity of it?
|time-complexity|
1. The outer loop runs $n$ times. 2. The first inner loop (the loop in $j$) runs approximately $\log_2 n$ times. This is because it runs until, by dividing $n$ by $2$, we obtain a number $\leq 1$. This means that it runs $m$ times, where $m$ is the smallest integer such that: $\frac{n}{2^m}\leq 1$. This happens when...
1. The outer loop runs $n$ times. 2. The first inner loop (the loop in $j$) runs approximately $\log_2 n$ times. This is because it runs until, by dividing $n$ by $2$, we obtain a number $\leq 1$. This means that it runs $m$ times, where $m$ is the smallest integer such that: $\frac{n}{2^m}\leq 1$. This happens when...
1. The outer loop runs $n$ times. 2. The first inner loop (the loop in $j$) runs approximately $\log_2 n$ times. This is because it runs until, by dividing $n$ by $2$, we obtain a number $\leq 1$. This means that it runs $m$ times, where $m$ is the smallest integer such that: $\frac{n}{2^m}\leq 1$. This happens when...
I'm embarking on a long-term project, aiming to build a computer based on the Intel 8088 architecture. This venture provides an excellent opportunity to deepen my understanding of computer hardware and operating systems. As I begin this journey, I have some queries to address, seeking clarity on certain aspects. One...
How can I connect a drive to a 16 bit custom intel 8088 system?
|computer-architecture|operating-systems|digital-circuits|filesystems|
null
I'm trying to solve the recurrent $$T(n) = 2T\left(\frac{n}{2} \right) +O(n\log n)$$ I thought about Master's theorem but unfortunately, my recurrent doesn't belong to any cases [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/EjOJH.png Could you please help me with solving my dif...
How to compute the complexity of $T(n) = 2T(\frac{n}{2}) +O(n\log n)$
|complexity-theory|time-complexity|
I read that one assumption for Successive Shortest Paths algorithm for computing the minimum cost flow problem is that every cost is non-negative. I also read that this assumption can be removed with proper network transformations, what are those? I found on some notes this: [![enter image description here][...
Assumption on SuccessiveShortestPaths
|graphs|network-flow|
It does not make sense to talk about the **complexity** of a recurrence equation. Algorithms have complexities (sometimes expressed via recurrence equations). Recurrences have solutions. Anyway, your recurrence is covered by the second case of the master theorem formulation you posted. More precisely, if $T(n) = a ...
I read that one assumption for Successive Shortest Paths algorithm for computing the minimum cost flow problem is that every cost is non-negative. I also read that this assumption can be removed with proper network transformations, what are those? I found on some notes this: [![enter image description here][...
null
> does the bytecode map to the machine instructions of the underlying processor more easily than some higher level language? That depends entirely on the bytecode, the higher level language, and the machine instructions. For example, [*Haskell*](https://haskell.org/) semantics map closely to the [*Reduceron* CPU]...
Consider $n = 2^k$ and then expand the recurrence. $\displaystyle T(n) = 2T(\frac{n}{2}) + O(nlog(n)) = O(k2^k + 2(k-1)2^{k-1} + 2^2T(2^{k-2})) = O(\sum^{k}_{i = 0} 2^{i} (k-i) 2^{k-i}) = O(2^k \sum^{k}_{i=0} (k-i)) = O(k^2 2^k) = O(nlog^2(n))$