instruction stringlengths 35 29.1k |
|---|
Let $\Sigma$ be the set {a,b} of letters. For a language $L\subset\Sigma^{*}$ over $\Sigma$, we define $\Gamma(L)$ as follows; $\Gamma(L)=\{v\in\Sigma^{*}|\exists w\in \Sigma^{*}.(|v|=|w|\wedge vw\in L)\}$. Here, $|x|$ denotes the length of the string $x$.
Then, for every context-free language $L\subset \Sigma^{*}$, $\... |
I have the following ternary constraint that needs to be converted into a set of binary constraints in order to be used for a constraints solving problem:
A = max(b,c)+1
How can I do this?
I am allowed to introduce a new variable X to do this.
|
$ L = \{ <G,k> |\ G \ has \ a \ simple \ cycle
\ at \ length \ k \} $
I think this language is in NP but my friend thinks this language is in P.
NP proof:
if a graph has a simple cycle of a specific length can be verified quickly if we are given the cycle as a certificate.We can check in polynomial time that the give... |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
return 1 if data[i] > data... |
I am currently writing an LL(1) parser. At several places (Engineering a Compiler book, Dragon book, or this discussion), I have seen two ways to go about this, either with a table driven parser (using FIRST, FOLLOW sets) which is basically a large 2D array that predicts which rule should be called or the recursive des... |
Given a knowledge base and a proposition alpha we can check if our knowledge base entails alpha using a model checking algorithm that functions as such : we generate a set of all the possible models ,and if for each model where our knowledge base is true alpha is also true we can conclude that our knowledge base entail... |
Say that a PDA is $\varepsilon$-free if it contains no $\varepsilon$ transitions (that is to say, $\varepsilon$ is not in the recognized string symbols even if it still is a stack symbol), but it may instead push any finite number of symbols to the stack during a single transition. Does every PDA have an equivalent $\... |
The question asks to write down a regular expression $r$ indicating the language of all the words above $\Sigma = \{a, b\}$ , in which the number of $a$ is even and there is no sub-word $aab$ in them.
I am aware of the fact that there is an algorithm that converts a finite automaton into a regular expression.
I want to... |
I know that exponential time complexity is $ O(k^n) $, where $k$ is some constant and $n$ is the input size, and that subexponential time is anything slower than that, $o(k^n)$ . If we define superexponential time complexity as anything faster than exponential time, $\omega(k^n)$, and given $O(n^{f(n)})$, where $f(n)$ ... |
In my script I have the following term:
x => y => both (x) (y)
This is reduced to
both
My interpretation is that this function (the whole term) takes two arguments and returns a function and two variables, but these aren't used by the function thus we can remove them? Is this interpretation correct?
|
I am reading this Wikipedia article:
https://en.wikipedia.org/wiki/Memory_segmentation
And I am in this paragraph:
Segmentation with paging
Instead of a memory location, the segment information includes the
address of a page table for the segment. When a program references a
memory location the offset is translated to... |
I'm reading about the Atlas operating system and I came across this:
The Atlas system used a British computer with 48-bit words. Addresses were 24 bits but were encoded in decimal, which allowed 1 million words to be addressed.
Why is it 1 million here if it's encoded in decimal?
|
In a directed graph, if you find scc (strongly connected components), then for each negative edge, if its 2 vertices are in the same scc and that scc has size > 1, then there is a negative cycle with that edge, and is easy to find it with a simple dfs.
Is this approach correct?
|
I'm currently implementing a RISC prozessor in a HDL and realized that I seem to have a somewhat incorrect understanding of how pipeling works for control signals. Here's my general understanding:
Ideally, each phase should take exactly one clock cycle (this is the case in my implementation)
The pipeline registers hol... |
I mean why value of 0 value in binary is not used by ascii encoding , it would have been used to represent char 0 or anything else why they used it to represent NULL
|
How we can prove that $2n−1$ comparisons are sometimes necessary to correctly merge two sorted sequences of $n$ elements each into one sorted sequence? I tried to prove it with binary decision tree, but it was not working.
|
How we can prove that the largest element in a min-heap using a comparison-based algorithm takes Ω(logn) time?
Is this useful that worst running time for comparison based sorting is >= longest path from root to leaf = height of the tree >= log(n!) = Ω(logn)?
|
Suppose I have a decision problem $\mathcal{L}\subseteq\Sigma^*$ and a verifier $V$ that recognizes $\mathcal{L}$, i.e. $L(V)=\mathcal{L}$. Let's arbitrarily choose some certificate $c(w)$ for $w \in \mathcal{L}$ such that $V$ accepts $(w,c)$. Let's consider the functions that bound the size of the certificate $|c(w)|$... |
Problem Statement
My wife's business runs a summer camp for 68 students. The students are divided
into cabins:
27 students in 3 groups of 7 and one group of 6 belong in one set of 4 cabins;
41 students in 5 groups of 7 and one group of 6 belong in the other set of 6
cabins.
Which set of cabins a student belongs in is ... |
Let $G=(V, E)$ be a directed network with a set $V$ of vertices and a set $E$ of edges. Two vertices are distinguished, $s,t$ which are the source and sink respectively. Each edge $(i, j)$ has an associated cost $c_{ij} \in \mathbb{Z}$ and a capacity $u_{ij} \in \mathbb{N}$. The objective is to achieve a flow of value ... |
Let's say we are given some CFG, maybe in SSA-form, and we want to "collapse" each top-level loop into s single node, whose successors would be all exit blocks of the original loop. So we get an acyclic CFG with loops replaced by nodes.
I tried finding such a construction in the literature but without success.
Are ther... |
Since SAT is np-complete, there is a polynomial algorithm to check if a given solution for any particular formula is correct. Just substitute the values and solve. But what if one claims that the given formula is unsatisfiable, is there a polynomial way to check if the claim is true... Am i missing something ?
|
I don't understand how to solve this problem. I understand the concept of bottleneck links but I can't seem to solve this specific question type.
For Question 3, I know the answer is 31 and that is achieved by adding the connections from A - B and the connections from C - D. I have absolutely no idea why that is needed... |
I'm working on understanding the backpropagation process in convolutional neural networks (CNNs) and am having some trouble comprehending how to calculate the partial derivatives of the output of a CNN layer with respect to both the input (x) and the filter weights (W). Specifically, I'm looking at a simple 1D convolut... |
I read almost everything I can find for count min sketch. Also look at most of the videos in Youtube, but did not found answer of a simple question -
What is the proper way to calculate dimensions of count min sketch
In both ChatGPT and Bing AI, if you ask how big a count min sketch needs to be in order to be able to "... |
This question appeared in my data structures examination :
You are given that GDCBFAHEJ is an in-order traversal and GCDBHJAEF is a post-order traversal. Either build the unique tree for which these are traversals or argue that they are traversals of different trees.
Why are we unable to build a unique tree, despite o... |
Let $DECIDE=${$<M> :\ M\ halts\ on \ all \ inputs$} and I wish to show its unrecognizable using a reduction from $ALL=${$<M> :L(M)=\Sigma ^* $}
using a deterministic turing machine $R$ which runs in polynomial time:
$<M>\in ALL \rightarrow _R R(<M>)=M'\in DECIDE$
R(<M>):
M'(x):
run M on x, if M accepts, halt o... |
I have been trying to find a multitape Turing Machine in order to accept a input string which consists on 0's and whose length is a power of 2:
However, Im getting troubble finding it, because I dont really know how to take the procedure with, for example, 2 tapes. I have found one solution for singletape, which is:
... |
I am currently taking a course on algorithms, and when reading about the 0/1 Knapsack Problem on Wikipedia I came across a technique which uses dynamic programming and supposedly runs in $O(nW)$ time, which makes sense to me after studying the algorithm. But to my understanding, the 0/1 Knapsack Problem is NP-complete,... |
I have a Windows 10 desktop (6 years old - Dell Optiplex) and a new Windows 11 laptop (maybe last years model - Lenovo Thinkpad P16 Gen2).
I am running scripts in R to compare their compute times. The new machine is roughly twice as fast on average, but a significant portion of that time is occurring outside of user+sy... |
Most of the sources about count min sketch say it usage is to give counts for several "items" stored "inside".
However in the following this question
What is the proper way to calculate dimensions of count min sketch
I made valid point if count min sketch is very saturated, it will always return wrong overestimated cou... |
I am trying to understand how to approach the question below which is a coursework question. I understand that each memory request is 32 bits and so there will be 262144 requests. There are 42 blocks in the cache. I am not sure how to think about this in terms of cache hits and misses. Is this question even well define... |
Do we know anything about the hardness of the optimization version of the multiway number partitioning problem when the set of numbers to partition consists of the reciprocals of the first $n$ integers? That is, for $n, k\in \mathbb{N}$, find sets $S_1,\dots,S_k$ such that
$\bigcup_{i=1}^k S_i = \{1, \frac{1}{2}, \fra... |
In Catan you can calculate the longest road by finding the longest (most roads) path which does not repeat any edges/roads, and does not cross through a vertex controlled by another player.
I started doing an algorithm that:
sorts the roads into connected networks (note there is only one of these above)
for each road... |
I've been looking online for quite some time for some 'general' rules on this.
for example, there's a 'rule' that claims that if a language is like $$L={w\in {a,b,c}^* : count_\alpha (w) =count_\beta (w) \pm count_\gamma (w) }$$ where $\alpha , \beta , \gamma $ could take on the form of one of the characters in $\Sigma... |
I can't find space complexity of this problem with search engines.
I think I have NL algorithm for it (just a basic "one by one non-deterministically accept values if possible"), but I wonder what other research was done on it.
Any references and/or ideas?
|
This question is from CLRS (3rd Edition).
So, I know that this is true, but I can't seem to prove it.
My approach was the following:
Let $f(n) = o(g(n)) \Rightarrow 0 \le f(n) < c_2g(n)$ for some $c_2 > 0$ and for all $n \ge n_1 \ge 0$
Similarly, $f(n) = \omega(g(n)) \Rightarrow 0 \le c_1g(n) < f(n)$ for some $c_1 > ... |
The problem:
Given two boolean formulas in 2-CNF, decide if they are equivalent.
I know that the problem is $\mathsf{coNP}$-hard when at least one formula is in 3-CNF. However, the same proof of $\mathsf{coNP}$-hardness does not apply when both formulas are in 2-CNF.
Conversely, I don't see a straightforward way to s... |
I am a mathematician that is going to switch subjects to theoretical computer science. From maths I am used to reading papers and books very slowly (almost as slow as possible) and I usually expect to need an hour per page, so reading a book of 500pages is almost impossible (and I never did). But now I am reading a boo... |
Given a set of points $S$ which is a subset of a vector space $V$ I want to want the smallest subspace of $A$ of $V$ such that $|A \cap S| \geq k $.
I suspect some variant of this problem would have already been studied but I have not been able to find it. Have anyone seen this or something similar before?
|
any (heuristic) algorithm for non-metric symmetric TSP that works on a complete weighted undirected graph with 100-1000 vertices?
|
i'm designing a CPU from scratch so i want it to be small. i decided to go with 4 bits registers. but 16 words of memory is a bit too small and i want more so i guess i need wider address bus (ie. 6). that raises a few questions:
how should i set address to memory address register?
using multiple data registers at th... |
The picture below shows how to reduce the Boolean Satisfiability problem in CNF to the circulation problem in undirected graph (see here).
As you can see, a[i] are the variables and C[j] are the clauses of a formula in the conjunctive normal form. If there is an edge between a variable (or negated variable) and a claus... |
I'm creating a plagiarism detection algorithm in Python, which scores how much of document A has been plagiarised in document B, and returns all the copied sections in B that were plagiarised from A.
Here's my working version:
from textdistance import LCSStr
DEFAULT_MIN_SUBSTRING_LEN = 30
def get_doc_lcs_matches(
... |
Is a reference type (agnostic of PL) the object being pointed at, or the object doing the pointing?
I'm having a hard time wrapping my head around the concept fundamentally (of course, I have backgrounds in pointers, C, C++, Java, Prolog, Ocaml, etc. and am familiar with the implementations in all of them).
I mean fund... |
When given one grammar, we can formally prove that it can recognize one language using QA_1
Since Kleene's Theorem gives the equivalence between the regular grammar and the NFA, we can also use QA_1 to prove that one NFA can recognize one language by transfroming the NFA to the grammar firstly.
Then how to prove that o... |
As title says, what I am trying to do is to find a way to sum integers and later compare them with another integer W, in a manner that when the sum of integers is less or equal than W, using only CNF.
My best approach to the sum was to convert every integer in its binary form and use a XOR to perform the addition. Howe... |
I'm studying asymotic analysis and i encounter this problem:
Given a recurance relation: $$T(n)= aT(n/b)+cn^a (n>0;a>=1;b>=1)$$
prove that
if $a>a^b$ then Tn=$\mathfrak\theta(n^{log_b(a)})$
if $a=a^b$ then Tn=$\mathfrak\theta(n^alog(n))$
if $a<a^b$ then Tn=$\mathfrak\theta(n^a)$
This problem scream master theorem to me... |
I'm trying to write a grammar for w being a nonempty word and z any word. That is, these are words that start with a nonempty word and end with its reverse. I've seen a very similar grammar before but it uses the alphabet {a,b}* rather than just {a,b}. Could anyone help me come up with this grammar or give me some advi... |
I've been trying to get a deeper understanding of how dynamic programming works and came across how it can be represented as directed acyclic graphs (DAGs). It's easy to see why, nodes represent the subproblems and directed edges represent which problem the subproblems help solve. Similar to a recursion tree but with r... |
I attempted this question and I do not understand why the last option is necessary in order to get the right answer.
My logic/thought-process:
In this question, only two scenarios can occur:
Scenario 1: Data was sent from the receiver but was corrupted. The Data is sent again and it is not corrupt this time.
For Scenar... |
One of my undergraduate math professors used to say "we'll always be drawing a picture, even when it is impossible", and I came to strongly sympathize with his witty point. Some recursion theory proof techniques are rather easy to visualize: diagonalization argument is easily pictured as filling out a table, and subse... |
I have asked one similar question QA_1 "The formal proof that one Turing Machine recognizes one specific language" and the answer fills the part "It does not generate any string that is not in $L$." of this QA_2 answer.
For one general function, the Halting Problem tells us it is impossible to "prove that the machine ... |
I want to construct a regular expression for strings over the alphabet {a, b, c} that don’t contain the contiguous substring "baa". I tried to follow the same procedure as in all the words that don't have both substring bba and abb, where the goal was to find a regular expression that matches all words that do not cont... |
In Theory of Computation lessons, the limits of computation are usually analyzed within the framework of Turing machines, so if something isn't solvable with Turing Machine, then we consider this problem as undecidable.
I know computational models like Lambda Calculus are equivalent due to Turing-completeness, but why ... |
I'm trying to prove a statement "given a graph G=(V,T) and that no cycle C exists that contains only edge "e" and other edges that their weight is smaller than that of "e", prove that "e" must be in some mst".
I tried to proof by contradiction, but I'm not sure what I can say about "e" when it never belongs to any mst.... |
Let $G=(V,E)$ be an undirected connected graph with a set of vertices $|V|$ and a set of edges $|E|$. A set cover $D$ satisfies $D \subseteq V$ and $uv \in E \implies u \in D \lor v \in D$. A variant of the vertex cover requires that exactly one vertex, $u$ or $v$, not both, is in $D$. In this sense, no vertices in $D$... |
I'm trying to prove that the algorithm for subset sum, that is the algorithm that given a set of numbers $\\{x_1, \dots, x_n\\}$ and a number $K$ find if there is a subset $\\{x_{1_k}, \dots, x_{n_k}\\}$ that adds up to $K$.
Now one of the typical backtracking algorithm is of the form (I know there are better ways of w... |
Consider the related problems of, given a strongly normalizing lambda term, computing the longest and shortest paths ending in a normal form.
In terms of bits of input the optimal complexity is some uncomputable function (since the input can be a Busy Beaver etc.). But the complexity of brute force is still quite large... |
In the context of linear integer programming, we have a branch and bound algorithm described here. This involves solving the non-integer constrained linear program and successively introducing additional constraints, thus getting a bunch of integer solutions. Then picking the best among those.
And then there is also a ... |
I ran into this exercise that says:
With a given binomial heap with n elements and n is divisible by 8, split the heap into 2 binomial heaps, one with 3n/8 elements and the other with 5n/8 elements.
I tried using another heap as a helping heap that saves the heaps I need to merge, but I didn't exactly know how to spl... |
I am quite new to Regular Expressions, and I'm trying to solve this problem:
Design a regular expression that accepts the language of all binary strings which their length is odd with no occurrences of 11.
At first, this is what I have:
(0(00) * 1 + 1(00) * 0) * (0 + 1)
However, I am told that this is wrong. A quick ... |
I am only familiar with binary implementations of information, though I am aware other implementations (ternary etc.) exist. I was wondering, if a code over $\mathbb{F}_q^n$ is used in practice, where $q\neq 2$, how is this done really? Do we use chunks of bits to encode elements of $\mathbb{F}_q$, for example $\{00, 0... |
Let $\Sigma_{1}=\{a,b\}$ and $\Sigma_{2}=\{t,f\}$.
Define the function $f_{w}:\Sigma_{1}^{*}\rightarrow\Sigma_{2}^{*}$ for every $w\in\Sigma_{1}^{*}$; $f_{w}(w')\in\Sigma_{2}^{*}$ is the word obtained from $w'\in\Sigma_{1}^{*}$ by replacing the start position of each subword that matches $w$ with $t$ and any other posi... |
Given an array of positive integers and a positive integer K, I need to find the minimum subset sum S greater than K, and the size of the smallest subset that sums to S.
I have attempted to first find the minimum subset sum greater than K with a 0-1 knapsack approach, then finding the smallest subset that sums to that ... |
I have many 3D boxes. All boxes are rectangular cuboids (they can rotate 90° so dimensions are interchangeable). The goal is to pack those boxes one into each other to minimize occupied space. There is no limit how deep boxes can be nested into each other. Single box can have multiple smaller boxes inside, and they can... |
If P = DTIME(n^c) and EXP = DTIME(2^n), and we prove that NP = EXP, then it means that NP = DTIME(2^n).
According to the time hierarchy theorem, the set of languages decided in O(f(n)) is bigger than those decided in o(f(n)). So does that not imply P != NP?
|
I need to implement a solution where I will have an image and other text variables as temperature, humidity and precipitacion. I wish to preview the inflow as output based on these inputs.
I suspect that I'd need a CNN to classify the image and combine it with the other variables (precipitacion,temperature and humidity... |
Are there languages L1 ⊆ L2 ⊆ L3 where L1 and L3 are NP-Complete languages and L2 ∈ P? Would this imply P=NP?
Thanks
|
Can you provide the transition table along with the solution for better understanding?
|
In C it's well known to use simple routine for turning integer rng into float rng. Something like that
float frand( float min, float max ) {
float scale = rand()/(float)RAND_MAX; // [0, 1.0]
return min + scale * (max - min); // [min, max]
}
So the core random number generation is happening inside integer rand(... |
Given two unbounded knapsack instances, $K_1 = (W_1, weights, values), K_2 = (W_2, weights, values)$, where $W_1 \ne W_2$, what is the complexity of determining $v(K_1) = v(K_2)$ where $v$ returns the optimal sum of values given a knapsack instance?
I know that the decision problem of knapsack -- i.e. asking whether or... |
Let's take a compound propositions
Either it is below freezing or it is snowing.
Now if,
$p$: it is below freezing
$q$: it is snowing
Question Link: https://gateoverflow.in/42720/kenneth-rosen-edition-6th-exercise-1-1-question-7-page-no-17
Will it be $p \vee q$ or $p \oplus q$? There are some instances where semantic... |
If you implement mergesort top-down you can always split the input of length $n$ into one of length $\lfloor n / 2\rfloor$ and one of length $\lceil n / 2 \rceil$. This ensures that all merges are always well-balanced: the left and right inputs differ in length by at most 1.
Is there a way of achieving this property in... |
As a beginner in neural networks, I'm currently working on a project for predicting winning fighters in MMA matches. I understand that this is a complex task due to the nature of the sport.
Currently, I'm achieving an accuracy of 64.2% on my test dataset. My goal is to increase this accuracy to 70%.
The method I'm usin... |
I recently learned about the definition of PSPACE problems, which are a subset of decision problems that can be solved by using polynomial space. However, one thing I don't understand is when I asked my instructor whether any problem, as long as it uses polynomial space to solve, is in PSPACE, and the instructor said y... |
I understand separation logic as a form of verification method, similar to Hoare logic. That is, they allow to reason about statements of the form $\{P\} C \{Q\}$, where $C$ is an instruction, and $P$ is pre-condition, $Q$ a post-condition.
My question is: How is separation logic used in practice? Do we manually derive... |
I was studying pumping lemma for CFL and in the proof it says that, we choose the shortest parse tree if there are multiple parse trees and we also choose $R$ the repeating variable such that it's the lowest in the tree.
It says that it satisfies condition 2 $(|vy| \gt 0)$ & 3 $(|vxy| \leq p)$. I don't understand how.
|
I came across this interesting problem in a test and I couldn't complete it.
There is a string given s which can consists of numbers between 0-9 and '?'. In place of '?' we can insert any of the numbers between 0 to 9. We need to find the number of ways in which it can be done so that no two adjacent numbers are same.
... |
I'm searching for equivalent problem classes from the polynomial hierarchy to function problems. I have this problem similar to traveling salesperson, which imo lies in the second order of polynomial hierarchy. However the existence of an answer can always be answered with yes due to the structure of the problem. There... |
Background
I'm writing algorithms for generating arbitrary strings from a formal language $L \subseteq \Sigma^*$, one symbol at a time from left to right, while also ensuring that the strings do not exceed a given length $N$. My algorithm cannot fail partway and backtrack, i.e. it can't just generate a string from $L$ ... |
I am currently reading Michael Soltys' Analysis of Algorithms (2nd Edition), and Problem 1.13 of the subsection titled Invariance reads:
Let $n$ be an odd number, and suppose that we have the set $\{1,2,\dots,2n\}$. We pick any two numbers $a$, $b$ in the set, delete them from the set, and replace them with $|{a-b}|$.... |
I don't know if this post belongs in this site because I feel it might be a programming question, but also I feel it might be related to the way Color Spaces work, if it does't belong here I can change it. I would like to know how many different HSV colors are possible to generate using OpenCV.
HSV colors are defined b... |
The question asks to write the shortest regular expression possible to the following automaton:
I see only one way to tackle the problem:
Use one of the methods mentioned here How to convert finite automata to regular expressions?
and then get a regular expression.
If for example I use the Transitive closure method, i... |
I want to make a simple C program in order to measure L1, L2 and L3 latencies of my CPU. I know some info about them:
Caches (sum of all):
L1d: 128 KiB (4 instances)
L1i: 256 KiB (4 instances)
L2: 2 MiB (4 instances)
L3: 4 MiB (1 instance... |
in my quest to understand computability theory, I came across this question, and it made me think that I don't fully understand the theory
is this language in R RE or coRE? or neither
$$ L=\{ <M>|M \ Is \ a \ TM \ that \ accepts \ all \ even \ length \ words \} $$
my attempt:
in terms of where intuition this lang... |
I am learning about finite automata and trying to create a machine that matches
{w ∈ Σ∗| w does not contain the substring 10}
I created a DFA where it either starts with 1 or 0. I know it's not the most concise FA, but is it accurate?
|
I originally thought it was 0(01)*(01)0 U 1(01)(01)1 where:
two versions: one that starts and ends with 0, the other that starts and ends with 1
connected by plus, which does not mean union of both but either or
repeat of (01)* to make the string even. For example, for 0010 you would
start with 0
pick 0 from the fir... |
So I am trying to draw a finite automation that has no limits on the length, but cannot have the substring of 10
I created a DFA that could satisfy this requirement, but am uncertain about the accept states having 01 because you can use the loop to create something like (i.e. 101010).
But I can't add additional transi... |
I'm learning about Turing machine program,i want to know how we write a Turing machine program about any given problem, like a string is accepted by Turing machine, program (for a Single Tape Turing Machine) that checks if a binary
number on the tape is an even number etc
|
Is it possible for there to exist two context-free grammars where the set of rules of the first is a proper subset of the set of rules of the second, yet the language generated by the second grammar is a proper subset of the language generated by the first?
|
Several years ago, I tried to get two identical pairs of DDR4 RAM to run together in my computer. I have since bought a set of four, but I've always wondered why the RAM didn't work. Its been long enough that I don't have images from the MemTest, but I keenly recall the errors the test was throwing constantly from the ... |
There is a sorted integer array $a_1 \dots a_n$ and an integer $1 \leq k \leq n$, we need to figure out the minimized total cost to group this integer array into $k$ groups. The cost per group is mean($a_i \dots a_j$) for a group from $i$ to $j$. Give an algorithm in $O(nk)$. Group here means partitioning and there's n... |
I have only begun studying this subject and have only completed the first few chapters of the Elements of the Theory of Computation.
I have seen the answers (on this site and elsewhere) saying that the set of all Turing machines is countably infinite. Intuitively, this makes sense to me, as I can imagine the equinumero... |
Just curioius, I wanted to know when $S$ ={set of divisors of N} and we're given $N$ a target product. Our goal is to decide if a combination in $S$ has product equal to N.
Does the problem remain NP-complete in this restriction? Assuming only positive integers?
|
According to this link binary variables - absolute values the formula of some binary variables like absolute value is :
y = | x1 - x2| for two variables x1, x2 with 0 ≤ xi ≤ U
Introduce binary variables d1, d2 to mean
d1 : 1 if x1 - x2 is the positive value
d2 : 1 if x2 - x1 is the positive value
MIP formulation
0 ≤ xi... |
In the Chomsky hierarchy, level 0 grammars include all languages that can be recognized by a Turing machine. There is no level -1 (which would represent the class of languages that cannot be recognized by a Turing machine, but can be recognized by something more computationally powerful than a Turing machine). Turing m... |
Consider a uniquely designed museum where rooms are arranged in a tree structure.
Each room can have up to two child rooms connected by a path. The task is to develop
an algorithm to place a minimum number of security guards so that the entire museum
is guarded. A guard placed in a room can guard that room, its parent ... |
I am currently writing a tool that will be used in an industrial process to place components with physical requirements. It boils down to the following:
I have a set of points (typically, a few thousands);
I need to place these points on a (2D) plane;
for each pair A, B of points, I have a constraint that is either
t... |
In cuckoo hashing, an insertion failure occurs when there is an infinite loop of displacements. This is detected by a “max iterations” count on the insert function.
When the insert fails, the table is rehashed using two new hash functions. These are selected from a given hash family.
My question - how are these hash fu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.