instruction
stringlengths
35
29.1k
Is there any variant of the Boolean SAT or Max-SAT problem that has a flavor of maximizing or minimizing the average of the weights of the satisfied clauses of a WCNF formula? Any literature on an optimization problem of similar flavor would be appreciated. Thanks.
I'm fairly new to type systems and theory, so I would appreciate some guidance in a problem that sparked my interest. I would like to understand what type system features are required so a compiler can enforce that a given key will return a value of the same type as the one the key was associated with in the first plac...
I'm trying to write an algorithm to calculate the area created by multiple paths that can be overlapping or not. Here is an example: Basics 4 separate paths (A,B,C,D) which are a collection of vertices (A1,A2,...) Area desired is represented by green Edge Cases As shown with B, a path might have segments that don't...
Is it known if complexity class of all sparse languages is contained within e.g. $\mathsf{EXP}$ or $\mathsf{EXPSPACE}$? Or what is the smallest time or space complexity class that contains complexity class $\mathsf{SPARSE}$?
This is a question $9.1$ from Understanding Machine Learning Chapter 3. It goes like this: Consider a variant of the PAC model in which there are two example oracles: one that generates positive examples and one that generates negative examples, both according to the underlying distribution $\mathcal{D}$ on $\mathcal{...
Two phase commit is used in distributed transaction. For example, a client sends a transaction to two databases with a coordinator. step1: client get a global transaction id from coordinator step2: client send the transaction to two databases respectively step3: client send the commit flag to coordinator step4: coordi...
I asked this question on datascience.stackexchange but they directed me here. I have a social network represented as a set of people S and individual weights for each of person (weight is the cost of person). I also have defined relationships between these people (whether people know each other or not). I must find suc...
Without assuming ASLR... Processes have virtual addresses, and they manage stacks & heaps of their own. However, these all get mapped to physical addresses somewhere on the memory. Let's say we have Process A and Process B. Process A starts before Process B. Process A puts some stuff on the stack. We switch to Process ...
I'm currently learning for my exams this semester and tried to solve some old exams from the last years. The question is to show, that L ist undecidable. $L=\{w|T(M_w)\neq\emptyset \land \forall x \in T(M_w): xx\in T(M_w)\land xxx\notin T(M_w)\}$ I showed that the language $L'=\{w | T(M_w)\neq \emptyset\}$ is undecidab...
Starting from a random node, which of these series can be a BFS traversal (L to R)? 1 MNOPQR 2 NQMPOR 3 QMNPRO 4 QMNPOR Now, I understand that my answer (1- MNOPQR) is wrong because I got confused with DFS.. and the answer is 3. but why isn't 4 right as well? I mean, it defines BFS... no? Thanks!
I came across this problem online which is a Leetcode premium problem. Most of the people are solving this using Minheap. To me using minHeap for this seems like repetitive way to solve a problem if we can achieve the same thing just by sorting the array based on startTimes & than checking if meeting(i).endTime > meeti...
I know that MAX2SAT is NP-complete in general but I'm wondering about if certain restricted cases are known to be in P. Certainly the languages $L_k:=\{ \phi \,|\, \phi\,\text{is an instance of 2SAT which has an assignment satisfying at least k clauses.}\}$ can be solved in $O(n^k)$ through brute force search since for...
I am studying hashing and reading the part of universal hashing. I have read that I want to draw a hash function from universal hash families when I rehash. When and why do I rehash? One reason to rehash seems to be load factor or hash table size. When I want to lower the load factor and increase hash table size, then ...
For an NFA, can we always find a RAM, which recognises the same language?
$L = {a^n + b^m + a^{n+m}}$ This is the language I want to show is not regular. Now my problem is to choose p correctly. Can I just set it as p=2*(n+m) ? That's the problem I am facing now. Thanks for any help I am starting to learn it to use the pumping lemma. Edit: In the meantime I have done this: $w=a^nb^ma^{n+m}$ ...
I have already read PAC learning of axis-aligned rectangles and understand every other part of the example. From Foundations of Machine Learning by Mohri, 2nd ed., p. 13 (book) or p. 30 (PDF), I am struggling to understand the following sentence of Example 2.4, which is apparently the result of a contrapositive argumen...
I'm creating a webapplication in which I render multiple objects using Three.js. These objects are saved in a list and can be connected to each other (but don't have to be), and when they are, they are rendered next to each other. The user can select an object in this list using the UI that I made. An example of how th...
I'm a newbie and a paper I'm reading specifies the following grammar: ChangeDomain ≔ Domain ∣ Domain [{Changeable}] ({NewDomain}) Changeable ≔ ChangeDomain ∣ CP∣ Domain∣ Domain ⊳ NewDomain Domain; NewDomain; Need ≔ Name I'm new to grammars and wondered whether an experienced re...
So I was trying to solve following exercise: Let $(L_{i})_{i \in \mathbb{N}}$ be a family of decidable languages - this means that every $L_{i}$ is decidable. Then $\cup_{i \in \mathbb{N}}L_{i} $ is also decidable. Right or wrong? The solution states, that this statement is wrong because we can set $L_{i}:=\{f(i)\}$ wi...
How can we convert a given Turing Machine into a Random Access Machine? I understand that we can use the transition function to come up with a sort of algorithm but how can we translate all of it into a set of instructions (load/add etc). For example, here's a TM: M = ({q 0 , q 1 , q accept , q reject }, {0, 1}, {0, 1,...
language = arbitrary word followed by exact same arbitrary word = u * u (with u being out of non-empty words of alphabet {0, 1} ) (sorry for the formatting, see screenshot-link for conventional/clear expression) The purpose is to prove that the given language is not a context-free-language (using the pumping lemma). S...
I want to ask if $\{w|\forall x\in T(M_v):|w|>|x|\}$ is decidable if v is a Index of a random but fixed Turing Machine with $|T(M_v)|<\infty$. My idea: It is co-semi-decidable since as soon as i find an $x\in T(M_v)$ with $|x|\geq |w|$ I have shown that this sepcific w is not in the set. I think it aint semi-decidable,...
I understand how RAM commands work but I am unable to understand how we use a given input string and find the output. For instance, there's a Random Access Machine which has an input {0,1}*. The program logic is as follows: 1: read 2: store 1 3: read 4: add 1 5: read 6: add 1 7: load 1 8: if a=2 go to 11 9: print 0 10:...
The title of the paper that introduced type classes is "How to make ad-hoc polymorphism less ad hoc". It seems the type classes approach is being compared to how OOP does ad-hoc polymorphism. As far as I can tell, the paper never explains how type classes are less ad hoc than OOP techniques like V-tables or prototype c...
I am working out step by step and I am stuck on vertex 7. I got that it was a regular vertex and helper(e_i-1) is not a merge vertex so I look for the leftmost edge in the sweep line. My question is, would e6 be considered to the left of it, or is it none? Any already completed examples that I could see would help me ...
Suppose the strings are of the form x#y#z , where x,y,z are strings formed from the alphabet $\Sigma=(0,1,2,3,4,5,6,7,8,9)$ . The language is accepted if x+y=z is satisfied, for example : 56#65#121 is accepted, but 2#97#104 is not. Is it possible to find a finite automata for such a language ? I cannot fathom how deci...
As far as I read in a OS text book (Operating Systems by Silberschatz) Kernel mode is for privileged task, so it it true to claim that "User Level Thread can read/write Kernel threads" ? Generally speaking, Is there any kind of protection between user and kernel level threads?
Let $X_1,...X_n$ denote some bins, and $w_1,...w_m$ some positive real numbers, where $m \in \mathbb{N}$, and the order matters, so e.g. we can't switch the position of $w_n$ and $w_1$. The goal is to take a subset of $\{w_1,...w_m\}$ and assign it for each bin, i.e. $\{w_1,...w_{i1}\}$ would go to bin 1, $\{w_{i_1+1},...
Suppose we have a graph $G$. Consider the minimum vertex cover problem of $G$ formulated as a linear programming problem, that is for each vertex $v_{i}$ we have the variable $x_{i}$, for each edge $v_{i}v_{j}$ we have the constraint $x_{i}+x_{j}\geq 1$, for each variable we have $0\leq x_{i}\leq 1$ and we have the obj...
I computed the PageRank vector for the example given in https://en.wikipedia.org/wiki/PageRank (where the picture shows that node B ends up with a score of 38.4, node C with 34.3, node D with 3.9). I implemented the PageRank algorithm, but my numbers are slightly different: 39.8 for node B, and 36.1 for node C, 3.5 fo...
In a noiseless channel can frames in the 2 layer of OSI model(Data link layer) reach to the destination out of order? *I am studying from Computer networks 5 Edition of Andrew S. Tanenbaum
Inspired by this StackOverflow question: https://stackoverflow.com/questions/63346135 (it was not clearly presented, and got closed) Let's say I wanted to enumerate all the 3D points on the integer lattice, within a sphere, in order of the angle between the vector to the point and the up vector (say z). Could I do this...
I know that an ASCII character needs 1 byte of memory for storage, but if a computer uses a 64-bit word addressable memory does it mean that the character actually takes 8 bytes even when only 1 byte was needed? Does being a 64-Bit word addressable memory mean the same as being a 64-Bit machine?
In simple CPU architectures, such as the one discussed here https://youtu.be/zltgXvg6r3k?t=109, an instruction loaded from RAM is executed exactly one clock cycle after it is loaded into the instruction register. This fact is key to the whole architecture working. However, I am told that in real/modern architectures it...
Here I am given 2 hash families and I need to prove the universality of the double hash, but I am stuck as to how to prove this. I know the properties of an epsilon-universal family is that the probability of collision is at most epsilon, but how could I relate this to prove the universality of the double hash?
$L=\{w \in \{0,1,a\}^* | \#_0(w) = \#_1(w) \}$ We show that L is not regular by pumping lemma. We choose w=$0^p 1^p a$ |w| = 2p+1 Now |xy| has to be $\leq p$ So x and y could only contain zeros. And $z=1^p a$ $xy^iz= 0^p 1^p a$ Now let i = 0 $xy^0z=0^{p-|y|} 1^p a$ Now hence $p-|y| \neq p$ this choice of i would lead t...
I came to know through some examples that DFS and Backtracking aren't exactly the same ( A misconception I had since a long time). So now my question is, since Backtracking visits nodes backwards step by step while DFS on a graph may directly jump some nodes backwards, is DFS a faster algorithm? If so, only in terms of...
I know for factoring we have the RSA Numbers, in which factoring one of them quickly (usually) indicates a breakthrough in the field. However, I want to know if there's something similar for SUBSET-SUM, in which there are hard instances that if solved, would be a "big deal"? I found this, but they don't seem to be unso...
My basic problem includes a graph where each node $i$ is associated with a weight $c_i$, and the problem is to find a minimum (or maximum) weighted independent set with a fixed cardinality $p$. This is I believe a well-known problem in graph theory that is well-studied for different types of graphs. Now, suppose I am d...
I would like to compute the adjoints $\bar x$ and $\bar y$, from a reverse automatic differentiation perspective, of the expression $x^y$. The adjoint $\bar{x^y}$ is already known; and we can assume $x \geq 0$ and $y \geq 1$. The "easy" solution consists of rewriting the expression $x^y=e^{y \ln x}$, and proceed piece-...
Pardon my ignorance on the matter but, Verifying passwords = Polynomial (linear) Guessing passwords = Exponential Since each guess has nothing to do with one another, exponential time is best possible time (but verifiable in linear time).
Mahaney's theorem states that the existence of $\mathsf{NP}$-complete sparse language would lead to $\mathsf{P = NP}$. Is there any result result regarding the same for the complexity class $\mathsf{PSPACE}$, like "if there is a $\mathsf{PSPACE}$-complete sparse language, $\mathsf{PP = PSPACE}$" or the same for any oth...
Let's say we have five packets p1 p2 p3 p4 p5 to be sent sequentially: and for some reasons, p3 got delayed so it the the last packet to arrive recevier. so below is the receiving order on the receiver's end p1 p2 p4 p5 p3 and according to the Go-Back-N Protocol, the receiver will only send acknowledge of p2 when i...
I am preparing for a programming exam on probability theory and I stumbled across a question I can't solve. Given a bag, which contains some given amount of white stones $w$ and some given amount of black stones $b$, two players take turns drawing stones uniformly at random from the bag. After each player's turn a ston...
We can define a reader/environment monad on the simply-typed lambda calculus, using the following three equations, where $r$ is some fixed type, $\alpha$ is any type (I subscript some terms with their types), $\mathbb{M}$ is the proposed monadic type modality), $\eta$ is the unit of the monad and $\mu:\mathbb{M} \mathb...
I came across the following question while practising for my final algorithms exam, but I am unsure how to get a linear time complexity for this problem. I assumed it would require checking which tiling patterns are compatible with each other, but get a bit stuck on how to proceed. Thanks!
There are several data structures in which the number of elements uniquely determines the shape. Examples would be binary heaps, arrays, lists, Braun trees, and Merkle mountain ranges. Are there any such data structures that can be used to efficiently implement a binary search tree with good insertion/deletion performa...
I was reading a textbook describing the Go-Back-N (GBN) protocol with Finite State Machines as pictured below: $\Lambda$ just means "initial state" or "no action", depending on the context. My questions are This is the interactive animations link to GBN https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/cw/con...
In the context of a discussion of Haskell https://stackoverflow.com/questions/62509788/the-intuition-behind-the-definition-of-the-co-reader-monad, I was told that There is no terminating implementation for the polymorphic type $(e \to a) \to a$ and that we couldn't have a function of type $((e \to a) \to a) \to e$ or...
The bounty above should read 'I would like to know whether the example I discuss is a com-monad and why (why not).' Suppose we set $\mathbb{M} \alpha := r \to \alpha$, where $r$ is some fixed type, and $\alpha$ an arbitrary type, of the STLC (Simply-Typed Lambda Calculus) Suppose we want to define a co-monad, which con...
In Comparing Mathematical Provers (section 4.1), Wiedijk classifies logics and type systems of different proof assistants? I do not see what he means by type system of the assistant. He only says: A system is only considered typed when the types are first class objects that occur in variable declarations and quantifie...
I have a problem and want to know if there is any combinatorial optimization that is similar in nature to this problem or how to solve this special version of the max weight matching problem. I have a general graph $G(\mathcal{V},\mathcal{E},\mathcal{W})$. I want to find a maximum weight matching of the graph $G$ that ...
Suppose I have a term $a :\alpha$ of the Simply-Typed Lambda Calculus (in the following, $\alpha, \beta, \gamma$ stand for arbitrary types) and I want to lift it to a term $\lambda x_{\beta}. \;(x, \, a)$ I could use a function $\lambda z_{\alpha}, x. \;(x,\, z)$. Suppose we then form $(b, a) : \beta \times \alpha$, by...
What are the applications of homotopy type theory to everyday programming? I know of only two applications, neither of which I understand: "Homotopical Patch Theory" "HoTTSQL: Proving Query Rewrites with Univalent SQL Semantics" Is there a capsule summary of how HoTT is relevant to these problems? Is there a general ...
Consider a language $L_1$ that is recursively enumerate, $L_2$ that is regular, and $L_3$ that is context-free. Are the following problems algorithmically decidable? Is $L_1 \cap L_2 = L_3$? Is $L_1 \cap L_3 = L_2$? I think problem 1 is undecidable since $L_1 \cap L_2$ is a recursively enumerable language it can be e...
Task I want to approximate the median of a given distribution $D$ that I can sample from. A simple algorithm for this, using $n$ samples, is: samples = [D.sample() for i in range(n)] # generate n samples from D sort(samples) return samples[n/2] However, I am looking for an algorithm that requires less than $O(n)$ spac...
By giving an Huffman coding tree and the total frequency of the characters. how can I find the most unoptimal frequencies for each character such that the size of the code will require the most possible of bits?
I'm trying to find out the most efficient way of turning a list of path strings into a hierarchical list of hash maps tree using these rules: Node labels are delimited/split by '/' Hash maps have the structure: { label: "Node 0", children: [] } Node labels are also keys, so for example all nodes with the sa...
So, I understand how binary arithmetic works, and I understand how an adder-subtractor works for signed numbers. There is only one thing I am not sure about: All the cases work ok in the circuit I have, except if the result of a subtraction is negative, I need to take the two's complement of the output byte to get the ...
The definition of approximation factor preserving reduction from the book by Vijay V. Vazirani, page 365: Let $\Pi_1$ and $\Pi_2$ be two minimization problems, an approximation factor preserving reduction from $\Pi_1$ to $\Pi_2$ consists of two polynomial-time algorithms, $f$ and $g$, such that: for any instance $I_1...
I've been playing around with prolog and realised something. You can do everything without predicate names. e.g. Just change all predicates $$a(b,c,d,e,..)$$ into $$prop(a,b,c,d,e,..)$$ Where $prop$ is some character that you can use for all function names. So $isRed(X)$ becomes $prop(isRed,X)$. Which makes me wonder i...
I understand that computer memory data is sequential; It is one long line organized in one or more address/es, each of which containing one or more fixed size word/s which contain raw data (in an initial manner, just offset value/s, I would assume). Why does memory data isn't organized in two or more lines (why it's ju...
Decision Problem: Is $2^k$ + $M$ NOT a prime? $K$ and $M$ are our inputs represented as integers. Function Variant: Output the result of $2^k$ + $m$ We can consider, $M$ = $0$. Proof that calculating 2^n requires an exponential amount of digits as the result Question Is it true that a non-deterministic machine cannot o...
I am reading about embedding/automation of modal logics in classical higher order logic (http://page.mi.fu-berlin.de/cbenzmueller/papers/C46.pdf) and Goedels proof of God's existence is prominent example here https://www.isa-afp.org/entries/GoedelGod.html (as encoded for Isabelle/HOL). This embedding has embedding for ...
I want to add two IEEE 754 numbers. I followed the steps to add two 754 numbers. However the result it not correct. Number 1: S:0 E:01111111 M:11111111111111111111111 Number 2: S:0 E:01111111 M:00000000000000000000000 Here is my calculation: The site http://weitz.de/ieee/ gives this result: S: 0 E: 10000000 M: 1000000...
In https://www.seas.harvard.edu/courses/cs152/2019sp/lectures/lec18-monads.pdf it is written that A type $\tau$ list is the type of lists with elements of type $\tau$ Why must a list contain elements of the same type? Why can't it contain elements of different types? Is there a way of defining a list polymorphically ...
I am kind of confused which function $f:\mathbb{N}^2\longrightarrow\mathbb{N}$ is presented by $F(x,y,z)\Longleftrightarrow (x+z)=y \lor (y+z)=x$ I know that $f(x,y)=y-x$ is represented by $F(x,y,z)\Longleftrightarrow (x+z=y)\lor ((z=0)\land \exists w(x+w)=y)$ But the or symbol confuses me ... My guess was $f(x,y)=max\...
The biconditional operator $\iff$ of Propositional Logic can be defined by the identity $p \iff q \equiv (\lnot p \lor q) \land (\lnot q \lor p) \quad (1.1)$ Use the identity $(1.1)$ and identities from the list on page 2, to show algebraically that $p \iff q \equiv (\lnot p \land \lnot q) \lor (q \land p)$ State which...
I need an algorithm to determine the best itinerary for a series of events. Each event has a time, location, and reward. Arriving at an event in time yields the reward; too late means no reward. Each event is at a physical location thus it takes time to travel from event to event. It is not necessary to attend every ev...
I know that the most basic (and least abstract) code for programming is machine code (with binary of 0s and 1s being the typical machine code). I also know that computers can save data even if they are turned off, by different types of computer memory (storage device memory, RAM and other computer system devices which ...
I received this problem on an exam a few months ago, and have kept thinking about how to solve it with no luck. Given a binary tree where each node in the tree can either be selected or unselected, implement a function k_away() which returns the minimum number of nodes that need to be selected so that every node in th...
I've got this problem on my last exam, which I struggle to deal with. Let's say we have array of $N$ integers (it can be float too, but let's say integers for sake of simplicity. We need to sum those numbers, but we can only use operation of summing two adjacent numbers. Goal of algorithm is to sum this sequence, so m...
I understand "escaping data" as making an exception when matching data; for example, if a program can't match data wrapped in some character/s (such as single and/or double quotes) without an exception, than we make an exception when "escaping" such character/s to be matched. Is escaping a concept in CS? Is it "part of...
First, I learned this based on these facts: Turing machine (TM) will be define with 7-tuple Notation, $M=\langle Q,G,b,S,d,q_0,F\rangle$. Any computation rules that can use to simulate any possible TM is called Turing-Complete. Universal TM (UTM) is TM that is Turing-Complete. Then, the question begins: If we have 7...
This is an interview question. Interviewer wanted a scalable solution Goal is to find value of shopping cart. Cart could have 3 different types of items(Physical,Digital,URL). Only Physical Items have a shipping address. Only Digital items have a redeemable code that is used in a merchant site. Only URL items have a UR...
I want to create a new way of representing floating point. In standard IEEE floating point, we have 1 bit to represent sign, 8 bits to represent exponential and 23 bits to represent significand. In the new floating point system, I keep the breakdown of sign/exp/significand but there is no implicit 1 (assume there is no...
My task is to input a given list of size N, then process N queries that remove an item from the list and then print it to the screen. The input 5 2 6 1 4 2 3 1 3 1 1 would represent having a list {2 6 1 4 2}, then outputting and removing the third, then first, then third, then first, then first elements of the list, i...
I was looking an algorithm to solve a problem of finding whether and array contains a quadruple with sum = k,(k is input) mentioned at GeeksforGeeks. In one solution the approach mentioned is below,which i think i not correct: Store all possible two elements pairs of array in some another auxiliary array and also stor...
This question is related to the epsilon- (or delta- if you prefer) test for floating point equality. But my question is not how to do it. Instead I have a related algorithm for testing equality, and I would like feedback as to what might be wrong with it. The idea is to take the quotient of two floating point numbers a...
Steven Skiena's "Algorithm Design Manual" has the following code for the backtracking algorithm: #include "backtrack.h" #include "bool.h" bool finished = FALSE; /* found all solutions yet? */ /* a[] is the array representing a partial solution. k is the integer representing the current position i...
I was reading a textbook which describe general organization of cache as: Then an exercise is, given m=32, C = 1024, B = 8,E = 4, S = 32, so s = 5, b = 3, therefore t = 32-5-3 = 24 I am a little bit confused here, since E = 4, we only need 2 bits to differentiate it, so t should be 2, if t is 24, isn't that we waste ...
Given an undirected graph G(V,E), find the minimum number of vertices to remove so that the Edge Set of the graph becomes empty. In other words: If we remove one vertex we remove that vertex along with all edges connected to that vertex. Find the minimum number of vertices to remove so that there are no edges left in G...
Do we consider functions like printf part of C language even if it's not a keyword in it.
I came across this question about showing that the language $L = \{w \epsilon \{a, b, c\}^*: n_a(w) + n_b(w) = n_c(w)\}$ is context-free but not linear in the book by Peter Linz. That is easily doable by the separate pumping lemma for linear languages (as given in Linz's book), but my question is different. Evidently t...
Problem input: undirected graphs $G$, $H$ and a bijection $f: E(G) \to E(H)$ Question: Is there a Eulerian path $p: \{1,\dots,|E(G)|\} \to E(G)$ in $G$ such that $f \circ p$ is a Eulerian path in $H$? Is this problem in $P$, $NP$-complete or maybe equivalent to some other well-known problem that isn't known to be eithe...
Paulson et alii. From LCF to Isabelle/HOL say: Resolution for first-order logic, complete in principle but frequently disappointing in practice. I think complete means they can proof any true formula in first-order logic correct. In the Handbook of Automated Reasoning I find: Resolution is a refutationally complete ...
I'm having difficulty understanding when can we know if the time complexity of an algorithm is n+m or n*m Is the time complexity of the following algo O(n+m) or O(n*m) Can you please point me to a resource that can give some sample examples of code patterns for different variations of time complexity? For example: for(...
I have a large database containing coordinates along with an elevation number. If I am a person looking in some direction (0-360) with an n degree field of view, and located at some coordinate and at some elevation, how can I generate an image representing the horizon? What algorithm should I use?
I recently came across these books: Differential Geometry and Lie Groups: A Computational Perspective Differential Geometry and Lie Groups: A Second Course Their subject matter really intrigues me, as I really enjoy topology/geometry/analysis, but had not planned to pursue them since I also want to work in an area wi...
In MDK, we have a vector $W = \{W_1, W_2, ..., W_d\}$ where each element corresponds to the maximum weight for the respective dimension in the knapsack. I want to add a conditional constraint: $V = {V_1, V_2, ..., V_d}$, where each $i$-th dimension in the knapsack must have a value sum greater than threshold $V_i$. I a...
We know that each component has different frequencies, but what happens when a fast component directly comunicates with a slow one?
When thinking about diagonalization, I've always glossed over whether or not the enumeration, or the diagonal is computable or not. When does it matter? Say for example, that have an enumeration of the rational numbers in an uncomputable order, then we would have to assume that either an uncomputable enumeration of the...
On this Wikipedia article, they claim that given $A, B, C \geq 0, \; \in \mathbb{Z}$, deciding whether there exist $x, \,y \geq 0, \, \in \mathbb{Z}$ such that $Ax^2+By-C=0$ is NP-complete? Given by how easy I can solve some (with nothing but Wolfram), it doesn't seem right. I'm sure it's either written incorrectly or ...
Let $p$ and $q$ be prime numbers and $\phi$ Euler's totient function. Is there an efficient way of computing $\phi(\phi(p\cdot q)) = \phi((p-1)(q-1))$, that is not simply based on factoring $p-1$ and $q-1$? Obviously, if $p$ and $q$ do not equal two, $p-1$ and $q-1$ are even and consequently their prime factorization i...
Can anyone explain nicely what Simple Uniform Hashing is, and why searching a hashtable has complexity Θ(n) in the worst case if we don’t have uniform hashing (where n is the number of elements in the hashtable)
I have multiple linear programming problems of the form: $$ Minimize\{c^{T}\cdot x\} s.t. Ax = b, x \ge 0 $$ Where $c$ and $A$ are fixed for all the problems. Is there any way to utilize that for a more efficient solution than solving each problem from scratch? Currently I'm using scipy's linprog but the performance is...
This is a similar question to How 2d cellular automata rules works? However, the answer there did not provide me what I am looking for. Specifically, I want to be able to render these 2d cellular automata forms: https://www.wolframscience.com/nks/p173--cellular-automata/ I cannot find any reference anywhere that explai...
Say you have a grid of pixels. And there are 20 overlapping red rectangles on a blue background. I want to find an algorithm to count the minimum number of rectangles that are needed to form the image. And also the maxium extent of these rectangles. Any good algorithms for doing this? It is easier said then done. Perha...
Is there any conceptual generalization of higher-order functions like map and reduce but for N-dimensional objects (e.g. arrays or tensors)? For mapping, I guess it would be a point-wise generalization. In the case of reduction, I have more doubts because the iteration is not trivial. Perhaps it would take an additiona...
The loss function of each expert in the expert advice problem(or any online learning problem) depends on the time($t$) and expert advice at that time($f_{t}(i)$). suppose in this problem, loss function depends on the previous prediction of the algorithm. $$ l _{t} (i) = p_{1} p_{2} \cdots p_{t-1}f_{t}(i)$$ such that $...