instruction
stringlengths
35
29.1k
I have a full bipartite graph with node sets $A=\{a_1,a_2,\ldots,a_n\}$ and $B=\{b_1,b_2,\ldots,b_n\}$. Each node has a weight, $v_i$ for $a_i$ and $w_i$ for $b_i$. Each node $a_i$ is connected to exactly one node of $B$, say $b_j$, via an edge $e_i$, whose weight is $\min(v_i,w_j)$. Now I want to find a one-to-one map...
What are good algorithms for finding connected components in a graph defined by a set of elements X, where each x in X is itself a set of features f and a Boolean connectivity function (defined by generalization/subsumption) c(x,x')? c(x,x') = True if generalizes(x,x') or generalizes(x',x) else False generalizes(x,x') ...
Let's we have k matrices. For example we have 3 now, where first one is 8x5 ($a_1$ x $b_1$), second one is 5 x 6 ($a_2$ x $b_2$) and last one is 6 x 8 ($a_3$ x $b_3$). And our goal is to figure out if possible to multiply within any given matrices and reach a matrix of dimension x and y, when x and y is given ahead o...
I built a matrix multiplication algorithm and now I need some thoughts about following benchmark. C++ chrono:: high resolution clock Time(micro second) (Dim)256--> (Naive algo ) 296807, (My algo) 187479 (Dim)512--> (Naive algo) 2249495, (My algo) 1359046 (Dim)1024-->(Naive algo) 27930970, (My algo) 12309645 FYI, I ha...
A few things to get out of the way first: I'm not asking what properties the function must have such that a global optimum exists, we assume that the objective function has a (possibly non-unique) global optimum which could be theoretically found by an exhaustive search of the candidate space. I'm also using "theoretic...
I read about the similarities between the python list and c++ vector and it looks as if the only difference is python list is heterogeneous. Are there any other differences? How are they both implemented?
So there's following problem, that has been bugging me for the last few days: A solution of a PCP $ i_{1},\dots,i_{n}$ with the cards $(x_{1} ,y_{1}),\dots,(x_{m}, y_{m})$ is considered as $k$-limited if for all $j\leq n$ we say that $|\; | x_{i_{1}}\dots x_{i_{j}}| - | y_{i_{1}}\dots y_{i_{j}}|\;| \leq k$. So after e...
Context: First of all, my data: I am working with 3D data shaped onto a structured grid made of hexahedrons with for each 8 vertices and 12 edges. The data I'm working on is cell data (and not point data). Every cell and every vertex possess unique IDs. For each cell I can list every other cell sharing a common vertex....
I'm trying to find what the family of problem is - as well as an approach - for the following: I have a set of tasks T = [t1, ..., tn] to do, each of which has a corresponding reward ri. Each task takes place during a fixed interval - ie: task 1 is from times 1-4, task 2 from 2-5, and task 3 from 9-15. This means that ...
I'm trying to analyze the space complexity of using the coloring function $f$ which appears in "Colorful Triangle Counting and a MapReduce Implementation", Pagh and Tsourakakis, 2011, https://arxiv.org/abs/1103.6073. As far as I understand, $f:[n] \rightarrow [N]$ is a hash function, that should be picked uniformly at...
I am working through Bridge's computablity book and I came across this problem that does not have an answer. I don't know how to precede, any help is much appreciated.
So, I have an exercise in which I have to write a context free grammar for this language: $$L = \{x \in L(a^∗b^∗c^∗) : |x|_a > |x|_c; |x|_b > 0; |x|_c ≥ 0\}$$ meaning every string with any number of $a$'s, $b$'s and $c$'s in that order, with the amount of $a$'s greater than the amount of $c$'s and the amount of $b$'s g...
The typical nearest neighbor search implementation for k-d trees prunes branches when the distance between the target and the pivot along the current axis exceeds the smallest distance found so far. This is correct (doesn't wrongly prune any points) for any Minkowski distance. Is there a broader class of well-known d...
Is it correct to say that the Clique Problem is in $P$ iff there exists a family of Boolean circuits $C$ to decide Clique whose sizes are bounded by a polynomial? And based on this question, does that imply that there exists an equivalent set of Boolean formulas $F$ to decide Clique whose sizes are bounded by a polynom...
As a message I get (5,0,1,3), which is coding a sequence of numbers of length 2 in $\mathbb{F}_7$ as polynom with the 4 support points a1 = 0, a2 = 1, a3 = 2, a4 = 6. In the transimission occured an error. Calculate the original message. How do I do this? In my script we didnt't talked about polynomial codes directly j...
I know that under the hood, for a Haskell program, the GHC compiler uses graph reduction for optimization. Is there any way to view this graphical representation of the program? I haven't been able to find an existing plugin that, given a Haskell program, produces its graphical representation. I am relatively new to Ha...
I was going through the text "Introduction to Algorithms" by Cormen et. al. where I came across a lemma in which I could not understand a vital step in the proof. Before going into the lemma I give a brief description of the possible prerequisites for the lemma. Let $M=(S,\ell)$ be a weighted matroid where $S$ is the ...
Lets say that we have the language L = { $a^n$$b^m$$c^{m+n}$ $|$ $m$,$n$ $>=0$ } What is the way that i should follow to prove that the language is not regular? Assume that the language is regular. So,there is a string $w\in L$ such that $w = xyz$ , $|xy|\leq n, y\neqε $, n is the pumping length Lets say that the...
I was solving a question on LeetCode, where I had to generate all possible subsets of a given set of numbers. Although, the solution makes sense to me, I am unable to understand the derivation of time complexity for those solutions. A solution I found there was: class Solution { public: vector<vector<int>> subsets(...
I’m trying to design a DFA which accept string starting with 101 if the string start with 0 then it goes to dead state.Is my design is correct or wrong? And I don’t know how to draw transition table if the DFA has dead state.
It works I checked it but I don't know how to make it smaller :( the question is in my book,I can solve but it took too much time and effort and I'm pretty sure there's a simple soloution.
Show that the following problem is solvable.Given two programs with their inputs and the knowledge that exactly one of them halts, determine which halts. lets P be program that determine one of the program will be halted. P(Program x,Program y){ if(x will be halted) then return 1; else ...
As said in the title, i am quite curious wether NSPACE(2^(O(n)) equals NSPACE(n^2 * 2^(O(n)) I am aware of the fact, that NSPACE(k * 2^O(n)) equals NSPACE(2^O(n)) due to linear space reduction (i.e. some sort of super character representing k characters) But since neighter n nor n^2 is linear, we cant use this here. Th...
It's possible to return from a dpll algorithm M as maximum for MAX-SAT problem?: I have a sample: https://gist.github.com/davefernig/e670bda722d558817f2ba0e90ebce66f we can modify recurrency to return the outcome of MAX-SAT? Resources: https://en.wikipedia.org/wiki/DPLL_algorithm
I have a problem in which I am interested in taking a matrix of positive integer weights, including zero, where the matrix has dimensions nrow x ncol and the columns always sum to the same arbitrary number. I want to search for a list of paths (sets of edges essentially) that traverse through the grid space of the same...
Given the diagonal language $$L_d = \{ i : \sigma_i \notin L(M_i) \}$$ Where $M_i$ are all Turing Machines and $\sigma_i$ are all the words, if you put in in a Matrix like this: $$\begin{array} {|c|c|c|c|c|c|c|} \hline & \sigma_1 & \sigma_2 & \sigma_3 & \sigma_4 & \sigma_5 & ...\\ \hline M_1 & 1 & 0 & 1 & \dotsb & \dot...
Most non-convex optimization algorithms I have come across so far rely basically on random restart to find a better solution. e.g. Genetic Algorithm, Simulated Annealing, Metropolis Hastings Monte Carlo. Even in Stochastic Gradient Descent we can think of training each batch as a random perturbation. There are some non...
Suppose I have two sets $A$ and $B$ containing integers. Let $B'$ be the power set of $B$. Then suppose I have an algorithm that enumerates all possible pairings of elements in $A$ and $B'$ to apply a function $f$ to them and check something. I understand that generating a power set is $O(2^n)$, but what complexity cla...
You are given a polynomial of degree n. We have to find the value of the polynomial at n different points in O(n(log(n))^2). The answer should be modulo 998244353. I have read various blogs on it and a research paper but none could help me implement it. If anyone could provide some insight it would be really helpful.
I am trying my best to understand the sweep-line algorithm to find line intersections. I have understood most of the intuition except how it is calculating the intersection between 2 line segments using cross product. I am providing the code for that below, please ask me any doubts related to the code, so that I can ex...
Here is an excerpt from Andrew S. Tanenbaum, Computer Networks, 5th edition, Chapter 5 (The Network layer), Page 455: [Fifth, processes on the Internet are not required to use TCP or UDP. If a user on machine A decides to use some new transport protocol to talk to a user on machine B (for example, for a multimedia appl...
I have an interesting function. It takes subsets of {1,...,N} to positive integers, i.e. $f:P([N]) \rightarrow Z^+$. I know that if S is a subset of S', $f(S) < f(S')$. Also, if S and S' have the same cardinality, the ordering induced by f is lexicographic, so for example $f(\{1,2,4\}) < f(\{1,3,4\})$. Given a value ...
I am facing the following problem: Given an undirected complete Euclidean weighted graph $G(V, E)$ and its MST $T$. I need to remove an arbitrary vertex $v_i \in V(G)$, and given a vertex $v_j \notin V(G)$, I have to calculate the MST of $$G^{'}((V(G) \backslash \{v_i\})\cup\{v_j\}, (E\backslash\{(v_i, v_k): v_k \in V(...
From these notes pages 37-38. In HOL, I'm giving the task of proving: $\vdash \forall x^T. \forall y^T. (=_T x^T y^T) \implies (=_T y^T x^T)$ applying forall and implication introduction and the definition of $=_T$ I get: $(\forall_{T \to O} \lambda P'^{T \to O}. P' x^T \implies P' y^T), P y^T \vdash P x^T$ Here I set ...
I'm looking for some clarifications on an algorithmic task I've been trying to solve. This task is a part of Quiz 2 from the MIT 6.006 course. The main idea of creating k-copies of a graph G is clear. What I'm really confused with is the final graph G': Can you explain how the graph G' will look like? How will the G' ...
In Chapter 4 in Computational Complexity by Arora and Barak it states, regarding the configuration graph of a Turing Machine, that If M is deterministic, then the graph has out-degree one, and if M is nondeterministic, then the graph has out-degree at most two. In the configuration graph, a directed edge is placed fr...
Given an universum $U$ and two sets $A$ and $B$ of sets of elements from $U$. I want to find (if such a pair exists) $a \in A$ and $b \in B$: $a \cap b \equiv \emptyset$. Currently I can do it only in $O(|A| \cdot |B| \cdot |U|)$, is there way to improve this? Say, $|U| \leq 32$. Is there a way to speed algorithm up? I...
Lets say we are trying to solve some algorithmic problem $A$ that is dependent on input of size $n$. We say algorithm $B$ that runs in time $T(n)$, is asymptotically better than algorithm $C$ which runs in time $G(n)$ if we have: $G(n) = O(T(n))$, but $T(n)$ is not $O(G(n))$. My question is related to the asymptotic ru...
I understand why NP=coNP if SAT is in coNP (How do I prove that SAT in coNP implies NP=coNP?). But I'm missing why the following machine doesn't turing recognize the complementary of SAT: Given a turing machine M that recognizes SAT, the following turing machine recognizes coSAT: Run M on the input word w. If M accept...
I am looking for information on problems of the following kind. There is a function $f: [0,1] \to \mathbb{R}$ that is continuous and monotonically-increasing, with $f(0)<0$ and $f(1)>0$. You have to find the unique $x\in[0,1]$ such that $f(x)=0$. You can access $f$ only through queries of the type "what is $f(x)$?". B...
Well, suppose then we have an CPU system such as: Thread(s) per core $\equiv t$ : 4 Core(s) per socket $\equiv c$: 4 Socket(s) $\equiv s$: 1 Then, we must to perform a simple calculation such as: $ 4 \cdot 4 \cdot 1 = 16 $ Therefore, in general we have: $$ T = t\cdot c \cdot s \tag{1}$$ I guess that...
For range queries on a subarray [L,R] , I want to find all the indices of successive maximums from left to right within O(log(R-L+1)), excluding index "L". I know using segment trees I can find the single maximum in given time limit. Example if [L,R] is 20 3 10 5 10 7 6 7 5 7 5 -> the bold ones are the answers Note th...
DNS Spoofing and DNS Hijacking, both of them basically are type of attacks where the request is redirected to some other malicious website or some other web page. But I did not find some concrete difference between them, Can someone please explain the primary difference between DNS Spoofing and DNS Hijacking..
Is it true that if $L^*$ is recursive, where $*$ is Kleene star, $L$ is also recursive? I know that the opposite direction is true: If $L$ is recursive, then $L^*$ is recursive. But I don't know how to prove it in this direction.
I have a graph with a set of vertices $\mathcal{V}$ and a set of edges $\mathcal{E}$. There exists a path between every 2 vertices in the graph. To each edge there is an associated weight $w(e), e \in \mathcal{E}$. I define a (global) threshold $T$ such that if $w((u,v)) < T$ the two vertices $u,v \in \mathcal{V}$ are ...
The worst case time complexity of a given algorithm is $\theta(n^3logn)$. Is it possible that the worst time complexity is $\Omega(n^2)$? Is it possible that the worst time complexity is $O(n^4)$? The average time complexity is $O(n^4)$? IMO it is possible as long as you control the constant $c$, but then what's the po...
Here is an excerpt from Andrew S. Tanenbaum, Computer Networks, 5th edition, Chapter 5 (The Network layer), page 448: When aggregation is turned on, it is an automatic process. It depends on which prefixes are located where in the Internet not on the actions of an administrator assigning addresses to networks. Aggrega...
I'm working on a compiler for my own custom language. As I was reading an article on code optimization, I noticed that it assumed that the intermediate representation of the code had already been formed. Though I haven't yet started writing the optimization section of my compiler, I've been going through it in my hea...
I have an undirected weighted graph without multi edges. All the edge weights are whole numbers and known. I want to know in how many ways node values(node values are also whole numbers) can be assigned to the nodes such that the graph satisfies the condition that for every edge its edge weight is exactly equal to maxi...
If X is polynomial reduction to Y and Y is in NP, then X is in NP? Is this true, false or "we don't know"? Why?
In a game I am developing I came across an interesting problem, that seems like it could be solved using some modified variant of the knapsack problem, but it's a bit over my head. Let $x_i$, $ 1\leq i \leq n$ be the objects we are dealing with, and $p_i$, $ 1\leq i \leq n$ the cost associated with each item. Suppose t...
I'm sorry if the question is not relevant, i have tried to search for articles about it but i couldn't find satisfying answers. I'm starting to learn about machine learning, neural networks etc ... and i was wondering if making a neural network that takes a graph as input, and output the answer of an np-complete proble...
If X is in NP then $\overline{X}$ is in NP. True, false or "we don't know"? Why?
The following comes from section Dynamic Tables, Introduction to Algorithms by Cormen. et. al. In the following pseudocode, we assume that $T$ is an object representing the table. The field $table[T]$ contains a pointer to the block of storage representing the table. The field $num[T]$ contains the number of items in ...
I'm working on a system that will require manual data entry of 10-digit numbers (Σ = 0123456789). To help prevent data errors, I want to avoid generating any two strings that have a hamming distance of 1. For example, if I generate the string 0123456789 then I never want to generate any of these strings: {1123456789, 2...
Is it possible, according to the current state of knowledge, that orthogonal matrices can be multiplied faster than arbitrary matrices? More precisely, let $T(N)$ denote the worst-case time of the fastest algorithm to multiply two arbitrary $N\times N$ matrices (in the real RAM model). Let $T_{\rm O}(N)$ denotes the wo...
I was studying Union Find, and according to Wikipedia, there are 2 types of union: union by rank and Union by size. My question is, what is the runtime difference between the two (if any)? Intuitively, it feels like Union by size would always be better, since each time we merge, we are increasing the rank of every node...
In what applications would you choose an edge list over an adjacency list or an adjacency matrix? Sample Question, VisuAlgo: Which best graph DS(es) should you use to store a simple undirected graph with 200 vertices, 19900 edges, and the edges need to be sorted? Suppose your computer only has enough memory to store 4...
I am looking for the optimum algorithm for the following: 10-15 players Each player has between 20 and 40 cards. Each card can have one of up to 200 possible characters, and a separate numerical rating (higher is better). Card's characters may duplicate between players, or in players hands. Ratings are highly unlikely...
I have a question from one of the exercises in CLRS. Show that there is no comparison sort whose running time is linear for at least half of the $n!$ inputs of length $n$. What about a fraction of $1/n$ of the inputs of length $n$? What about a fraction $1/2^n$? I have arrived at the step where for a linear time sort...
I'm searching for an algorithm but struggle to find anything, as I'm not sure how to formulate it correctly. I created a simple survey app in Angular with 24 questions and each has 2-5 answers. When the user answered all the questions I'd like to give him a token (as short as possible) on the result page that he can no...
I have given the following SAT variation: Given a formula F in CNF where each clause C has exactly 3 distinct literals and for each C in F either all literals are positive or all literals are negated. Example: $F= (x_1\vee x_2 \vee x_4) \wedge (\neg x_2\vee \neg x_3 \vee \neg x_4) \wedge (x_3\vee x_4 \vee x_5)$ Is...
Given the two equivalent terms $A \vee B$ and $B \vee A$, Gödel numbering returns two various codes $2^{4}.3^{\overline{A}+1}.5^{\overline{B}+1}$ and $2^{4}.3^{\overline{B}+1}.5^{\overline{A}+1}$, respectively. These two codes do not generally equal to each other, which is an unfortunate if one would like to observe th...
An applied problem I am working on could be modeled as the following problem on graphs: Given an undirected graph $G=(V,E)$ and an integer $k>0$, find the largest set $S\subset V^k$ such that for each $A\in S$ the induced subgraph $G[A]$ is connected and such that no two $A_1, A_2\in S$ are adjacent in $G$. For $k=1$...
I read somewhere that the problem which asks whether or not a CFG $G$ generates $1^*$ is decidable. The proof goes like this: $1^* \cap L(G)$ is context free since it is the intersection of a regular language and a CFL, therefore we can test if $1^* \cap L(G)$ is empty since it is decidable to check if the language pr...
Suppose you need a c compiler. It would be preferable to write that compiler in a c-like language, given the complexity of a compiler of that degree. At best, the c compiler would be written in c, but that would require a c compiler to begin with. If a mistake is made in the making of one of the early iterations of com...
Prove: If $T'=(V,F')$ is a spanning tree, but not a MST of $G=(V,E)$, then there are edges $e' \in F'$ and $e \in $ $E$ \ $F'$ such that $w(e)<w(e')$ and $T'$ \ $\{e'\} \cup \{e\}$ is a spanning tree. My idea: Let $T=(V,F)$ be a MST of $G$ for all $e \in T$, try to insert it into $T'$ and see if there is an edge in the...
A Fibonacci heap is a data structure for priority queue / heap operations. It seems to have the best complexity for all operations: Since it has the best performance, why not use it everywhere? What are the disadvantages of it?
What is the difference between $\text{SIZE}(n^k)$ and $\text{P}/\text{poly}$? For reference: $\text{SIZE}(n^k)$ is defined as the class of problems solvable with Boolean circuits (of fan-in two) with $O(n^k)$ gates. $\text{P}/\text{poly}$ is defined as those problems over $\{0,1\}^*$ which can be solved by an infinit...
PROBLEM: Count the number of ways in which atomic operation(s) of n different processes can be interleaved. A process may crash mid way before completion. Suppose there are a total of n different processes - P1, P2, P3 .... , Pn. Each process can have a variable number of atomic operation(s) that constitutes that proce...
I racked my brain,I saw other people's solutions and it don't make sense. I think my biggest problem is I don't know when one string ends,like for example w1 is >=3 and it can have how many ever b's or a's as long as it's 3 and above,so when do we get to have the First a that's after the W1?how do I make sure it's not ...
I searched a lot on internet, including here, but I couldn't find an explanation that could convince me. The problem is the same of the title, if A is polynomial-time reducible to B and B is NP-complete, can I say that A is NP-complete too? Actually, I would say yes, because if I can convert a problem that I don't know...
After deleting a node in an AVL tree, self-balancing (zig-zag rotation or the left-right balancing) maintains O(logn) time that is not guaranteed in other unbalanced trees (like BST). The Balancing operation is said to be O(logn). What is the worst case for balancing? (I guess it will require balancing at every node al...
I'm new to dynamic programming and find a problem about balancing parentheses and smileys ":)" and "(:" at HackerRank, which is impossible to do. I've been trying to solve it by 3 days now. The main issue with this problem is that the input string size is in range of 10^9 (creating a dynamic programming 2d array of siz...
An integral linear program is one that has a maximizer that is integral. Sometimes it's possible to prove that a particular LP has this property, for example by proving that it's constraint matrix is totally unimodular. Suppose that we have an integral LP, how can we then efficiently find an integral maximizer? After a...
Input: Recognized text from images of labels taken with a cell phone in varying conditions. One image may enclose the entire text, or just a part of it. Expected output: The most likely version of the original text, ideally with an indication of the certainty. More images will of course provide better results. Even tho...
I am working on this problem in which I have a theory $T$ based on language $\mathcal{L}$ and the only information we have is that T is consistent and $\vdash \lnot(A \rightarrow A)$. Given this information, how can I know if this theory is sound, complete and/or decidable? My only guess is that I can say that $T$ is s...
Can there exist any integer sequence $A$ of length $N$ with all unique elements such that the length of its Longest Increasing Subsequence as well as that of its Longest Decreasing Subsequence is less than $ \displaystyle \lfloor \frac{N}{2} \rfloor $? If yes, then give an example of such a sequence. Otherwise, can any...
When I study Binary Search Tree, I try to use a pencil and paper to scratch the process of in-order traversal. However, I find that it is hard to maintain the call stack in my brain without paper and notes when the height BST is high. Question: What should I? Is it normal and should I practice more?
I've been trying to piece together an implementation of the Commentz-Walter string search algorithm. The idea is to construct a state machine from a trie, working backwards from the earliest feasible position. The paper is available here, though it is a scanned printout from 40 years ago. I have also found a better qua...
I have a probabilistic greedy algorithm for Exact Three Cover. I doubt it'll work on all inputs in polytime. Because the algorithm does not run $2^n$ time. I will assume that it works for some but not all inputs. Our inputs are $S$ and $B$ $S$ is just a set of integers $B$ is a list of 3-element {}s Algorithm Input va...
Hopefully this question isn't too general, but I was wondering what the relationship is between randomized algorithms that perform well with high-probability and those that perform well in expectation. My question is motivated by the definition of a randomized $\alpha$-approximation algorithm given here, namely that it...
I am trying to solve a problem and I am really struggling, I would appreciate any help. Given a graph $G$ and an integer $k$ , recognize whether $G$ contains dominating set $X$ with no more than $k$ vertices. And that is by finding a propositional formula $\phi_{G,k}$ that is only satisfiable if and only if there exist...
I am trying to solve the following problem: Find languages S and T over the alphabet $\{a, b\}$ such that $ S \not\subset T $ and $ T \not\subset\ S $ ($S$ is not contained in $T$ and not equal to $T$, $T$ is not contained in $S$ and is not equal to $S$) but $S^* = T^*$. It might be trivial, but I would appreciate some...
L = {a^n b^2n c^3n | n∈N^+} I'm trying to prove that L is a non regular language using Myhill-Nerode theorem.
Let $G$ be a graph and $X=x_1,x_2,...,x_n$ be an permutation/ordering of the vertex set of $G$. We then let $S_i = \{x_j:j\le i\}$, and $F_i$ be the number vertices $v\in S_i$ that are adjacent to some vertex $u \not\in S_i$. (where $u$ may depend on $v$ and $i$) We finally define $F$ to be a list of values $F_i$ sorte...
As you see, the string production process never ends. Can someone explain me if this language is regular or not ? $ S \to Α Β S $ $ A \to S $ $ B \to a B b $
Each context-free language has an automatic stack received by a non-deterministic blank. That is, it will not uphold the following determinism requirement:
Given a graph G, I need to find the number of ways to color it using two colors Black and White. Constraints: G will already have some nodes colored Black. Every node of color White needs to have one or more Neighbors of color Black. The nodes that are colored Black will always be leaf nodes. Vertices<=32 Edges<=Ve...
I want to write a function that takes N (maximum number of states) as a parameter, enumerates all possible finite state machines up to N states, and returns random FSM with a probability in proportion to the number of states (fewer states more probable). Alphabet = {0,1} Can you please suggest how to implement this enu...
Consider that there is sequence $a$ of length $n$ ,$a=[a_i,0\le i\le n]$. Now you are given with $\text{lcm}$ of some pairs of number from list that is, $\operatorname{lcm}(a_i,a_j)=k$ for $0\le i,j\le n$ and $i\neq j$ and $k$ is specific for given pair. Find number of sequences of $a$ that satisfy given $\text{lcm}$'s...
I am working on an algorithm in graph theory which I wish to prove it's polynomiality/NP-hardness. I am investigating a binary variable (0, 1) integer program which has the coefficient matrix consisting of only -1, 0, 1 and it is ''almost total unimodular.'' There is no objective function and the existence of a feasibl...
I have a slight technical struggle with this marvelous tutorial. On page 5 the tutorial talks about typing rules for Simply Typed Lambdas and presents following judgement as derivable via rules on figure 3. I was unable to prove neither id nor const by the same reason. Take for instance the id example. Say I am lookin...
Currently studying for an algorithms exam and I came across this question and solution, but I can't understand the solution where it references nodes of depth less than $4\log n$ and not restructuring. I understand everything else except for the $4\log n$ part - thanks in advance. The question: Suppose that when we per...
Question: Is a compiler a kind of Gödel numbering program? Wikipedia tells us that a compiler is: "In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language)". https://en.wikipedia.org/wiki/Compiler A...
Given arbitrary integers of $K$ and $M$, is $2^K$ + $M$ a prime? K = int(input('enter exponent K: ')) M = int(input('enter integer for M: ')) if AKS.Primality(2**K + M) == True: OUTPUT 'yes' else: OUTPUT 'no' I am not knowledgeable enough in number theory or any other field of mathematics to know the answer t...
I have course notes which claim the following two facts: First, DFAs recognize exactly the regular languages. Second, regular languages are closed under union, concatenation, and *. Now I have as an exercise constructed a DFA which recognizes strings from {0,1} which have an odd number of 1s. So the language of string...
Let $L_1$ be a regular language and $L_2$ any language. I want to prove that the language of $L_1$ truncated by $L_2$ is a regular language, i.e. $$\{w| wx\in L_1 \text{ and } x\in L_2\}$$ is regular. To prove that something is regular it is enough to prove that it is described by a regular expression. We know that ...
does appending an element to a list through a for loop work in O(1) time or O(n) time? In addition, what is the time complexity does "".join that list into a string work in?
Is IP masquerade and Network Address Port Translation(NAPT) the same? I'm not sure whether it is the same thing or not but I realized the mechanism is almost the same where both IP masquerade and NAPT changes TCP/UDP port and many-to-one relation is allowed:multiple private addresses share one global IP address. If it ...