instruction stringlengths 35 11.4k |
|---|
I have a certain function that calculates numerically, for every $x \in [0,10]$, a value $y\geq 0$. I want to find an approximate minimum point of that function. A possible solution is to calculate $y$ for e.g. 10000 values of $x$ in the range $[0,3]$ and return the $x$ for which $y$ is smallest. I am looking for faste... |
I am self taught in CS and came across this while looking at binary search applied to multiplication. I don't understand this part:
OK, we have some x that has binary representation $10110010(1*2 + 1*2^4 + 1*2^5 + 1^7$) ...I understand this, but don't know what following means $x = 2^4(1011) + 0010$. What is name of se... |
I have array $t$ with size $n \leq 10^6$. It has only two kinds of elements inside: $1$ or $-1$.
I need to count how many contiguous subsequences have positive sum.
This pseudocode demonstrates exactly the behavior I want, but is too slow for large $n$:
c = 0
for i = 1 to n do
for i = j to n do
if sum(u[i:j]... |
The space hierarchy theorem shows that
$$\mathrm{\mathbf{L}}^{1} \subsetneq \mathrm{\mathbf{L}}^{2} \subsetneq \cdots \subsetneq \mathrm{\mathbf{L}}^{m} \subsetneq \cdots \subsetneq \mathrm{\mathbf{PSPACE}}$$
and
$$\mathrm{\mathbf{NL}}^{1} \subsetneq \mathrm{\mathbf{NL}}^{2} \subsetneq \cdots \subsetneq \mathrm{\mathb... |
Let's say we have given set of integers $A = \{x_1, x_2, x_3, x_4, \dots, x_n\}$, consisting of exactly $n$ values, all of them positive integers. Now the problem is to find the maximum value of bitwise or operation of all possible pairs $(x_i, x_j)$
We define bitwise or as bitwise operation that returns true if atleas... |
I have following problem to solve:
I have a group of people which I have to split up into smaller groups. Some of them have preferences who they want to be in a group with and who they don't want to be in a group with. I have to determine wether it is possible to group them respecting their preferences and if so, I wa... |
Could the execution of a Haskell program be considered as a proof in equational reasoning. This follows on from my earlier question on Haskell and inductive proof. Currently I am stuck between morally yes, but technically perhaps no. Below are two Haskell programs together with what I consider to be paper based equatio... |
We have 3 jugs with capacities A, B and C. How can we create an algorithm that will find out how to measure D liters?
This is my task for one online course I'm taking. I have no idea where to start. I don't even understand how are these four related to each other. I will be thankful for any help or clarification of t... |
I am getting the pattern shown in the picture from an experiment. To my human brain it is evident that it consists of some 20 straight lines. I need to find position and slope of all these lines (perform a regression). But I need to do it completely automatically. If this were a a single sequence I would have used RLS... |
I want to prove that
for every language $L\subseteq \{a\}^*$, the laguage $L^*$ is regular.
every element of $\{a\}^*$ is equivalent to a natural number based on its length, and also every language $L$ is equivalent to a subset of natural number. after that base on lemma that says
Let $S$ be an infinite subset of ... |
Ryan Williams and Cody Murray in 2015 proved that MCSP (Minimum Circuit Size Problem) is provably not NP-hard under local reductions. (Local reductions are the ones in which you are allowed time $O(n^{1/2} - \epsilon))$. He has done it by showing even stronger statement that: Even Parity can't reduced to MCSP using loc... |
I have been thinking about Non-determinism in any kind of state machine. Since I work on machine learning, I tend to think that probability is a means of handling non-determinism. Instead of exhaustively taking every possible transition to arrive at a solution we prioritize the alternatives.
I just wonder if there ar... |
Deterministic Context free languages are always unambiguous. Now DCFL are a subset of linear languages. Are there any linear languages which are inherently ambiguous?
|
Assume $A$ is an array that contains sorted integers , ie $\forall\ i,j$ where $1 \le i \le j \le |A|$, $A_i \le A_j$. The numbers do not have to be unique, and the task is to check if there is at least one pair of indices $i$ and $j$ where $A_i + A_j = n$. Simple enough, here's an algorithm that does it:
CheckForPair(... |
Suppose the language L = {w | w is an integer whose sum of digits is a multiple of 2}. I strongly feel like this is non-regular language, but how should I choose a string to apply the pumping lemma?
|
In the process of trying to find a solution to the rat and poison puzzle with two rats, I've found myself needing the solve the following problem, in polynomial time:
Given any $k_0, k_1, k_2,..., k_{n-1} \in [2,\infty)$, we want to produce a simple graph $G = (V, E)$ and some $c_0, c_1, c_2,..., c_{n-1} \subseteq V$ s... |
I have been wrestling with this for quite a long time but couldn't convince myself that the following is true:
What I do understand: $\theta_a$ denotes the set of points that are within the ellipsoid. Also, $A_{t, a}$ is a matrix that "describes" the shape of the ellipsoid. $\hat{\theta}_{t,a}$ is the red point that is... |
It is not possible to losslessly compress all files of size $n$ using a single algorithm, as there are more files of size $n (2^n)$ than of size $p, p: p < n ( 2^n-1)$. Via the pigeon hole principle, if we only tried to compress files of size $n$ with a single algorithm, there would be at least one file it was impossib... |
This question has already been asked before in this site, but the details of none of them is my question and none of them answer my question.
The following is an example recurrence given in introduction to algorithms book by CLRS .
$$T(n) = 2T(\sqrt n) + \log n$$
It is solved by changing the variables. It renames the ... |
Suppose you have a directed graph. Vertices a and b are part of the graph. There is an arrow pointing from a to b and an arrow pointing from b to a. Does this make the directed graph cyclic?
|
I am studying Matching Theory on Graphs and I am wondering if I understand the characterization of the problems right.
Definition:
Let $G = (V, E)$ a graph. A set $M \subseteq E$ is called a matching in $G$ if and only if each vertex $v$ in $V$ is incident to at most one edge in $M$, that is, $\forall v \in V ( \foral... |
Professor said that modern processor needs runtime stack.
But he didn't explain the reason.
Why is the runtime stack required in the modern processors?
|
I want to merge $2$ binary heaps. Which is the fastest algorithm to do so. Also would like to know its time complexity.
I know how to do it linear time $O(n)$, I want to know if there is something faster (probably there is).
|
I have the decision problem $\operatorname{VALID}$ which is the set of all valid propositional formulas (tautologies), I know that $$\overline{\operatorname{SAT}}\equiv_m^p \operatorname{VALID}.$$
This can easily be seen by changing instances of each problem into their logical negation, then a formula is a tautology i... |
I am looking at the following pseudocode from the Kleinberg-Tardos text "Algorithm Design".
Max-Flow
Initially f(e)=0 for all e in G
While there is an s-t path in the residual graph G_f
Let P be a simple s-t path in G_f
f' = augment(f,P)
Update f to f'
Update the residual graph G_f to be G_f'
Endwhile
R... |
$L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)=\emptyset\}$ prove to be undecidable.
My approach:
We will prove this by reduction $L_{\emptyset} \leq_T L_c$ We begin by assuming that $L_c$ is decidable and that we have access to a black box $Q$ which decides it. We want to construct another Turing... |
So I am currently going though the HoTT book with some people. I made the claim that most inductive types we will see can be reduced to types containing only dependent function types and universes by taking the type of the recuror as inspiration for the equivalent type. I started to sketch how I thought this would work... |
Why do floating point values have infinity instead of just a higher exponent?
|
I have chosen an example task to see if I understood DFA and NFA correctly.
So let's say we have that task:
Given alphabet $\Sigma = \{0,1\}$ and the language $L = \{w \mid w \text{ includes two consecutive zeroes}\}$. Create a DFA and a NFA for the language with as
less as possible states.
The following descriptio... |
unsigned int input = 0xC116D9B5709FED85 unsigned int output = 0
while (input > 0 )
{
if (( input mod 2) == 1)
{
output += 1
}
input = floor(input / 2)
}
return output
I understand how the algorithm is working and using mod to break the input and then counting the number of times input is modded by 2 where it ... |
how do i prove that no DFA with two states can accept the language
$$ L = \{0^i : i \ge 0\} \cup \{ 1^i : i \ge 0\}. $$
I had a lot of troubles coming up with anything that made sense.
|
i had troubles proving this is not regular using the pumping lemma {$a^ib^jc^k : j = i \lor j = k$}. Not sure how to approach this anymore, and help would be appreciated
|
I try to solve the following exercise:
We know that K (x), the complexity of Kolmogorov, is incomputable. Show how
calculate it, if we have an oracle for the membership problem (or for the HALT problem, if it accommodates more).
I have solved it in the following way:
Let (w) be the string to which I compute K (w).
(1).... |
I was working on a Leetcode problem, 3Sum Closest. I came up with a solution but struck it down because I didn't think it could be correct. But, turns out it was. I want to know why.
Here's the problem, transcribed:
Given an array S of n integers, find three integers in S such that the sum is closest to a given number... |
I have been trying to understand Pumping lemmas for a while now, I am doing this exercise and I think that the pin has finally dropped. However, I am unsure if I am doing it even remotely correctly. I will briefly explain my attempt and thus my solution. Thereafter I would discuss a few points that are not as clear to ... |
L = { w : w ∈ {a, b}* ∧ (u, v, z ∈ {a, b}*) (|u| = 2 ∧ |z| = 2 ∧ w =
uvz ∧ u ≠ z)}
Can someone explain me this language? What is w = uvz supposed to mean?
I thought I understood correctly, so the words from this language could be for example: ε, aaab, aaba, bbaa, bbba...
|
I Want to Create Regular Expression from string of {a,b} that it contains neither the substring ab NOR ba?How I can do it?
|
Let $P,Q$ two integral polynomials of height bounded by let say $H>0$ --- that is every coefficient of $p$ or $Q$ is bounded in absolute value by $H$ --- and degree at most $d$.
Let $A$ a set of $d$ reals.
I want to evaluate the sum:
$$
S = \sum_{\alpha \in A} P(\alpha)Q(\alpha),
$$
and more precisely I want to get t... |
Let's say we have given 2 strings $A, B$, and let's suppose that the size of $A$ is pretty small (100 characters) and the size of $B$ is pretty big (1 million).
We define prefix of string $S$ as string $Y$ that contains the first $x$ letters (size of prefix always is less than or equal to size of whole string).
And the... |
Given that $x^2+x+1 (mod 2) = 1$ and $x^2+x (mod 2) = 0$ for ${|x\rangle}_{x=0,1} \xrightarrow{F} \frac{1}{\sqrt{2}}[(-1)^{x}|x \rangle + |1-x \rangle]$ (Fourier transform). So, the 1-1 correspondence $x^2+x+1 = NOT(x^2+x)$ holds over $F_{2^3}$, where the input is the zero polynomial $x^2+x$ and the output is the posit... |
I am somewhat stuck in converting an expression with negative numbers from infix to postfix.
Suppose we have a expression like
a = -b - (-c - d) .
At some places I read that you can parathesize the negative numbers to solve the problem. But if I parathesize them as
a = (-b) - ((-c) - d), then at the beginning of the ... |
The system clock is needed to synchronize all components on the motherboard, which means they all do their work only if the clock is high; never when it's low. And because the clock speed is set above the longest time any signal needs to propagate through any circuit on the board, this system is preventing signals from... |
I read that deterministic grammar helps in preventing backtracking.
Consider a grammar
$$A \rightarrow ab \mid ac \mid ad$$.
Here if input is "ad" then the compiler needs to check each of ab, ac .. and backtrack until it gets to last production.
To eliminate non determinism we modify the grammar as
$$A \rightarrow aB$... |
I have the following problem:
Consider a balanced infinite search tree with branching number $κ$. Consider a
search problem with solutions which may be located at any node of the tree.
The search will not be terminated once a solution is found. The only information about solutions is that if you check a node at le... |
I need to prove that L = {$a^{100}yy^r : \forall y \in$ {a,b}*} is not regular. i have tried using pumping lemma but couldn't get far with it. Any help in where i should go with it?
|
I know that merging two sorted arrays takes worst case n comparisons. However, there will often be cases where one array is depleted before the other, letting us just append the remainder of one array to the combined sorted array. I've also read that merging takes the same amount of comparisons (wrt to n) to any input ... |
My understanding is that, in very rough terms, the Tomasi-Kanade algorithm published in 1992 describes a way to reconstruct the 3D structure of an object from multiple images of that object, given that you have a reliable method of identifying important structural features from the 2D images.
A lack of general informat... |
Somewhere in the forum (a question about p vs np) I read that no exhaustive search algorithm exists for np-complete problems with better time complexity than $2^N$, however the subset sum problem has an algorithm with worst case complexity $O(2^{N/2}$), this looks much better than $2^N$, what is wrong with this?
|
a 2 sat instance which is unsatisfiable and an integer k are given, decision problem is that: is it possible to delete k variables, also remove clauses contain them, in order to satisfy the 2-sat instance?? and optimization problem is that: find the minimum number of variables to remove to make the 2 sat instance sat... |
I am reading http://www.yisongyue.com/courses/cs159/lectures/LinUCB.pdf and come across this slide
What has been confusing me boils down to showing that multivariate Gaussian is conjugate to itself given a Gaussian likelihood. I did quite a bit of searching on both this site and on Google and found the Kevin Murphy's ... |
Will the below statement cause any lexical error ?
int a123c ;
According to me, int would be tokenized as a keyword and there would be a lexical error when "a123c" would be encountered as it doesn't fall into any token category.
I read this question https://stackoverflow.com/questions/31369524/clarification-regarding-... |
Why don't we consider conflicts caused due to augmented production?
This picture shows the states of a LR(0) parser.
In the above picture, why we don't consider shift reduce conflict at state I2 ? Shift on '+' and reduce on E'->E. (Augmented production).
Also what is the need of augmented production at the beginning ?... |
It is possible (using formal semantics) to translate natural language sentences into lambda expressions. So, is it possible to translate those lambda expressions into some logic, e.g. into first-order logic or into modal logic?
I am aware of the Curry-Howard correspondence, but I have not found actual translation, it i... |
While reading Code Complete second edition, I came across this line:
You can do anything with stacks and iteration that you can do with
recursion.
Is this true? or there are functions, that must be implemented recursively, and can't be done otherwise ?
|
If M is a Turing Machine, consider the subset of $\mathbb{N}$ defined as:
$$ \mathrm{ZTM} = \{ x \mid M_x(0)\downarrow \} $$
i.e. the set of 'indexes' of machines that halt on zero. It is possible to use Rice's theorem to prove that this set is r.e. but not recursive.
But I'd like to have a direct proof, using directl... |
We have the following recursive function for the dynamic programming problem for a knapsack problem:
\begin{align}
V(i,w)=&max[ V(i-1,w), v_i +V(i-1,w-w_i)], \quad 1\leq i \leq n, 0\leq w \leq W \\
\end{align}
and $V(0,w)=0$.
But is it possible to add a constraint on the items to this function? If we for instance only... |
Suppose I have $P$, which is the base-$p$ representation of an integer $n$ and I want to calculate it base-$q$ representation $Q$. The obvious algorithm is: interpret $P$ to obtain $n$, then calculate $Q$ from $n$. This is easy.
But if $n$ is very large this could require a lot of memory, and it could require a large... |
New to computer science and am attempting to verify if there are any non-quadratic approaches (i.e. better performance than Big-O of n^2) for finding a potential specific difference between either adjacent or nonadjacent elements in a sorted array of integers?
For example, if you have an array that's already been sorte... |
I read that recursively enumerable languages are closed under intersection but not under set difference.
We know that, $A \cap B = A - ( A - B)$.
Now for LHS (left-hand side) to be closed under intersection, RHS(right-hand side) should be closed under set difference .
But we know that RHS is not closed under set diffe... |
If the false positive error rate is greater than 0.5 then a Bloom filter is no different from coin flip, right?
Still, if one does implement this data structure with, say, P=0.55 then it would still work.
Should the constructor method of a Bloom filter implementation forbid values of P greater than 0.5?
|
Regarding the median of medians solution to the $k$th smallest element in an array, why does the algorithm split the array into subarrays of length $n/5$, where $n$ is the length of the initial array? Why not $n/7$ or $n/3$? Why 5??
|
I'm having trouble being 100% sure about this answer. I feel like it's false but I'm having trouble coming up with a complete answer. Can someone explain this step by step?
Thanks.
|
Lets construct a DFA over{a,b} That accepts only the string "aabb" in it.
My problem with this video is that the tutor has
moved arrow from state D to B why didn't he set a self loop on D .Im really helpless .
Move forward to minute 11
|
How would you go about showing that the language $L = \{\langle M, w \rangle\ |\ M$ moves left at least three times while computing $w \}$ is decidable or undecidable?
Intuitively my thoughts are that you might be able to show that $\bar{L} = \{\langle M, w \rangle\ |\ M$ moves left at most twice while computing $w \}... |
I'll use scala notation but hopefully things will make sense in general (I'm trying to prove that you can define a monad using either [flatMap (aka bind) and unit] or [compose and unit])
The book Functional Programming in Scala (github at https://github.com/fpinscala/fpinscala) makes the claim that if we have a type co... |
I read that we can find complement of DPDA by just complementing(toggling) the states of DPDA.
Why can't we do the same with NPDA ?
Also is DCFL closed under complement just because we can toggle the states of DPDA ?
|
Assume we have a sequence of $0$s and $1$s: $n_1, n_2, ..., n_N$, in which $0$ stands for a leaf node, and $1$ stands for an uncertain node that may or may not be a leaf node. How can we check if this sequence is a valid result of a binary-tree preorder traversal?
Ex. $1, 1, 0, 1, 1, 0, 0, 1$ is a valid sequence.
... |
Given a set $\{x_1,x_2,\dots, x_n\}$ and sets $\mathcal(F)=\{f_1,f_2,\dots, f_m\}$.
Is there any hardness result or approximation algorithm to find a set cover with this extra condition.
For every vertex $x_i$ appears in the intersection of at most k sets.
|
I saw this post and wondered why the approach described in the accepted answer works. The same problem and solution is described a bit nicer here.
So let's say we receive a stream of $n-2$ pairwise different numbers $a_1 + a_2 + \cdots + a_{n-2}$, from the set $\left\{1,\dots,n\right\}$. What I learned from the above p... |
Can we develop a turing machine which on given a language L as input gives as output whether this language is regular or not?
|
I have an exam coming up in three days, and there's a thing that I really need to be able to completely understand - that is, of-course, pumping lemmas for CFL. I know how to do prove that a regular language is not regular using PL, but for CFL it's a bit more variables, and I am not entirely sure how to split a string... |
Let say the following:
Given Ax and Bx two literals which represent POSIX regular expressions.
Let def A as the set of literals that match Ax. The same def for B.
Using relative complement operation, is there always regular expression for $A/B$ set, for every pair of Ax,Bx?
I attach an example:
Ax := a.*
Bx := a.*b$
/... |
$S \rightarrow AB$
$A \rightarrow aA \mid bA \mid \epsilon$
$B \rightarrow aBb \mid \epsilon$
Does this grammar generate regular language?
According to me this grammar generates language of the form
$$
L = \{ (a+b)^* a^nb^n \mid n\ge 1\}
$$
I think it's a DCFL. If the condition would have been $n\ge0$ then it's regula... |
Automatic parallelization isn't a new thing by any means, and lots of questions have been asked about whether Java or C or C++ or a host of other languages or specific compilers (gcc 5 v 6, clang, Hotspot, etc.) support automatic parallelization. In many cases, the problem seems to be that compilers sometimes try to au... |
There are n hotels given at a0, a1, ..., an such that 0 < a0 < a1 < ... < an. The only places you are allowed to stop are at these hotels, but you can choose which of the hotels you stop at. You must stop at the final hotel (at distance an), which is your destination. Moreover, you are required to complete your journey... |
Let us assume there's a folder structure as shown below: The letters a-d represent folders and the number 1-5 represent video files where for the file n, size(n)=n. So, 1 = 1MB, file 2 = 2MB, etc.
a
├── 1
├── b
│ ├── 2
│ └── 3
└── c
├── 4
└── d
└── 5
3 directories, 5 files
I want to write a script... |
An oracle Turing machine (OTM) $\bar{M}$ can be denoted $M^{O}$ if it is a Turing machine (TM) $M$ with an oracle $O$. Given the oracle $O$, there exists a relation $R$ between OTMs and TMs such that
$$\left( \bar{M}, M \right) \in R \Leftrightarrow \bar{M} = M^O$$
Given an OTM $\bar{M}$, how to find the TM $M$ such th... |
When one wants to know that whether a partial function $f \colon \Sigma^{*} \supsetneq \mathrm{dom}(f) \rightarrow \Sigma^{*}$ is Turing-computable, there are two methods that I think they are both useful.
We can define a total function $\bar{f}$ such that
$$ \bar{f}(x) = \left\{
\begin{aligned}
&f(x),&x \in \mathrm{... |
$S -> AB$
$A -> aA / epsilon$
$B ->aBb / epsilon$
What is the class of language generated by the above grammar ?
I think that it generates $a^* a^n b^n | n>=0$ so it should be regular as regular is concatenated with DCFL which is able generate epsilon. But the answer is CFL .
I think that answer would be CFL if n woul... |
The problem is defined as follows:
Instance: A finite set $A$ of "possible diagnoses," a collection $C$ of subsets of $A$, representing binary "tests," and a positive integer $J≤|C|$.
Question: Is there a subcollection $C′⊆ C$ with $|C′|≤ J$ such that, for every pair $a_{i},a_{j}$ of possible diagnoses from $A$, there ... |
About dynamic array, doubling it's size with every element that is beying its limit:
From what I understand, the number of operations between the $n$th element and the $n+1$th depending on if $n+1$ is $2^k + 1$ (for some $k \in \mathbb{N}$).
If so, we need to allocate a new array and copy the last n elements + the new... |
I was asked in an interview to create a knapsack of only even items in n*C time, c being the capacity, n being the number of items to choose from. I tried approaching it with a third dimension, where it would be of height n and signify at each ij whether the knapsack with these maxes contains even numbers or not, but I... |
It is common in data science to receive two equal length vectors (array of dimension 1), say Categories and Weights.
We aim to find all unique values of Categories and sum up the corresponding Weights. E.g.
Categories = ["abc", "def", "a", "a", "def"]
Weights = [ 1 , 2 , 1 , 10 , 1000]
Let's call our algorit... |
To give background, there's two ways to multiply two complex numbers:
Method A: requires 3 multiplications and 5 additions
Method B: requires 4 multiplications and 2 additions
And it's given that multiplying two $m$ bit numbers is $O(m^2)$ and that adding two $m$ bit numbers is $O(m)$.
Now given a list of complex nu... |
I came up with a problem, and I'm having trouble finding existing work on it. I'm not sure if there is a polynomial-time solution for it. Is this a well-known problem (or equivalent to one)?
We define a function limited_sort(input, n) -> output that takes an array of comparable elements input and an integer n and retur... |
When we say a class of languages is decidable we mean that the membership problem can be solved. However even though the membership problem is solvable for the class, there may exists some problems for the same class which are undecidable. For example Context free languages are decidable yet the problem of determining ... |
I have an exam tomorrow and the professor said that from the following two facts we should be able to show that the union of 2 regular languages is regular:
Given 2 regular languages, their intersection is regular
A compliment of a regular language is regular
I'm pretty confused on how I would get started with showin... |
Is next time complexity sub-exponential?
$O(2^{N^{LOG2(1.5)}}/8)$
unformatted: O((2^N)^LOG2(1.5))/8) just in case I didn't format it properly.
|
How logic programming (https://en.wikipedia.org/wiki/Logic_programming, especially answer set programming) is related to the reasoning in the (first-order) logic? Maybe logic programming can be expressed using lambda calculus and then this connection between logic programming and logic and be exspressed as type of Curr... |
I am programmer with a grip on automata, but not on logic.
I read in papers that the two are very tightly related.
Deterministic Finite Automata (DFA), Tree Automata and Visibly Pushdown Automata are all related to Monadic Second Order Logic (MSO).
Although, I understand the automata and people (in papers) have tried t... |
I was asked to describe how I would build a Fibonacci heap that consists of 1 tree with 7 vertices, 2 of them are leaves, and 2 of them are fathers that have a leaf as their son.
From what I see, this is a heap with 1 tree from degree 2 ($F2$), that has 2 sub-trees from degree 1 ($2 * F1$) and 2 sub-trees from degree 0... |
I want to prove (or disprove) that
$$\sum_{i=1}^n\log_2 i = \Theta(n\log_2 n)\,,$$
but I totally get stuck with this example. May someone help me with that.
|
The domino tiles can be listed in an orderly way as shown in the figure :
figure link
Write a function such that given two variables ("minor" and "major") where "minor" is the lowest value and "major" the highest value of a domino tile, calculate its order number associated with the previous figure.
Example : given a... |
when discussing average time complexity as in this table.
O (log n)
I'm assuming it is 2 but wanted to verify. Also is it always 2 for these data structures?
I'm in the opinion that the base of the log is not considered a constant so it should be included in the Big O notation.
Whether or not is should be included. W... |
My question is not for a solution to the problem, though I do need to put thought into it but rather my question is if this conceptual problem has a name or has been addressed at already in computer science.
I want to create a list of numbered defines, each uniquely mapped, and divided into groups based on type. The go... |
Let $L$ an arbitrary regular language and
$\qquad L_2 = \{uav : uv \in L\}$.
Am I correct to say that this language is not regular by saying:
$L$ has an even number of $a$'s. So $u$ and $v$ have an even number of $a$'s. However, $uav$ will have an odd number of $a$'s so $L_2$ is not regular?
|
I am curious if there exists a method for specifying a permutation $F_k: X \to X$ with a small(ish) $k$.
Something that comes very close to my goal is a block cipher, say AES. But block ciphers have fixed block size (e.g. 64, 128 bits), and I want something with parameterizable (and smaller) "block size" $\log_2 |X|$. ... |
Problem 1: Let $A,B$ be languages over some alphabet $\Sigma$, if $A \equiv_m B$, then for every finite language $C$, $A \cup C \equiv_m B \cup C$.
Problem 2: Problem 1 but using polynomial time reductions.
Note: $A \equiv_m B$ means $A \leq_m B$ and $B \leq_m A$, same for $\equiv_p$. Every finite language can be decid... |
I remember reading a paper about finding k nearest neighbors for all N multi-dimensional objects in the set.
I've tries to find it again many times, but have failed so far.
The algorithm was as follows:
Each object is assigned a sorted queue of nears neighbors (maximum size is k). Let's assume that $k < log(N)$
Each t... |
So here is a HW problem I have been working. On I was wondering if anybody could give me a hint of what I am doing wrong. I don't want to be given the answer just hints and advice on how to solve it.
I am given this simple algorithm that finds the greatest value and the second greatest value in a array.
If A[1] < A[2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.