instruction
stringlengths
0
29.8k
βŒ€
Path planning on 2D grid graph to maximize the neighboring grids of a path
|algorithms|graphs|dynamic-programming|weighted-graphs|
On a finite 4-connected grid graph, given the source point and destination, it is allowed to consecutively move in one of the four orientions (up, down, left or right) to form a path. We get 1 bonus for each grid point which is NOT on the path but meanwhile has at least one neighbor on the path (bonus counting stops wh...
> As hashes are fixed length, does that mean that even if not specified when creating the password, all login systems would need to have some sort of maximum input length (although probably very high)? At least some hash algorithms have some limit to the input length, though those are usually astronomically high, so...
Path planning on 2D grid graph to maximize the neighboring grids of a path: Can we do better than brute DFS?
On a finite 4-connected grid graph, given the source point and destination, it is allowed to consecutively move in one of the four orientions (up, down, left or right) to form a path. We get 1 bonus for each grid point which is NOT on the path but meanwhile has at least one neighbor on the path (bonus counting stops wh...
Path planning on 2D grid graph to maximize the neighboring grid points of a path: Can we do better than brute DFS?
I am dealing with two values $a$ and $b$ such that they grow at the same asymptotic rate, i.e., $O(\frac{1}{\sqrt{N}})$. I want to achieve a reasonable bound for the difference $a - b$. When I go into the fundamentals in terms of $c_1, c_2$, I run into multiple issues. The difference be $(c_1 - c_2)\frac{1}{\sqrt{N}}$....
Subtracting Two same asymptotic values
|asymptotics|big-o-notation|
I feel confused: * I don't understand why undecidability and the existence of arbitrary Turing machines doesn't imply that $P ! = NP$ ? I mean an indirect implication. * I don't understand what indirect implications undecidability has (or doesn't have) for finite outputs of Turing machines. [This answer](https://m...
Why doesn't undecidability indirectly imply $P != NP$?
|turing-machines|undecidability|np|p-vs-np|
Yes, passwords need maximum length, but not because of collision risk (see other answers regarding collisions). Reason for setting length maximum password - possibility of denial of service attack. Someone might start feeding petabytes into password field, pushing your setup to CPU/memory limits, which would impa...
I'm interested in what the best way is to design a circuit that takes multiple values as input, and then outputs which value is the lowest. If multiple values are the lowest, it outputs "true" for each of them. Does anyone know an ideal design? For example, are there any classical "text-book examples" of one (or if som...
Ideal less-than-or-equal circuit for multiple inputs?
|digital-circuits|comparison|
First time posting here. If we have the logical statement ($A$ and $B$) $\rightarrow$ $C$ ($1$), we know that it is equivalent to ($A$ and $B$) $\rightarrow$ ($C$ and $A$) ($2$). Therefore if we wanted to prove the $\iff$ case for the first statement, we would need to prove $C$ $\rightarrow$ ($A$ and $B$). All good he...
Equivalent logical statements confusion
|logic|
First time posting here. If we have the logical statement ($A$ and $B$) $\rightarrow$ $C$ ($1$), we know that it is equivalent to ($A$ and $B$) $\rightarrow$ ($C$ and $A$) ($2$). Therefore if we wanted to prove the $\iff$ case for the first statement, we would need to prove $C$ $\rightarrow$ ($A$ and $B$). All good he...
First time posting here. If we have the logical statement ($A$ and $B$) $\rightarrow$ $C$ ($1$), we know that it is equivalent to ($A$ and $B$) $\rightarrow$ ($C$ and $A$) ($2$). Therefore if we wanted to prove the $\iff$ case for the first statement, we would need to prove $C$ $\rightarrow$ ($A$ and $B$). All good he...
Let $B$ be $\text{true}$. The direct theorems simplify to $$(A\implies C)\equiv(A\implies C\land A).$$ Now with $B$ $\text{false}$, $$(\text{false}\implies C)\equiv(\text{false}\implies C\land A)$$ which are trivially correct. If we now look at the inverses, $$(C\implies A)\equiv(C\land A\implies C)$$ ...
Let $B$ be $\text{true}$. The direct theorems simplify to $$(A\implies C)\equiv(A\implies C\land A).$$ Now with $B$ $\text{false}$, $$(\text{false}\implies C)\equiv(\text{false}\implies C\land A)$$ which are trivially correct. If we now look at the inverses, $$(C\implies A)\equiv(C\land A\implies C)$$ ...
I make an example: if $a=\frac{2}{\sqrt{n}}$ and $b=\frac{1}{\sqrt{n}}$, then both are $O(\frac{1}{\sqrt{n}})$ and $a-b=\frac{1}{\sqrt{n}}=O(\frac{1}{\sqrt{n}})= \Theta (\frac{1}{\sqrt{n}})$. If instead $a=b=\frac{1}{\sqrt{n}}$, then we have $a-b=0=O(1)$. As you can see, without further information on $a$ and $b$, t...
I make an example: if $a=\frac{2}{\sqrt{n}}$ and $b=\frac{1}{\sqrt{n}}$, then both are $O(\frac{1}{\sqrt{n}})$ and $a-b=\frac{1}{\sqrt{n}}=O(\frac{1}{\sqrt{n}})= \Theta (\frac{1}{\sqrt{n}})$. If instead $a=b=\frac{1}{\sqrt{n}}$, then we have $a-b=0=O(1)$. As you can see, without further information on $a$ and $b$, t...
If $a(n),b(n)=O(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the asymptotic constants are the same (they are only upper bounds). This is also true for $\Theta(g(n))$.
If $a(n),b(n)=O(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the asymptotic constants are the same (they are only upper bounds). Even worse, if $a(n),b(n)=\Theta(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$.
If $a(n),b(n)=O(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the asymptotic constants are the same (they are only upper bounds). Even worse, if $a(n),b(n)=\Theta(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$. Example: $H_n$ ($n^{\text{th}}$ h...
If $a(n),b(n)=O(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the asymptotic constants are the same (they are only upper bounds). Even worse, if $a(n),b(n)=\Theta(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the respective tightest uppe...
I have been trying to find model weights for the above mentioned models, especially ViT-G/14 but have been unable to find it. The models are mentioned here https://paperswithcode.com/sota/image-classification-on-imagenet and there is a repository from google linked: https://github.com/google-research/big_vision, so I a...
Wegihts for ViT-G/14 or ViT-L/16
|computer-vision|
Prefill a prime sieve with $2^{64/3}$ entries. This takes $330281$ bytes of storage. Then for a given $K$, you can start a search from the largest prime below $\sqrt[3]N$, increasingly until you exceed $N$. The products can be computed directly or incrementally (next product from the previous).
I'm trying to create a machine learning program to predict the winner of UFC fights. I want to train my AI with data from previous matches, but I have encountered a problem. When my AI trains on a past fight to predict the winner, it will only have access to the latest data of the fighters since their last fight. ...
Question about data to train an machine learning IA
|machine-learning|artificial-intelligence|
Based on the Busy Beaver rules (2 letter alphabet, 2-way unbounded tape, program must halt, etc) I was wondering if the Busy Beaver for each n is also the program that does the most steps, or if there are other programs that do more steps but produce less output. Any references appreciated.
Is the Busy Beaver with n states also the busiest Turing machine (counted in steps) with n states?
|turing-machines|busy-beaver|
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of N $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. In this lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positive integers and $L = \{ab^{i_1} \}^βˆ— \{ab^{i_2} \}^βˆ— . . . \{ab^{i_{2n...
Nonterminal Complexity of a context-free grammar
|complexity-theory|context-free|formal-grammars|
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of $N$ $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. In this lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positive integers and $L = \{ab^{i_1} \}^βˆ— \{ab^{i_2} \}^βˆ— . . . \{ab^{i_{...
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of $N$ $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. I have a problem in understanding a part of proof of the following lemma. lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positi...
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of $N$ $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. I have a problem in understanding a part of proof of the following lemma. lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positi...
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of $N$ $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. I have a problem in understanding a part of proof of the following lemma. lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positi...
I was given the following problem. > **Problem.** Give a regular expression over $\{a, b\}$ whose language is the set of all words with an even number of $a$s, but without consecutive $a$s. For example, $bbaba$ is in the language, but $bbaab$ is not. My approach was to build an automaton with four states: - $A...
Regular expression over $\{a, b\}$ for all words with an even number of $a$s, but without consecutive $a$s
|formal-languages|regular-languages|automata|regular-expressions|
Suppose $G$ is a CFG. $G = (N, T, P, S)$, $Var(G)$ as the cardinality of $N$ $Var(L) $= min \{$Var(G)$ | G is a context-free grammar and $L(G) = L$\}. I have a problem in understanding a part of proof of the following lemma. lemma: Let $i_{1} , i_2 , . . . , i_{2n}$ be $2n$ pairwise different positi...
If you look at the Wikipedia page for the Busy Beaver game (https://en.wikipedia.org/wiki/Busy_beaver) there is a section about "Maximum Shifts Function" which seems to answer your question.
No. There is no* limit on the length of the input to any good cryptographic hash functions. As a result, password hashing can support passwords of unlimited length and do not need to impose a limit on the maximum length of the password. Of course collisions are possible and exist, but they are believed to be excep...
null
The key here is **graycode**. I think the easiest way to see why Karnaugh maps work is to go through an example: Consider the following truth table: $\hskip2in$[![table][1]][1] We can easily find the logical formula describing this table in terms of the sum of products formula (I will use the boolean a...
null
The halting problem states that there is no $h$ function that works on every input. You are missing that you need to supply a concrete implementation of a function $h$ (which is as hard as writing a compiler), and prove that it works on any input function. The latter is an impossible task, as you should feed $h$ with a...
null
I am working on this paper titled β€œthe microarchitecture of superscalar processors by Smith and Sohi” and it says that there are 3 methods of organizing instruction queue. I know that the method β€œMultiple queues” is the same as the method β€œScoreboard” and also the method β€œMultiple reservation stations” is the same as t...
|computer-architecture|cpu-pipelines|
null
I know that parity checking is testing for accurate data transmission between nodes in a communication network. 1. When does this parity checking happen on a computer? Does it happen every time data is transmitted internally in a computer? 1. Do all computers use parity checking?
Do all computers use parity checking? When does it happen?
null
As noted by Thomas Klimpel in the comments, a certain acceptance probability is often used, which is equal to say $0.8$. The following is a simple iterative method to find a suitable initial temperature, proposed by Ben-Ameur in 2004 [1]. In the following, $t$ is a strictly positive transition, $\max_t$ and $\min_t$ ar...
null
I feel confused: * I don't understand why undecidability and the existence of arbitrary Turing machines doesn't indirectly imply that $P \not= NP$? * I don't understand what indirect implications undecidability has (or doesn't have) for finite outputs of Turing machines. [This answer](https://math.stackexchange.co...
Why doesn't undecidability indirectly imply $P \not= NP$?
I hope someone can help me with that: $$T(n)=T(2^{\sqrt{\log n}})+1$$ <!-- ![enter image description here][1] --> I will be asked to answer what is the runtime complexity of the algorithm. I tried to set m=2^ and still failed. [1]: https://i.stack.imgur.com/LKJf8.png
Solving a recurrence relation formula with squared
null
The start state cannot have any "in edge" (an arrow point directly to the start state) and only out edge is possible for the start state. Other states except the start state are free of limit in DFA (deterministic finite automaton). I have doubt between two awnsers which are: 1. It depends on the language and is ...
null
I'm trying to solve this time complexity: $T(n) = 2T(n-2) + n$, but having some challenges addressing the $(-2)$ component. Any insights on this complexity? Ended up with a section $[2^2\cdot1 + 2^3\cdot2 + 2^4\cdot3 + \ldots + 2^{k+1}\cdot k$. Does it follow any existing number series? Thanks.
null
I'm trying to solve this time complexity: $T(n) = 2T(n-2) + n$, but having some challenges addressing the $(-2)$ component. Any insights on this complexity? Ended up with a section $[2^2\cdot1 + 2^3\cdot2 + 2^4\cdot3 + \ldots + 2^{k+1}\cdot k$. Does it follow any existing number series?
For the sake of argument we will assume $A_{TM}$ is decidable. Now we are going to show a way to decide $HALT_{TM}$ using a decider for $A_{TM}$ and thus reach a contradiction, since we know $HALT_{TM}$ is undecidable. Details: If $A_{TM}$ is decidable, then its complement $\overline{A_{TM}}$ is also decidable. S...
null
I am struggling to wrap my head around this compiler technique, so let's say here's my *`factorial`* function ```python def factorial(value: int) -> int: if value == 0: return 1 else: return factorial(value-1) * value ``` It is recursive, but not TCO friendly yet, so, as the theory goes,...
|compilers|recursion|loops|continuations|tail-recursion|
null
I am trying to understand how KD-tree works when we insert a node and how it splits the xy plane, please. Below $[5, 4]$ splits the xy-plane into left and right parts while $[2,6]$ splits it into top and bottom. Why don't we say that $[2,6]$ again splits the space into left and right? [![enter image description her...
|data-structures|binary-trees|search-trees|binary-search-trees|kd-tree|
null
Consider the [interval scheduling problem](http://en.wikipedia.org/wiki/Interval_scheduling), see also [here](https://web.archive.org/web/20180329033952/http://www.phailed.me/2012/08/interval-scheduling-problem/). In order to schedule the $n$ job requests over one resource, you sort the requests in order of finish ...
null
Your statement `Integer x;` is syntactically `identifier identifier;` which is a perfectly fine variable declaration. Semantically, the first identifier must be defined as a type, and the second identifier must not be defined as a variable in the same scope. The first condition fails, therefore ... And you might wan...
null
In divide-and-conquer, one uses the following formula to find the runtime: $$T(n) = aT(n/b) + f(n).$$ I am confused with the meaning of the constants $a$ and $b$, as well as by the question of how to find $f(n)$. The textbooks could not help me. In exercises, one usually gives this data and asks about the runti...
Finding the runtime out of a recursion formula when using divide-and-conquer
|time-complexity|runtime-analysis|recurrence-relation|recursion|
null
I was given the following problem. > **Problem.** Give a regular expression over $\{a, b\}$ whose language is the set of all words with an even number of $a$s, but without consecutive $a$s. For example, $bbaba$ is in the language, but $bbaab$ is not. My approach was to build an automaton with four states: - $A...
I'm trying to create a machine learning program to predict the winner of UFC fights. I want to train my AI with data from previous matches, but I have encountered a problem. I wonder if the algorithm will really work because, on the website where I can retrieve the data of the fighters and their fights, the informat...
I'm trying to create a machine learning program to predict the winner of UFC fights. I want to train my AI with data from previous matches, but I have encountered a problem. I wonder if the algorithm will really work because, on the website where I can retrieve the data of the fighters and their fights, the informat...
I've been trying to solve a variation of this problem Best time to buy and sell stocks when allowing consecutive buys or sells You are allowed to either buy 1 share or sell any number of shares that you own, or not make any transaction in each time period. Find the maximum profit you can obtain. Purchases are neg...
Best time to buy and sell stocks with multiple buy transactions are allowed and can sell all shares at once
|algorithms|dynamic-programming|network-flow|
I found a strongly NP-complete problem, [Applying a permutation on a sequence with multiplication,][1] that reduces to my problem. The reduction produces an input to my problem where sequence $a_i$ is the set $L$, $M=\{1,2,3, ..., n\}$, and C=x. This proves that the problem of numerical perfect matching is strongly ...
If $a(n),b(n)=O(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the asymptotic constants are the same and are tight. Even worse, if $a(n),b(n)=\Theta(g(n))$ then without more information, all you can say is $a(n)-b(n)=O(g(n))$, even if the respective tightest upper and lower asy...