instruction stringlengths 35 29.1k |
|---|
Please also explain in terms of closure of these languages and plot a difference using specific example.
I am interpreted like this and now i am confused.
S1 and S2 are two languages.
"S --> S1. S2 " ( S1 followed by S2 hence concatenation )
and
"S--> S1.S2" ( S1 'and' S2 hence Intersection)
Correct me where I am going... |
It's a pretty basic question, but I couldn't find an explicit answer in the book which I'm using, also when searching for it - I didn't find a reliable reference.
Correct me if I'm wrong but for two DFA's, $A , A'$ -given that $L(A) = L(A')$ doesn't mean that the DFA's are equivalent, so what are the (sufficient and n... |
For two words $w,v \in\{0,1\}^*$ of equal length, let $w+v \in\{0,1,2\}^*$ denote the word in which the $i$-th word is the sum of $i$-th position of $w$ and $v$, as follows: if $w=a_1 \ldots a_n$ and $v=b_1 \ldots b_n$, then $w+v=c_1 \ldots c_n$, where $c_i=a_i+b_i$ for each $i\in \{1, \ldots, n\}$.
Assume $L \subsete... |
I'm kind of new to lambda calculus and I found this Wikipedia article
https://en.wikipedia.org/wiki/Mogensen%E2%80%93Scott_encoding
The section Comparison to the Church encoding presents a short comparison between Church and Scott encoding
Church
λx1...xAi.λc1...cN.ci (x1c1...cN)...(xAic1...cN)
Scott
λx1...xAi.λc1...cN... |
I know all the regular languages are decidable but not sure whether it can be done in LogSpace.
|
Let $G$ be a context-free grammar with set of terminals $A$. Let $X$ be a non-terminal in $G$. Is the language of words over the alphabet $A$ with a syntax tree in which the non-terminal $X$ appears even number of times is context-free?
|
I am looking for an efficient algorithm for the following problem.
There is a base-k numeral system, and we want to have some k-length numbers, but all of the digits must be different ones.
It would be useful, if all of the possible feasible numbers would be unequivocal sortable (so the given nth number is always the s... |
I have two arrays.
seconds = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, ..., 2680]
totalMeters = [0, 3.2, 7.1, 10.6, 14.1, 17.9, 21.5, 24.2, 27.8, 32.5, 36.9, ..., 5000]
The totalMeters array is the total meters that I have run at this specific point of time. The sampling is 2 seconds.
I would like to find where in th... |
I have group of people. Each person can be described by few characteristics:
age, occupation, city, favorite_color
I would like to generate 60 random people and combine them into pairs.
With a constrain that no person in a pair can share any characteristic, for example I can't have two people in a pair whose favorite_... |
There is no known proof that one way functions exist. But what is the heuristic evidence that they exist?
I sometimes read that the existence of cryptography is heuristic evidence that they exist. E.g. the ciphertext from a block cipher like AES is easily computable if you know the plaintext and key, but the key is not... |
Follow-up question in the series:
Karp hardness of searching for a matching erosion
Karp hardness of searching for a matching split
Maximum Matching Cut problem
Input: An undirected graph $G(V, E)$ and an integer $k$
Output: YES if there exists $M \subseteq E$ such that $M$ is a matching of size $k$ (i.e. $k$ edges) a... |
I was watching a lecture on determining the strongly connected components of a graph using Kosaraju's algorithm and the lecturer claimed one can easily walk the edges in reverse fashion.
While I see this happening with an adjacency matrix representation(the reverse is the matrix transpose, and you can determine its ele... |
I'm just beginning self-studying a course on computability and automata; my textbook, describing a generic Turing Machine, lists two following halt conditions:
A TM halts, if for a particular state $q \in Q$, $\delta(q, a) = (q, a, HALT)$ for all $a$ in the alphabet and this $q$ is called a halt state;
A TM also halts... |
Concerning about a wide variety of complexity classes, I have come up with the above conjecture.
Please, establish the claim in the title formally.
|
Chapter 6 of "Algorithms" by Dasgupta, Papadimitriou, and Vazirani summarizes four types of subproblems that are quite common in dynamic programming. They are
prefix/postfix of a string/sequence/array
both prefixes/postfixes of a pair of strings/sequences/arrays
an interval of a string/sequence/array
a rooted subtree... |
Please, establish the above claim formally. It seems that the structure of complexity classes has so much bizarre features everywhere.
For the $\Longrightarrow$ direction, a padding technique will work out. For the other direction, the time bounds are pushed down, so hardly any current technique would succeed.
|
All I could find is an example of sparse language.
I understand that I need to design a language whose all strings generation should not be bounded by a polynomial function, but I feel all the languages string generation is bound to at least one polynomial, so I am unable to design a language L whose strings are not bo... |
I have 30,000 items; each item has 30 parameters that take values from 0 to 5. These parameters are named $p_0$ to $p_{29}$ and their value is an integer between 0 and 5. I want to store these items in a data structure where I can do this lookup quickly: find the parameter with a given value for $(p_0, \ldots, p_{29})$... |
In a recent exam, I've been asked to solve the following problem:
The problem
Two players play the following game: Given a sequence of coin values
$v_1,\ldots,v_n (n \vert 2)$ the players take turns in taking one coin
from either "end" of the sequence. The value of that coin is added to
their score.
Player 1 a... |
This question is based on a solution of Laura Toma to a question from CLRS (#6 on the sheet).
Question: Give an $O(n\lg k)$-time algorithm to merge $k$ sorted lists into one sorted list, where $n$ is the total number of elements in all the input lists. (Hint: use a min-heap for $k$-way merging.)
Solution: The straightf... |
A popular app takes 10 seconds to execute on a 11 watt smartphone A, and it takes 8
seconds to execute on a 13 watt smartphone B. The app is a bigger drain on the battery
on which smartphone?
|
In multiobjective optimization, what does the distance exactly means, is it:
1) The distance from reference point (V) to an individual (Xi) (candidate solution) in the population (decision space).
Euclidean Distance = d(Xi,V)
OR
2) The distance from reference point (V) to the objective vector f(X) in the objective s... |
I searched online but I couldn't find any comparison between rendering a point cloud and rendering a triangle mesh.
|
Singhal–Kshemkalyani’s differential technique is based on the
observation that between successive message sends to the same process,
only a few entries of the vector clock at the sender process are
likely to change. This is more likely when the number of processes is
large because only a few of them will inter... |
I am reading the lectures about cubical type theory in this github repo. In lecture 1 the author defines function extensionality the following way:
funExt (A B : U) (f g : A -> B)
(p : (x : A) -> Path B (f x) (g x)) :
Path (A -> B) f g = <i> \(a : A) -> (p a) @ i
and writes
To see that this makes sense c... |
The question is as follows:
I am new to this, and I do not understand how to apply divide and conquer to a matrix, the algorithm that I have come up with is as follows (I am not sure if I am correct)
I thought I can divide the matrix into a matrices of 3 x 3 and 2 x 3 first. Then I will apply sorting of rows over colu... |
I've read conflicting answers for the space complexity of the top down implementation w/ memoization for the classic coin change problem. Would this be O(N * M) space as Interview Cake says https://www.interviewcake.com/question/javascript/coin?section=dynamic-programming-recursion&course=fc1 or O(N) space or LeetCode... |
I know that for an array of size n distinct elements, the Average Case complexity for linear search is as follows:
A(n) = $\frac{n + 1}{2}$
However, I am having trouble coming up with the Average Case complexity in the case where half of the elements in the size n array are duplicates. Take, for example, this array of ... |
I have started to learn automata theory and languages. I am new to regular expressions.
As a use case in real world, I would like to construct a regular expression to accept a c-style string: enclosed by double quotes, allows escape sequences (\" to escape a double quote, \ escape a backslash, \n escape a new line...) ... |
A question from the textbook Modern Operating Systems by A. S. Tanenbaum reads as follows:
A computer has a pipeline with four stages. Each stage takes the same time to do its work, namely, 1 nsec. How many instructions per second can this machine execute?
This was recently a homework question in my operating systems... |
When I hold down a key on my keyboard, a continuous stream of characters is generated and is displayed on the text editor, Now since pressing a key is a hardware interrupt, so does holding down a key continuously generates interrupt signals and does CPU constantly keeps acknowledging those ? or something else happens ?... |
I have a use case, real one, and I'm trying to come up with an efficient maximization algorithm to solve it.
I'll try to simplify, with a simple analogue, and after will explain the real world use case:
Analogue:
Imagine you have 2 buckets of springs.
Each spring has 2 properties: resting length, and maximum stretchi... |
I'm currently going through this book about programming languages, and in section 4.2, Lemma 4.2 it says this:
Lemma 4.2 (Inversion for Typing). Suppose that $\Gamma \vdash e : \tau$. If $e = \texttt{plus}(e_1;e_2)$, then $\tau = \texttt{num}$, $\Gamma \vdash e_1 : \texttt{num}$, and $\Gamma \vdash e_2 : \texttt{num}$... |
Consider the following set constructed with a regular Kleene-star operation:
$$
\{10^n \mid n\geq1\}^*
$$
Would something like $10100$ be in this set? I know $1010,100100100,1000,$ etc would be, but I'm not sure if you can change $n$ per repetition and have it be something like $10100, 101001010010$, etc.
|
The paper "CPS Translating Inductive and Coinductive Types" mentions that there is an isomorphism between inductive (mu) and coinductive (nu) types, which they use for their translation. It states that:
$$\neg\mu Z.A(\neg Z)\ \cong\ \nu Z.\neg A(Z)$$
...but it gives no more details about it. Is this isomorphism correct... |
I have been doing some research online looking for graph problems that are decidable but not in NP. I have found the concept of succinct graphs, which if I understand properly, consist of making the input small (i.e. supplying the graph structure using a small amount of memory) so that when properties of the graph are ... |
When you install an OS on a piece of hardware such as a Macbook, what is happening logically? In other words, how does the software "talk" to the hardware? Is it the same logical process with every OS and every piece of hardware, or is this process different for each OS and each piece of hardware?
|
I was looking at a recursive solution for the robot on a grid problem which basically states that there is a robot on the top left corner on a grid and you are supposed to find a path to the bottom right of the grid and the robot can only move down or to the right. Below is the recursive function for the solution
publ... |
First, read the previous question: Karp hardness of searching for a matching cut
As mentioned in the supposed-to-be-comment answer in that question, without the requirement of cardinality $k$, the problem has been proven to be $\mathrm{NP}$-hard even when restricted to bipartite graph of bounded diameter.
Now, I wanna ... |
First explaining the "reverse" use as a background:
There is an array A which contains N boolean values
There is an array B which contains N boolean values
I start iterating over array A and for every iteration I increment its current position by 1.
When corresponding bits at currentLocationA and currentLocationB in b... |
Compared to not using instruction pipelining. What is different?
|
Given an undirected graph $G(V, E)$, how hard is it to decide whether it has an induced tree consisting of $k$ vertices, where $k$ is also given in the input?
|
algorithm:
a=[1,2,3.....n]
for i in (1,n+1):
j=rand(1,n+1):
swap(a[i],a[j])
let us say that n=3:
132
213
231
these 3 are 5 times possible
and
123
312
321
are 4 times possible....
similarly
for n=4
2143 occurs maximum number of times = 15 times
and 4231 and 4123 occurs min times i.e 8 times only....
i figured ... |
I have to tackle this problem:
I have some strings that are my training set. These strings belong to a regular language corresponding to a deterministic finite automata (hidden namely I don't now it, neither the language nor the automata). A string is labeled like positive if belong to hidden language and negative othe... |
When can it be applied? When can it not be used? I get the general idea but not what it takes to make it work.
|
I was reading about data compression algorithms and the theoretical limit for data compression. Recently I encountered a compression method called "Combinatorial Entropy Encoding", the main idea of this method is to encode the file as the characters presented in the file, their frequencies and the index of these charac... |
So I have been battling this rather peculiar problem:
given the following input (on an euclidean plane):
point p
polyline l
integer n
p is not inside of the convex hull of l
find a new polyline l', such that:
it has n vertices
it "covers" l with respect to p, i.e., a line section connecting any point on l with p wil... |
I have this multiple choice question from a computer architecture class, a mips processor executes a program at 10 sec, without pipelining and clock rate
100 MHz. When running the program on a processor with 500 MHz clock rate and 5 stages of pipelining which of the following execution times isn't possible.
a:2,5 sec,... |
As an example of the type of problem, consider Stewart Coffin's Cruiser puzzle:
Let R be a 48 × 31 rectangle. Let T be a 30°-60°-90° triangle with
hypotenuse 34.565 (so legs are 17.2825 and 29.934). Let P be a right
trapezoid with base 20.0982 and altitudes 27.1178 and 15.514. Show how
to place two copies of T a... |
I have been puzzling over an algorithm that decides whether a sorted array of numbers contains two numbers that differ by k. I do not intuitively understand why this algorithm works, or what thought process might have led me to think of this algorithm on my own, although I believe that I can prove it's correctness.
CON... |
Let $G$ be a bipartite graph with sides $L$ and $R.$ Let $w_{lr}$ be the edge weight of an edge from $l \in L$ to $r \in R.$ Let $x_r$ be the node weight of the node $r \in R.$ Let $E$ denote the set of all edges in $G.$ Let $2^E$ denote the set of all subsets of edges. The optimization problem is the following $$\max_... |
UPDATE: In 2 days, if no more convincing answer is posted, then bounty of 50 rep. will go to xskxzr. Due to lack of connectedness and a clean & clear cut, the bounty is still open for 2 days. (UTC is now 17 Sep 01:57)
This is yet another follow-up question in the series:
Karp hardness of searching for a matching cut
Ka... |
We are planning to design a system where following operations are supported.
Increment("foo"): Increase the count of key 'foo'
Decrement("bar"): Decrease the count of key 'bar'
getMin(): Return the key which has minimum count
getMax(): Return the key which has maximum count
The catch is all operations should be ... |
(a) We have alphabet $\Sigma=\lbrace 1 \rbrace$, $\Sigma=\lbrace a,b \rbrace$ and (b) also an alphabet with size $k$ and words with length $n$.
For the first two alphabets in (a), we know that there are countably infinite words:
$$|\Sigma| = |\mathbb{N}|$$
For the alphabet in (b) we know we have $k^n$ number of words.... |
I'm having trouble understanding the rules for W-types in type theory as defined here: https://ncatlab.org/nlab/show/W-type#wtypes_in_type_theory
Can someone give an example of how these rules could be used to define a simple W-type such as the natural numbers? What would $A$ and $B$ be in the formation rule for instan... |
Let's start with the question. Say I have a C language statements follows
it 458cat 2.01 = 96.87abc a.2 ;
-my question is how many tokens are there in the above statements. Secondly does white space like tabs, newline, makes a token or not?
If you are interested in my solution then proceed on your own risk. Firstly... |
Given an array we need to find maximum equal sum $K$ subsequences, i.e. we want the sum to be maximized such that there are exactly $K$ non-overlapping subsequences each having the same sum.
Example:
A = [1, 2, 3, 4, 6] & K = 2
Maximum Sum Subsequence = 8 = [2, 6] & [1, 3, 4]
If, K = 3 and A = [1, 2, 3, 4, 6, 8, 9]
M... |
Is it good to define a language $\mathcal{L}$ in NP as a language for which, given an element $x$, it is possible in polynomial-time to check whether $x \in \mathcal{L}$ or not?
Because I need to have an informal definition of that, in order to give just an idea of it, without using formalism.
Otherwise how could I def... |
So here's the question: "There are two types of professional wrestlers: "babyfaces"("good guys") and "heels"("bad guys"). Between any pair of professional wrestlers, there may or may not be a rivalry. Suppose we have n professional wrestlers and we have a list of r pairs of wrestlers for which there are rivalries. Give... |
I have two binaries, $\alpha_{ts,it}$ and $\alpha_{ts,gshp} \in \{0,1\} $, and two reals $T_{it}$ and $T_{ts}$ which have upper and lower bounds. How can I model $\alpha_{ts,it}=1$ if the following constraints are met:
$T_{ts}\geqslant-7$
$T_{it}\leqslant14$
$T_{ts}-T_{it}\geqslant5$
$\alpha_{ts,gshp}=0$
Regards
SR89... |
I have been researching threading and come across several websites which all say contradicting statements about which and how many thread models exist. Some websites say there are only three: 1:1, M:1 and M:M, while others say the three are 1:1, M:1 and hybrid (M:N). Still others say there are four types, including 2-l... |
I have a little doubt about Chan's algorithm.
From Wikipedia's description we see that the second phase of an algorithm works with $K = \mathrm{ceil}(\frac{n}{m})$ subsets $Q_i$. The goal of the second phase is to compute $m$ points $\{p_1 ... p_K\}$. On $i$-th iteration the candidate $p_i$ is chosen among $\{q_1 ... ... |
I have a variant of Insertion sort (recursive version) that we call split insertion sort because there are two kinds of input. The input array has both numbers and alphabets, hence we have to sort them as two different arrays one for numbers and other one for alphabets. What would be the recurrence equatiuon for this v... |
I'd like to measure how different two HTML files are from each other.
I refer to the following scenario:
User A visits a website, let's call the website example.com
User A shares the website with User B
User B visits the shared website
User A and User B have installed an add-on that each sends the visited web pages as... |
I read k-Sum $k \geq 3$ can be solved in $\approx O(n^{k/2})$
If this is right, why do not have a subset sum solver with a time complexity $O(2^{n/4})$ or better?
That is, enumerating all the subsets from 4 splits, then apply 4-sum to find if some of the four partial lists add up to the target value?
|
I have the language $$L = \{a^mb^nc^o| \, m + n + o > 5\}$$
where $m,n,o$ are non-negative integers.
I have to find whether the language is regular or not.
My attempt:
I feel it should be non regular. For it to be regular, we'd have to keep track of how many $a's$, $b's$ and $c's$ we have seen. But the problem is that ... |
I know the answer that it will be 1024(2^10). But iam not able to understand why, I have looked the answer but still don't find it compelling
My reason, it says ten if are there in the language and since it follows the given grammar then the program having 10 'if' should be generated by it, which can be but in my o... |
I'm working with Turing's paradigm to prove termination of programs by annotating functions with ranking functions and I encounter the following example:
def zeros: Stream[Int] = 0 #:: zeros
This is Scala syntax for contructing a stream made of an infinite number of zeros. In this case, the evaluation terminates but t... |
Why is this sort algorithm correct? Many thanks!
Task:
Suppose all elements in an array with length $n = 2^m$ are in descending order: $a_1 > a_2 > ... > a_n$, we need to turn them into ascending order.
Algorithm:
For each step from $1$ to $m$:
Swap each adjacent (odd index, even index) pair into ascending order, so ... |
In computational machine learning, the notion of Probably Approximately Correct means that (generally speaking) we can find (or "learn") with a high probability a function which has "low error".
Is there a way to generalize this idea for approximation algorithms? What I thought of:
Given a language $L \subseteq \{0,1\}... |
Background
I have a list of 50 million $A-A_i$ pairs, where $i>1$, and $A$ and $A_i$ are some text. I need to extract the $A$ values from the list, so I get a new list of unique $A$ values.:
$$
\text{New List}= \{A, B, C, ...\}
$$
Here is a generic illustration of what the list of pairs looks like:
list of pairs = [['A... |
Let's say I have a simple graph G with an edge set E, vertex set V, and at least 1 cycle.
We can determine the number of spanning trees in this graph by finding its graph Laplacian matrix, striking out one row and column, and then taking the determinant of that sub-matrix.
Let's call that determinant t (i.e. there are ... |
From the problem, count the number of ways to fill a binary string of length $N$ with at least one $1$'s consecutive sequence of length $K$ and other $1$'s consecutive sequences have length no more than $K$.
For $N \le 2\times 10^6$, my approach is to using DP. dp[N][K][2] is the number of ways to fill string of length... |
I am interested to know whether the time complexity of following algorithm is $O(n^2)$ or $O(n\log n)$.
Here is the implementation:
public class HelloWorld
{
public static void main(String[] args)
{
Hello hw = new Hello();
int[] n = {2,3,4,52,5,63,0,664,2,2,56,68,8};
hw.sortUsingDLLWODup(n);
}
}
publ... |
Has anyone ever come up with a grammar that only induces invertible functions, and does so in a way where it is possible to algorithmically construct the inverse function? It could be useful for automatically creating the deserialization of a bitstring after the serialization has been defined, or other things like tha... |
Given $L_1, L_2 \in \mathsf{NP}$, $L_1 \cup L_2 \in \mathsf{P}$ and $L_1 \cap L_2 \in \mathsf{P}$,
Prove: $\ L_1, L_2 \in \mathsf{coNP}$
What I've done so far is:
$$ L_1 \cup L_2 \in \mathsf{P} \Rightarrow (L_1 \cup L_2) ^\complement \in \mathsf{P}
\Rightarrow L_1^\complement \cap L_2^\complement \in \mathsf{P} $$
... |
It seems that the standard reduction method you see online from 3SAT to 4SAT is that we let $\phi = (a \lor b \lor c)$ be a 3SAT clause, and so there is an assignment that satisfies $\phi$ iff $\phi' = (a \lor b \lor c \lor z) \land (a \lor b \lor c \lor \neg z)$ is also satisfiable.
Is it just as valid to say that $(a... |
Here is the excerpt from the linear probing page at Wikipedia.
To search for a given key x, the cells of T are examined, beginning with the cell at index h(x) (where h is the hash function) and continuing to the adjacent cells h(x) + 1, h(x) + 2, ..., until finding either an empty cell or a cell whose stored key is x.... |
Suppose a processor does not have any stack pointer registers, which of the following statements is true?
It cannot have subroutine call instruction
It cannot have nested subroutines call
Interrupts are not possible
All subroutine calls and interrupts are possible
===============================================... |
consider this question of finding words with no self embedded nonterminal in their derivation.
The author(cohen) says that If CFG is in CNF then all the words with length greater than 2^p are guaranteed to have self embedded nonterminal. So, all i need to do to solve these questions is to consider words that have leng... |
I am aware that multiprocessor systems often implement simultaneous multithreading in order to allow multiple threads to run on different CPUs. I am also aware that uni-core systems often implement temporal multithreading (fine-grained/preemptive or coarse-grained/cooperative) to allow for a more efficient use of the C... |
this is related to the following question:
Generalised 3SUM (k-SUM) problem?
Without loss of generality, let's only consider even $k$, or just $k=4$.
My question is, after summing all pairs of numbers, is it necessary to sort the list of sums? I understand we could use two pointers from left and right to sandwich the t... |
I want to find the most optimal algorithm for finding closest ordered pairs and link them.
For example:
Go thru the vector, one by one
For each one set the next according to a set of various conditions
For example, something like:
A B X C Y Z D
First we will link A to B
Then when we have a look at B,
we will link B to ... |
I encountered this result when working with $\lambda$-calculus (so every element I mention here was a $\lambda$-expression there [1]), but I will express everything with, more understandable to broader audience, notions of functions.
Intro
Definition 1
A numeral system is a sequence $d = d_0,d_1,\ldots$ such that there... |
I wanted to know is there any algorithm / function / process through which I can calculate square root of a very large integer number. I wants to know current state of the research in this field.
No approximate methods please.
|
I am interested in a simple variant of the quadratic knapsack problem.
Let $\{w_1, \ldots, w_n\} \in \{0,1\}$ be $n$ weights and $\{v_1, \ldots, v_n\} \in \mathbb{R}$ be $n$ values. Furthermore, assume $h$ is a fixed integer such that $n \geq h \geq \left \lfloor \frac{n+1}{2} \right \rfloor$ . Consider the following p... |
I have the two LTS (labeled transition system) as seen in the following picture:
And the book is telling me that between those two LTS, their $1$ and $1'$ are non-bisimilar.
So I tried to get a bisimilation starting from the pair $\{\{1,1'\}\}$ by continuously extending it whenever I found a conflict, ending up with:
... |
I'm trying to derive the optimization objective for an SVM (namely $1/\|w\|$), but I'm running into a little trouble. I've already read this question, which has certainly offered a lot of insight into the problem, but I would like to know why my own derivation doesn't quite work.
So essentially, let's say our support v... |
I came across the following question in a hackerrank competition, which is based on topological sorting of a DAG.
https://www.hackerrank.com/contests/hourrank-29/challenges/birthday-assignment/forum
Problem description:
Nikita has a family tree $T$ consisting of $N$ members number from $1$ to $N$. Each of the $N-1$ ed... |
This is a question about the semantics of the name, rather than about the principle itself. What is the Liskov Substitution Principle (LSP)?
LSP seems to have two meanings in the literature I've seen. One statement is the rule that determines whether one function type is a subtype of another? I.e, A->Y is a sub... |
A sequence is good if the bitwise AND of all its elements is a perfect square.
So counting number of "good" sequences, in a subarray .
For example : in [1, 2, 3]
There are 6 sub-sequences:
So there are 3 "good" sequences
Can you suggest an efficient approach to count them ?
|
I'm aware that typical techniques to store matrices in sparse form are compressed formats or maps where the key is the pair of indices and value the value of the entry in a matrix.
I was wondering if vEB trees could be used to such purpose as well. At the end of the day the dynamic set to be stored would be the pairs $... |
I ran into an interesting problem at work when trying to generate the inputs for an API given the expected output. I've tried to formalize and anonymize the problem below. I've been trying to design a fast algorithm that works here but I'm a little stuck. Thanks in advance for the help! I'm not an experienced question ... |
I'm having trouble understanding this statement: $DSPACE(s(n)) \subseteq DTIME(2^{O(s(n))})$.
The logic is that $2^{O(s(n))}$ is the total number of different configurations a Turing Machine M that runs in $s(n)$ space can have as a combination of the number of states, head positions, and contents of the tape, but I ... |
I'm having troubles understanding the following proof:
$$
\begin{align*}
&\text{Proof: } \forall \epsilon \in \mathbb{R}^+, \forall a \in \mathbb{Z}^+, n^\epsilon \gg \log_a(n) \\
&\Longrightarrow \ln(a(n)) = \log_2(e)\ln^2(n) \ll n^{0.01} = \ln(d(n)) \\
&\Longrightarrow a(n) \ll d(n)
\end{align*}
$$
The topic is Big O... |
I'm currently partitioning a big area $A$ into $n$ areas $B_i$ such that
$$\bigcup_{i=1}^n B_i = A$$
I have geo-coordinates which I know are in $A$ (also with the finite precision of floats).
Obviously, for every point $p$ in $A$ there has to be an area $B_i$ such that the point is in $B_i$. Formally:
$$p \in A \Ri... |
This question relates to liskov substitution principle seems to have two conventional meanings but is really a different question, so I'm posing it as a new question.
I'm doing a bit of research into an old language, Common Lisp, which defines function-type as follows:
An object f is of type (function (A) Y) if every ... |
For example, I have an NFA $A_n$ with alphabet $\Sigma = \{0, 1\}$.
The language recognized by this NFA is known to be $\{u1v\ |\ u, v \in \Sigma^*, |v| = n − 1\}$.
I was unable to get the answer on my own. What got me stuck was that there is a $1$ between $s$ and $q_1$, plus the $q_n$ toward $s$. I know without the... |
I came across the following statement:
"Since b is smaller than n, the complexity $O((n + mb)^3)$ is polynomial."
I suppose it has something to do with the notion of polynomiality in terms of the input. All three variables are given as input. I am still not sure why it wouldn't be polynomial if $b$ was as big as $n$.
W... |
N=64 hungry diners come to a buffet.
We sit them at 8 different (s=8 people at each table) tables so that they get to know each other while they eat.
After a while we distribute them over the tables so that no one will ever match another person with whom they have eaten before.
We keep on redistributing them with diffe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.