instruction stringlengths 35 29.1k |
|---|
Given $m$ matrices of size $n\times n$ each of which is promised to be a permutation is it in $\mathit{quasiAC}^0$ or $\mathit{AC}^0$ to multiply the permutations where
$m=\mathit{poly}(n)$
$m=\mathit{poly}(\log n)$ which means $m=O(\log^k n)$ where $k\in\mathbb N_{>1}$
$m=O(\log n)$?
Given $\mathit{poly}(n)$ input... |
Given n numbers that all are identical, then what would be the running time of heap sort?
Will it be in linear time $O(n)$ or, best case $\Theta(n\log n)$?
|
I need to test my understanding of the difference between the data model and database schema. According to my understanding, the data model is a description of how the data will be stored and the relationships between the data. While the schema is very similar to a database model and according to the book "Database Ma... |
so I know the name of the array is a pointer to the first element of the array. But I've noticed something weird Here's the code.
Here is the result:
How is it possible that the pointer is pointing to itself and when I dereference it, I get the first element of the array? Are arrays implemented using struct? What am... |
I am asked the following:
def myRemove( str, ch ):
# Return a new string with the first occurrence of ch removed. If there is none, return str.
Sample run
>>> myRemove( "abcdabcd", "a")
'bcdabcd'
>>> myRemove( "abcdabcd", "x")
'abcdabcd'
>>> myRemove( "abcdabcd", "d")
'abcabcd'
I have tried a few different methods ... |
I am reading Chapter 8 NP-complete problems in Algorithms by Dasgupta et al and looking at some questions at the end of the chapter.
My own questions are below (after the image with the textbook questions). Note that I am not asking what the solutions are (those may be for separate questions) but rather the approach t... |
I am considering this left recursive language grammar production rule:
Expr = Expr, "a" ;
As a production rule, I believe that this can be used to produce an infinite sequence of aaa by describing the rule like this:
Given a non-terminal Expr, expand it to Expr followed directly by the literal a.
Example: if Expr is ... |
I'm trying to solve this recurrence of a function of a binary tree with a recursive tree. But I can't find any pattern to solve it.
This function calculates both the height and if its a balanced tree.
template <typename T>
std::pair<bool, int> balanced_height(const BinTree<T> &tree) {
if (tree.empty()) {
return {... |
Let $\mathcal C$ be a circuit of $m=f(n)$ input wires
where every input is taken in the set $\{x_1,x_1',\dots,x_n,x_n'\}$ where $x_n\in\{0,1\}$ and $x_n+x_n'=1$ holds (not all $x_i,x_i'$ necessarily needs to be utilized if $f(n)=o(n)$)
where every layer of the circuit is all $AND$ or all $OR$ gates having fan-in $2$ ... |
It is well known that a recursive sequence or $1$-d sequence can be calculated in $O( \log n)$ time given that it has the form
$$a_n=\sum_{k=1}^{n} C_ka_{n-k},$$
where $C_k$ is a constant. Examples would include polynomials like $n^2$ or $n^3$, exponentials like $2^n$, and Fibonacci Numbers defined by $a_n=a_{n-1}+a_{n... |
I have just started studying about bipartite graphs and there is an example that bipartite graph can be use to solve the wolf, cabbage, and the sheep river crossing problem, as a kid i had fun solving this question, now I was wondering how can we describe the problem in bipartite graph, as to describe it we need to div... |
Suppose we have an instance of 3SAT that is NOT satisfiable and we say $S$.
If in $S$ there are the following $8$ clauses
$\left(a\vee b\vee c\right)\wedge\left(a\vee\bar{b}\vee c\right)\wedge\left(a\vee b\vee\bar{c}\right)\wedge\left(a\vee\bar{b}\vee\bar{c}\right)\wedge\left(\bar{a}\vee b\vee c\right)\wedge\left(\bar{... |
Let $A\subseteq\{0, 1\}^∗$, and let $A^c = \{0, 1\}^∗ \setminus A$ be the complement of $A$. Prove: If A is $\le_m$-complete for CE, then $A$ join $A^c$ is neither c.e. nor co-c.e.
c.e --> Computably enumerable
The join of two languages $A, B \subseteq \{0, 1\}^∗$ is defined by: $\{x0 \mid x\in A\} \cup \{y1 \mid y \in... |
Let $\{A_n : n \in \mathbb{N}\}$ be a collection of c.e. (computably enumerable) sets. Is $\bigcup_n A_n$ c.e.?
That is, is the union of c.e. sets c.e.? Otherwise, under what conditions will this be true?
|
I am trying to wrap my head around how dynamic programming helps avoid all possibilities that are exponential after reading Chapter 8 NP-complete problems of Algorithms by Dasgupta et al. where it says:
So far in this book we have seen the most brilliant successes of this quest, algorithmic techniques that defeat the ... |
I recently read in the New York Times that my old "Data Structures and Algorithms" class professor Dr. Ullman had received the Turing Award along with Dr. Aho. The article title was "Turing Award Goes to Creators of Computer Programming Building Blocks".
Now, I think of of "computer programming building blocks" as thin... |
I had an online round at a company where I was asked this question.
There are $N$ items, and you have to choose some items from them such that the total weight does not exceed $W$.
Each item has three properties, weight, profit and type. There are only two types of objects.
Type 0 item can be selected independently own... |
Consider the language $L= \{a^n \mid n\geq 0\} \cup \{a^nb^n\mid n\geq 0\}$ and the following statements.
$\quad\quad\text{I. }L$ is deterministic context-free.
$\quad\quad\text{II. }L$ is context-free but not deterministic context-free.
$\quad\quad\text{III. }L$ is not $LL(k)$ for any $k$.
Which of the above stateme... |
Quantum computers can solve certain problems faster than classical computers e.g factoring numbers.
and this is because quantum computers can do a fourier transform on $n$ qubits in $O(n^2)$ time as opposed to $O(n2^n)$ time.
We can usually reduce time complexities by pretending that we can do some thing faster - intro... |
Given a self-balancing binary search tree of size $n$, I want to perform the following operations:
InsertInOrderSequentialBatch an ordered sequence of $k$ values (specialized $k \in \{2, 3, 4\}$ or generalized $k \in N $) which are guaranteed to be sequential in an in-order tree traversal immediately after insertion.
... |
From what I have been taught, I cannot use left-recursive, nondeterministic, or ambiguous grammars in recursive descent parsers. So, here is the grammar:
\begin{align}
&E \to E+T \mid T \\
&T \to T\cdot F \mid F \\
&F \to F^* \mid a \mid b
\end{align}
I actually changed this to:
\begin{align}
&E \to TE' \\
&T \to +TE' ... |
I'm trying to implement SAT solver, based on backtracking algorithm and BCP. This SAT solver is trying to pick one literal from each clause, from 3-CNF SAT instances. I've implemented a neural network based heuristic to pick valid literal at first, and degree of how valid is given literal from clause is determined by n... |
I am trying to create a new form of a bubble loop and want to see if they would return the same truth values during runtime. Could I get a second pair of eyes to confirm if this is the case?
Note: prod is equal to a target product of a sequence.
Code #1
For c = 1 to x
For d = 1 to c - 1
If (a,c * a,d = prod) return Tru... |
Does this conversion look right? I am learning conversion from RE to CFG.
RE:
$$(a \cup b)^* \cup ab(a \cup b)^*$$
CFG:
Terminals:
$$ S_1 \to a \\ S_2 \to b $$
This is for the first $(a + b)^*$:
\begin{align}
&S_3 \to S_1 \mid S_2 && (a \cup b) \\
&S_4 \to S_3S_4 \mid \epsilon && (a \cup b)^*
\end{align}
This is for th... |
I have an array $A$ of length $n$, containing triplets (think of it as a $3\times n$ matrix). Can I re-order the array (without reordering a triplet's inner values) in time $O(n\log n)$ so that it is possible to answer the following query in $O(\log n)$? Given $i$, determine the number of $j$ such that $A_{2,j} \le A_{... |
What does it mean when in a machine learning paper there is
$(arg)^{T}$, what does the T does to an arg in this 3b1b video on neural networks he puts the: $(w^{l-1})^{T}$
|
I just want to know if Big O notation was used as a consequences of the Linear speed up theorem or not. For me I guess the answer is yes.
For example, if we didn't have a linear speed-up theorem, then does it mean that we would have a different measure of time/space complexity? i.e. multiplicative constants does makes ... |
The number of comparisons in the following algorithm is supposed to be $3n/2 - 3/2$ if $S$ is odd. I understand that the for loop is $3n/2$ comparisons, but I fail to see where the $-3/2$ comes from.
if (n % 2 == 0):
if (S[0] > S[1]):
Largest = S[0]
Smallest = S[1]
else:
Smallest = S[0]
... |
I'm currently struggling to come up with a proof that the following language is irregular:
$$L_2 := \{w_1aaw_2 \in \Sigma^* \mid w_1, w_2\in\Sigma^* \land |w_1| \ne |w_2|\}$$
where $\Sigma = \{a, b\}$.
Now quite intuitively, the language needs to know what $|w_1|$ was in order to compare against $|w_2|$, so it has to b... |
int counter(char c){
int count = 0;
while (c!=0){
if((c & 1) !=0)
count++;
c = c >> 1;
}
}
I am trying to understand a program that counts the number of 1s in the binary representation of the input character. While I understand the & part and the count part, I don't get why we're checkin... |
I'm trying to solve this question for practising purposes:
"Describe a linear-time algorithm for computing the strong component containing a given vertex v. On the basis of that algorithm, describe a simple quadratic-time algorithm for computing the strong components of a digraph."
The question can be found here . It... |
What will be the context-free grammar of $B= A_1.A_2 $
when $A_1 = \{0^n1^n|n\geq 0\}$
$A_2 = \{1^n0^n|n \geq 0\}$
Also verify using a string.
if the Grammar for
$A_1$: $S_1 \rightarrow 0S_11 | \varepsilon$
$A_2$: $S_2 \rightarrow 1S_20 | \varepsilon$
I am stuck with the value of $S \rightarrow$ ?
|
These are simple statements:
Marcus was a man
Marcus was a Roman
All men are people
Caesar was a ruler
All Romans were either loyal to Caesar or hated him
Everyone is loyal to someone.
People only try to assassinate rulers they are not loyal to
Marcus tried to assassinate Caesar.
I have converted them to First Order ... |
Suppose we define a class of algorithms that is allowed to sample i.i.d. Bernoulli bitstrings of arbitrary length, and use these to generate outputs. If we are allowed to use algorithms like this, then intuitively, "white noise" images like this one are easy to generate (i.e they have a low description length algorithm... |
Prove that the language that consists of cube numbers as strings is not regular.
I wanted to use pumping lemma but couldn't
$$0, 1, 8, 27, 64, 125, 216, \dots$$
|
The Exercise is
Computer A has a main memory of size HA 2 MiB, and computer B has a main memory of HB = 256 MiB. Both computers process single transactions that have a size of s=84 KiB. Each of the computers loads a maximum number of transactions into the main memory so that at least 512 KiB are still reserved for the... |
My assumptions (please correct me if anything in this part is wrong including wrong usages of jargons)
In MIPS instructions, add t1 t2 t3 translates to 00000001010010110100100000100000 . The add, t1, t2, t3 I suppose first of all get translated to some ASCII value implemented on the hardware level. For example, t1 is ... |
Below are the excerpts from the automata text by Peter Linz.
Definition 9.3
Let $M = (Q,\Sigma,\Gamma,\delta,q_0,\square,F)$ be a Turing machine. Then the language accepted by $M$ is
$$L(M) = \{ w \in \Sigma^+ : q_0w \vdash ^* x_1q_fx_2 \text{ for some } q_f \in F,x_1,x_2 \in \Gamma^*\}$$
From the above definition it... |
I was thinking about the implementation of a DFS on graphs, and particularly about space complexity. The DFS algorithm can be implemented with a stack data structure. When a vertex $v$ is met during the exploration of the adjacency list of a vertex $w$, if $v$ has not already been processed, then $v$ is added to the st... |
$X_1+X_2$ and $X_1-X_2 $ are i.i.d. $N(1,4)$. What is the distribution of $X = (X_1,X_2)^T$?
I know i.i.d. is an independent and identically distributed random variable but I don't know how to use it to solve this problem that contains a column vector.
|
I'm looking for an algorithm that will group players from the same teams together throughout multiple matches.
In my case, every team has up to 4 players in every match.
Teams have subs, which means that it is not necessary that the same players will play in all the matches.
Each team has randomly assigned ID in form o... |
Assume that we have a car in the real world, this car would be composed of atoms, and we can do operations on this car (for example: we can move the car or change its color, etc.).
And assume that we have a car object in the computer world (in RAM), this car object obviously is not a real car but rather a representatio... |
We are given $N$ points($N \leq 40$), where no combination of three or more points is colinear. The values of $x$ and $y$ are bounded by [$0$,$10^4$]. The problem is to find the number of permutations(mod $M$) of the points that satisfy the following properties:
We draw a triangle between the first 3 points of the per... |
I am trying to fully analyze the running time of $\texttt{nestedLoops}$ in terms of $n$ with a Theta bound.
The Java code I have is as follows:
public void nestedLoops(int n) {
int i = 1;
while (i < n) {
int j = i;
while (j > 1) {
int k = 0;
while (k < n) {
... |
I just got a hobby of studying this topic and it is quite intriguing. In one of the books, I came up with the following question:
A computing hardware is to be designed with a processor generating 32bit address for memory. It requires 2GB of RAM, 128MB of EPROM and 1MB of EEPROM, and these are mapped in the memory add... |
Backgrounds
Hi guys, I am now trying to teach myself some basic computer science theories. Specifically, I am using the book, CSAPP (computer systems, from a programmer’s perspective) and 15-213 taught by CMU
Question
My question is whether I need to memorize all the details covered in such theoretical courses (eg. the... |
I have some sets, and can combine them by taking their union. I can take unions of the unions, too. I want to take unions until the total number of sets is as small as possible, with one caveat: that none of the unions can have more than $N$ elements. (So that the problem always has a solution, none of the input sets w... |
I came across an algorithmic problem. I do not know how to do it optimally.
The problem is as follows:
There is an increasing array $A$ of size $n_1$
There is an array $M$ of queries of size $n_2$
where $1 \le n_1, n_2 \le 10^7$
For each query element $m \in M$, it is required to find the count of elements in arra... |
How we can prove that the relation: $R= \left\{0,1\right\}^*\times \left\{0,1\right\}^* \in FP$
I understand that we need to find a polytime algorithm to decide whether $(x,y) \in R$ since $(x,y)\in R= \left\{0,1\right\}^*\times \left\{0,1\right\}^*$
How can we find this? And this is enough to prove that $R \in FP$?
|
I want to know if a DFA is minimized, is there an upper bound on how many dead states are possible when it is in its minimal form, in terms of number of states, etc?
Intuitively, I am thinking that it is at most one, because if other state is there from where accept state is not reachable, the minimization would merge ... |
Given an integer $x$, I need to find the largest power of two $p = 2^n$ that divides $x$ such that the remainder is zero.
When $x$ is zero, the algorithm should return zero. For odd numbers, it should return one, since the largest power of two that divides these numbers is $2^0$.
How to write an algorithm for this? (an... |
Given a NOT satisfiable 3SAT instance, that we say $S$. Suppose that $M$ is a minimal subset of clauses of $S$ such that $M$ is NOT satisfiable. Say $X$ the subset of variables of $S$ that belong to the clause of $M$. For each Boolean values combination of the variables of $X$, we have a clause of $M$ that is false, be... |
Assume the binary operator is given as a table/matrix, so constant time to compute $xy$. And likewise, assume the (relation giving rise to the) partially ordered set is also given as a table, or in any case assume constant time to check if $x \le y$.
If I want to check if a finite binary operator is residuated, what's ... |
Is there an algorithm to find a spanning tree. I know that there are $n^{n-2}$ of them and we have algorithms to find a minimum spanning tree.
But what if I just want any spanning tree? It doesn't have to be minimum.
For a graph with no edge weights, should I just assume that the edge weights are all 1 and then use a... |
Given a graph $G = (V,E)$ and an integer $k$, the 1-BDD problem asks if there exists a subset $D$ of at
most $k$ vertices such that the degree of any vertex in $G[V \setminus D]$ is at most one.
Is there any FPT algorithm for the above problem running in time $O^*(2^k)$?
|
Given an arbitrary TM, can you decide whether it's a LBA?
|
Given any deterministic finite state automata $M$ over any alphabet, I need to construct an FSA $M'$ that accepts the set of strings $M$ accepts, but with two different letters interchanged. For example, if $M$ only accepts $101$, $M'$ should only accept any element from $\{011, 110\}$.
Suppose a string accepted by $M$... |
The halting problem and therefore the acceptance problem are decidable for LBAs, but are the infinite extensions of these problems decidable?
Given a LBA, can you decide whether there exists an input on which the LBA halts?
Given a LBA, can you decide whether the LBA accepts a certain non-empty, non-finite language?
|
My master’s dissertation subject is to analyze and implement an algorithm that would sample thermal images from camera with different frequency rates to optimize database size and processing power.
Is anyone aware of any publication related to this subject? It seems that I cannot find any information on sampling patter... |
I am trying to create a predicate in Prolog which allows me to delete all occurrences of X in a list L. I have the following code:
my_delete(X, L, R):- [] = L, [] = R
my_delete(X, L, R):- [Y|K] = L, [Y|M] = R, my_delete(X, K, M), (Y \= X)
my_delete(X, L, R):- [X|K] = L, [Y|M] = R, my_delete(X, K, R), (Y \= X)
And now,... |
I was looking to solve this reduction, but I dont see how to construct the new graph. It seems very simple but I'm not capable of do it.
I give you the complete explanation about this reduction.
We consider a variant of the independent set problem which we shall call, Independent Set with
a Fixed Node, in which the inp... |
I understand that both of them are used to find minimal spanning trees, and I've seen their implementations, but I don't understand how both of them compare to each other, and how they differ in complexity.
|
I am very new to functional programming so sorry if the question is stupid.
Having this function
const noname = func => val => bool => bool? func(val) : val
And following situation
// if event.target has css class 'draggable-box' , add drag listener to it, using event
compose(
noname( add_drag_listener )(event),
... |
What is the running time of quicksort if we always use the first index as the pivot? What if we always use the last index as the pivot? Is the running time $O(n)$?
|
Show that Integer parition problem is NP-complete using the fact that Hamiltonian cycle is NP-Complete
My Thoughts :
Integer paritition problem is about partitioning a given set of integers into two sets with equal
sums. If I could show that Integer partition is polynomially reducible to Hamiltonian cycle
that would... |
Consider the following in untyped lambda calculus
( \ x. x x ) ( \ g. \ f. g f )
Even though each variable is uniquely named reducing this will require an $\alpha$-renaming.
( \ x. x x ) ( \ g. \ f. g f )
( \ g. \ f. g f ) ( \ g. \ f. g f )
( \ f. ( \ g. \ f. g f ) f )
The bolded f is ambiguous since it is could refe... |
After reading the question I'm still not sure how CPU does branching.
I understand that we have an instruction counter which points to the current instruction. And after performing conditional jump it either stays the same (increments as usual) or increases (jumps) and points to another branch, that's clear.
The proble... |
I've recently read about the concepts of weak and strong NP-completeness, but faced a problem in wrapping my head around them. I've understood that problems which have numerical parameters (like discrete knapsack) and can be solved polynomially in the values of those parameters (which implies exponential time in their ... |
According to 1, "a path cover of a directed graph G is a set of disjoint paths in G which together contain all the vertices of G".
In my research, I met a similar problem. There, you can add and subtract paths in G, and, should cover $G$ (exactly once) by a combination of addition of subtraction of a subset of paths in... |
I have been trying solve this problem for a while now for a university assignment. I'm required to build a DFA and an NFA for the above question. So far I have been able to solve the DFA but can not find a solution for a proper NFA after multiple tries.
The solution of my DFA for the language provided above:
My attempt... |
A multiple choice question asks this:
Number of nonequivalent propositions that only consist of $P_1, P_2, P_3$ and use the $\iff$ logical operator is?$$A)7\text{ }B)8\text{ }C)1\text{ }D)16$$
I am really uncertain about what the question is asking. Is it asking me to find all the possible propositions using the $P_1... |
The convention when a function is going to use a saved register is to save the contents of that register to the stack in case the caller (if there's one? the main function doesn't have one) had been using this register too and to restore the contents right before returning. Is this convention always obeyed? In the case... |
I have a complete edge-weighted graph with $n$ vertices (and therefore $n\cdot(n-1)/2$ edges). I want to find a complete matching (i.e., perfect matching) in which the quotient $sum_G/A_G$ is maximal, where $sum_G$ is the sum of all the edges-weights in the matching and $A$ is the amplitude of the edges-weights in the ... |
I ran into this question in class:
Assume a machine that is 64-bit and has 8GB memory. They use a paged virtual memory where the page size is 4KB. You run the following program:
int main() {
int *ptr = malloc(16);
printf("%p\n", ptr);
return 0;
}
and get output:
0x555555756260
We're to find the virtual page n... |
I'm having issues simplifying regular expressions. I can't find a method to approach this problem.
How would I approach simplifying this regular expression:
$$b(abb + abbbb + aba^*bbb)^*$$
|
I know there is a lot of code out there that does this, but in particular, I'm trying to modify the following code to not just return the goal node/ one end point, but all endpoints. How do I go about it? I tried thinking of keeping a seen/visited set, but that seems redundant and kills the whole point of the reached m... |
The solution to this problem is $$(b + c)^*+(b + c)^*((a + aa)(b + c)^+)^*(a + aa)(b + c)^*.
$$
Isn't the $+$ sign a union between sets?, I am asking because I am viewing the line $(b + c)^*+(b + c)^*$
as $A\cup A$ which is $A$ so I do not see a reason to repeat the same set.
|
In http://web.mit.edu/neboat/www/6.046-fa09/rec8.pdf, I see that they pad a 2SAT clause $(x\vee y)$ to make it a 3SAT clause by writing $(x\vee y\vee p) \wedge (x\vee y\vee \neg p)$. Why doesn't $(x\vee y\vee y)$ work instead? Isn't the truth table identical?
|
I've written some code that uses numpy's array broadcasting logic and need to convert it to pseudocode. Basically, $w\in R^{T}$ and $\beta\in R^{T \times M}$. If you have the following code using numpy arrays:
T = 100
M = 10
w = np.ones(T) / T
b = np.ones((T, M))
x = (w * b).sum(axis=0)
Numpy will automatically broadc... |
Is there a unique DFA for every NFA or there are more than one DFA an NFA can be converted to?
I've read the algorithm for converting NFA to DFA.
|
I was solving Stone Game II on LeetCode. I was able to come up with a recursive (TLE) solution, which I optimized using memoization. The recursive solution computes a function $u(i,m)$, depending on an array $A_1,\ldots,A_n$, where:
$i$ is the starting index
$2m$ is the maximum size of the window at $i$
Here is the r... |
If we convert an NFA to a DFA, is the regular expression of the DFA the same as the NFA?
I know the difference between an NFA and DFA and the algorithm to convert an NFA to DFA
|
I want to use the direct method of computing the homography between two images to estimate the plane parameters (normal and depth [= distance from camera]) of a 3D plane.
If we have two images of the same 3D plane, then we know that the same point in the images is related by a homography. If one camera is placed at the... |
I was trying to solve this problem using dynamic programming.
We have $n$ objects in a row where each object has a value represented with a positive number.
This is encoded with an array $V[1], . . . , V[n]$ where $V [1]$ is the value of the first object in the row,
$V [2]$ is the value of the second object in the row ... |
Consider the problem of determining if a directed graph is strongly connected.
How to phrase it as a language and prove that it's decidable.
My Thoughts :
To think of decidability given a graph I could run DFS on each node and see that all the nodes
are reachable from the original node. So it can be determined if th... |
Let (ATM denotes the language $\{\langle M,w \rangle \mid \text{TM $M$ accepts $w$}\}$)
show that the language L={<M1,M2,w> | M1 and M2 both accept or reject w} is undecidable by reducing
ATM to L
Not really sure how to approach this. Any hints or pointers
|
I've been implementing some kind of CPU Scheduling Algorithms in Python. And I am really confused with one of the cases what'd be implemented in this case.
Let us assume that the time quantum is 10.
If the first come process which came at 0 has a burst time of 7 (simply denoting that it is less than the time quantum). ... |
There is a following Turing machine. I want to understand what it is doing :
I tried running it on input 100, 10000. Both these strings are accepted whereas 10,1000 are rejected
That leads to a good guess that it's accepting the string's with 1 followed by 0's where number of
0's = power of 2. But I can't prove it... |
Prove that the regular expression $\Sigma\Sigma(ab\cup ba)^∗a$ rejects the string $aabaabba$.
Would this be because the union of $ab$ and $ba$ would not accept the string $aabaabba$? I'm just confused on how to explain it.
|
I am trying to look for an example of a monotonically non-decreasing function $ f(n) $ such that:
$ f(n) \in O(n^2) $ and $ f(n) \notin o(n^2) $ but also $ f(n) \in \Omega(n) $ and $ f(n) \notin \omega(n) $. The domain could also be all real numbers.
I considered different variations of piecewise functions, for example... |
Consider a linear list-based directory implementation in a file system. Each directory is a list of nodes, where each node contains the file name along with the file metadata, such as the list of pointers to the data blocks. Consider a given directory foo.
Which of the following operations will necessarily require a f... |
This video shows how to design PDA from a CFG:
https://www.youtube.com/watch?v=ZImtQBMSW_Y
Basically, we always have 4 basic states, and one of them is a "hub" for loops that implement separate rules like so ("q loop" state in the pic):
The author of the vid claims that any CFG can be converted into PDA using this bas... |
I am struggling to understand why this property of asymptotic notation is true
|
So i have some theory of computer science homework and I'm struggling with this question currently. I am given the following automaton:
$Q = \{q_0,q_1\}$.
$\Sigma = \{a,b\}$.
$q_0 = q_0$.
$F = \{q_0\}$.
$\delta(q_0,a) = \delta(q_0,b) = q_1$, $\delta(q_1,a) = \delta(q_1,b) = q_0$.
I have to do two things: draw a state... |
Given a simple undirected connected graph $G$, I want to find a min-cut
of $G$ using a randomized algorithm.
My attempt was to select a random edge in $G$ and reduce that edge to a
single vertex. And recursively do it until the number of vertices is at
most 2.
The number of edges present (in the resulting multi-graph)... |
In the 3-Path Packing problem, we are given an undirected graph $G$ and a parameter
$k \in \mathbb{N} \cup \{0\}$. We need to answer Yes/No if there exists a collection of $k$ vertex disjoint paths on three vertices in $G$.
I am interested in an easier variant of this problem where we are given an additional group $M \... |
If a Turing Machine M, on input w, will M ever move its read/write head to the left?
Determine if this violates Rice's Theorem.
1.
I think the answer for Q1 is decidable because we can make a Turing Machine that decides the problem as follows:
Step 1: If M halts on w and it never moved left, reject it.
Step 2: If M ... |
This is not from online contest
Hi guys, a friend of mine recently give me this problem that I couldn't figure out an effective way to solve it.
Four functions
You are given four functions
$$
\begin{align}
A(x)&=\text{Number of }i\text{ where }1\leq i\leq x\text{ and }\gcd(i,x)=1\\
B(x)&=\sum_{d|x}A(d)\\
C(x)&=\text{S... |
Usually we will see decreasing loss for regular CNN model, but for GAN, it seems to be not that simple. How can we tell whether my model is well trained?
|
Implementation of bucket sort is mainly useful when input is uniformly distributed over a range. So the ques here is what is the significance of having input data uniformly distributed for applying bucket sort? What happens if this does not hold?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.