instruction stringlengths 35 29.1k |
|---|
Apache Spark, a distributed computation framework, has a construct called accumulators which are global variables with an associative addition action. These can be used to aggregate statistics during the computation process. The problem with these variables is that parallel tasks can fail without "rolling back" the val... |
Out of curiosity, why do combinators look this way? For example, why is $K = \lambda x y \to x$ and why is it called $K$? Why is it not $\lambda x y f m \to f m x$? These are just arbitrary letters, I have no idea what this function does. Or why is $S = \lambda f g x \to f x (g x)$?
Who first discovered that combinator... |
I have been reading [1] recently. On page xxi, the authors wrote: "For example, multiplying 577 by 423 using repeated addition requires 422 additions, whereas doing it with the grade-school algorithm takes 3 multiplications of a number by a single digit and 3 additions."
The above statement is wrong. There are only 2 a... |
I want to do some research on how machine theory (automata theory) is applied in the operating system. Also thank you for introducing useful links and books.
|
This problems comes from AI, and it looks something like this:
I am supposed to multiply two floating-point matrices A * B. A typically has the size of (1k to 10k) times 32, while B is of the size 32 times (1k to 10k). The result would be a large square matrix of size (1k to 10k) times (1k to 10k).
I need to do this in... |
From my understanding, two separate and distinct operations can be performed on binary search trees: Search and Traversal.
Search: Given a key, search will run an algorithm to find the node containing that key in the tree, then return this node.
Traversal: Using a Breadth-First or Depth-First search algorithm, visit ev... |
Which algorithm would be most suitable Kruskal, Prims or Steiner tree algorithm ?
|
I have weighted connected directed graph with cycles which can have multiple edges and loops (edge from vertex back to itself). Weight of each edge is its length (always positive integer). There always is a path from vertex $v_0$ to every other vertex (including itself).
I need to find greatest common divisor (GCD) of ... |
Is there an efficient way to find the minimum and maximum number of edge disjoint cycles an undirected graph can be partitioned into, given that every vertex has an even degree?
|
What I mean is, if in real life I had an object and I gave it to you, I would not have it anymore. I did not give you a copy of the object.
Is there a way to do that with information?
|
I have little background on recurrence trees, and I am working on the following exercise:
Exercise. Take $T(n) = 2T(n/2) + 3\log(n)$. Draw the recurrence trees for $n=2$ and $n=4$. What can we conclude complexity-wise?
My attempt. For $n=2$ we have the following recurrence tree:
Recursive Call Recurrence Tree ... |
In Turning Machine Halting Problem, is the memory of the Turing Machine infinite or finite?
Does the Turing Machine have access to infinite tape? Or limited tape?
|
I'm learning "Introduction to Algorithms, 3rd Edition
By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein", referencing the solution to Exercise 4.4-1
I know the following equation gives the running time of the algorithm on the whole input of size n.
$n\sum\limits_{i=0}^{lg(n)}(3/2)^i=n\frac{... |
Suppose given $k$-sorted arrays of numbers that contains total of $n$ elements. we try to choose $k$ elements in $k$ arrays (each arrays exactly one element) such that minimize difference between maximum and minimum number in chosen $k$ numbers. What is lower bound of this problem? I have an algorithm that solve above ... |
I have to prove that $f(n) \neq O(g(n))$, where $f(n) = n\log n$ and $g(n)$ is $\log^*n$ if $n$ is odd and $n!$ if even.
So my thought is to say that $f(n) = O(g(n))$ and then with the definition prove that this is wrong, but i am struggling. Can someone help me?
|
I read that the problem of first-order model checking is believed to be not fixed parameter tractable on general graphs.
Why is this the case? Would be happy about some reference
Thanks in advance!
|
I have read in the Algebrization paper that, if we only allow polynomially-long queries to oracles, then, results based on padding will not relativize. For instance: assuming that $A$ is a PSPACE-complete language, $P^A = NP^A$ does not imply $EXP^{A[poly]} = NEXP^{A[poly]}$ (unless $EXP$ = $NEXP$).
However, I do not s... |
As far I know computer using crystal oscilator to define 1 second and it's not real 1 second, i mean it's not stable.
While real clock using cesium and we know cesium is stable, why doesn't computer contain cesium in its component to define 1 second.
So thats mean 1 second in clock atom and 1 second in computer are not... |
Show that if we strengthen linear programming by also allowing constraints of the form $$ \sum_{i,j = 1}^n a_{ij} x_i x_j = b,
$$ for integers $b$ and $a_{ij}$, then the problem becomes NP-complete.
This is a practice problem that I am trying to solve. I really do not know how to approach, or reason about it. I unde... |
I'm looking at Dijkstra's algorithm for single source shortest paths in a graph $G$ from a vertex $s$ from Introduction to Algorithms by Cormen et al. The $w$ parameter is the weight function such that $w(u,v)$ gives you the weight of the edge from $u$ to $v$.
DIJKSTRA(G, w, s)
INITIALIZE-SINGLE-SOURCE(G,s)
S = {}
... |
I know CPUs execute machine language code. Also I know operating systems such as Windows and Linux are a piece of code. But I cannot understand why Windows 11 does not run on a somewhat old CPU.
Can anyone explain it please?
|
What's the difference between $a^*+b^*$ and $(a+b)^*$?
I was going through this question. So according to the question-:
(a+b)* generates $\in$, a,b,ab,ba,aa,ba,...
whereas a*+b* generates $\in$, a,aa,aaa,b,bb,bbb etc.
Why can't a*+b* generate ab? What's stopping it from generating it? I feel like I am missing somethin... |
Most command line tools have an usage described by using square brackets for optional parts and just writing out required parts (like in regexes) for example:
foo [opt1[opt2...]] req1 req2 [opt3...]
It alone is not as powerful as regular expressions since it cannot express the language of zero or more ab's nor the la... |
I desperately need a hash / compression function that is suited to shorten text.
The context is this: I want to bring order and sort my box with hundreds of charging adapters (duh). After I determined for each one to what ever it belongs to, I want to label it accordingly.
Why don´t I just enumerate them? I have tried ... |
Suppose we have a randomized algorithm that takes a graph G and color k as inputs and provides yes if the graph is k-colorable and no with probability $p(n)$ if it's not k-colorable, where $n$ is the number of vertices. What is the consequence if someone comes with a proof that $\displaystyle \lim_{n \rightarrow \infty... |
I recently worked on an algorithm which, among other things, checks strings for equality using the classic builtin equality operator:
str1 == str2
(I think it should be irrelevant to the question, but I faced this issue in C++, and str1 and str2 are obviously std::strings.)
At a later point I decided to relax the equa... |
Define two operations:
B-operation: When two multi-edges connect a pair of vertices, replace the multi-edges with a single edge connecting the pair of vertices.
C-operation: When one edge connects vertices $u$ and $v$, another edge connects $v$ and $w$ (where $u \ne w$), and there is no other edge incident to $v$, remo... |
Given B and C operations.
B-operation: When two multi-edges connect a pair of vertices, replace the multi-edges with a single edge connecting the pair of vertices.
C-operation: When one edge connects vertices $u$ and $v$, another edge connects $v$ and $w$ (where $u \ne w$), and there is no other edge incident to $v$,... |
I have seen several variants of DFS algorithms used to check existence of cycles in graphs.
They all have the same structure : do a DFS in the graph. There is a cycle in the graph if and only if there exists a node which, while being treated, has a neighbour which has property P.
The variants are based on different pro... |
So, there's a LeetCode problem that has you find a O(log n) solution to finding a target number in a rotated sorted array.
As an example:
array = [5,6,7,1,2,3]
target = 4
Basically, the trick is that you can find the point of rotation in O(log n) time and then you can do a binary search over the appropriate subsection... |
I've written a function that gets a permutation and checks if that permutation can be reached using a stack from an input sequence which is <1,2,3,...,n>. (we take elements from left)
For example: if we have an input sequence, then if the function gets these permutations:
<4,3,2,1> - Returns true since we can push (1... |
The problem is-:
Site 1 solves this in this way-:
https://onlinesmarttrainer.blogspot.com/2020/08/minimization-of-dfa-solved-example.html
Site 2 solves this in different way-:
https://aswaddev.github.io/dfa-minimizer/
Book solves (using table filling method) and gets this-:
Here is the youtube video, which uses Myhi... |
We have n block $B_i$ $(1 \le i \le n)$, each block has 6 faces and each face material, is one of the k types (k is an input parameter).
In addition, each block $B_i$ has the weight $W_i$.
the question is to find the longest sequence S of blocks, such that fo each $1 \le i < n$:
S[i].weight >= S[i+1].weigth and
S[i].to... |
We are given a rooted tree $T$ of distinct Natural numbers. The goal is to find the largest subtree of $T$ that has MinHeap property. In fact, we want to calculate the largest subset $S$ of nodes, in a way that all nodes in $S$ have a common ancestor in $S$, and any ancestor of $n \in S$ that appeared in $S$ has a smal... |
Here, $Σ=\{a,b\}$ The number of $a$ can be $1, 4, 7, 10.....$, also $a$ can be placed anywhere.
Find Regular Expression for $L = \{w \mid w\in \{a,b\}^*\text{ and }n_a(w) \equiv 1 \bmod 3\}$
How can I proceed in this problem?
|
This is pretty simple and I THINK I know the answer to the question, but I don't know how to prove it formally. Below follows the question.
Question. Compare the functions $f(n) = \frac{n^2}{\log(n)}$ and $g(n) = 3^{\log(n)}$ in terms of rate growth.
My attempt. I have tried to compute the limit $\lim_{n \rightarrow +... |
A 'person' is represented by a combination of postal code and mailbox number(both are natural numbers)
No two postal codes are alike, yet a postal code can contain many different mailboxes.
At any given postal code, all mailboxes have different numbers.
Display a data structure that supports the following methods in be... |
Let $\mathcal{T}_n$ be the set of ordered binary trees that have n leaves.
$d_T(v)$ means the node $v$'s depth in the tree T.
Prove: for any $T\in \mathcal{T}_n$ , for any $\{c_1,c_2,...c_n\}$ , $c_i >0$ , $S=\sum_i c_i$
$$
-\sum_{i=1}^n(c_i\cdot\log_2(c_i/S)) \le \sum_{i=1}^{n} (c_i\cdot d_T(v_i))
$$
$v_i$ means the i... |
I am working on an efficient mapping function represented as a directed graph. In essence, it is a sort of radix trie. A path must be formed from a bit string [string hereon] efficiently. To do this, I decided on looking for and using an algorithm that finds a continuous, common subset of bits at a particular offset an... |
I have a directed adjacency list of node's. The structure of a node is
Node {
id: integer;
order: integer;
parentId: integer | null;
}
and the following nodes for the sake of example.
[
{id: 1, order: 1, parentId: null},
{id: 2, order: 1, parentId: 1},
{id: 3, order: 2, parentId: 1},
{id: 4, order: 1, parentId: ... |
I need to find the find the minimal
class $\mathcal{L}$ belongs to where
$$\mathcal{L} = \{\langle M \rangle: M \text{ is a TM that accepts 1 but does not accept 0}\}.$$
I think I can prove that $\mathcal{L}\in \overline{\mathsf{RE}\cup\mathsf{co{-}RE}}$ using 2 mapping reductions from $\text{ACC}$ ($M$ is TM that acce... |
If not, then what is the maximum number of cycles in any graph?
|
In [1], the authors give the following example to explain how Dependency Quantified Boolean Formulas (DQBF) work:
As an example for a DQBF, consider the formula
$∀x_1∀x_2∃y_1(x_1)∃y_2(x_2) : (x_1 ∧ x_2) ≡ (y_1 ≡ y_2)$.
Here $∀x_1∀x_2∃y_1(x_1)∃y_2(x_2)$ is called
the quantifier prefix and $(x_1 ∧ x_2) ≡ (y_1 ≡ y_2)$ th... |
The load balancing problem:
Given we have $m\ge3$ machines (servers) $M_{1}, M_{2},\dots,M_{m}$. As input we are given $n$ jobs defined by their processing times: $t_{1},t_{2},\dots,t_{n}\in\mathbb{Q}_+$ (positive rationals). Our goal is to assign assign the $n$ jobs to the machines so that the maximum runtime of any m... |
I need to prove that if $SAT\notin Size(2^{n/100})$ then CorrectSATSolver$\in P$.
Where CorrectSATSolver $= \{C | C(\varphi) = 1 \iff \varphi$ is satisfiable$\}$. In other words, CorrectSATSolver problem is as follows: Given a circuit C, decide if the circuit C solves the SAT problem.
I don't understand how to use th... |
I need to prove that CorrectConnSolver is coNP-Complete where CorrectConnSolver is defind as follows:
CorrectConnSolve$= \{C | C(G) = 1 \iff G$ is connected$\}$.
In other words, the
CorrectConnSolver problem is as follows: Given a circuit C, decide if the circuit C solves the
connectivity problem.
I have already pr... |
Given the language $L=\{a^{j+1}b^kc^{j-k}|j\ge k\ge 0 \}$ I need to prove that it is not a regular language using closure properties.
I was having a trouble handling $a^{j+1}$ so I tried to prove this first for $L_1 = \{a^jb^kc^{j-k}|j\ge k\ge 0 \}$, I assume $L_1$ is regular and define an homomorphism $h: \{a,b,c\}\ri... |
I read the dissertation [1] and the paper [2], but I'm not sure how to compute $H_{k}$.
$H_{k}$ is defined as:
$$H_{k}(\gamma) = \{ \alpha | \alpha \text{ is terminal,} |\alpha| = k \text{ and } \exists{\beta} \text{ such that } \gamma \overset{*}{\Rightarrow} \alpha\beta \}$$
The operation $\overset{*}{\Rightarrow}$ s... |
In graph theory, can a cycle contain repeated nodes/vertices not including the first and last ones? If so, can you please give an example?
|
I'm making a program that involves making models of and working with arbitrary systems (or programs). What is the most computationally efficient Turing complete system to model these in?
By "arbitrary system", I mean anything with inputs and outputs. It could be anything from a function that adds 1 to the input to a co... |
I am reading a case study for Computer architecture, A Quantitative Approach 5th Edition. For reference, I am looking at the case study #1 in Chapter 5 and none of it is making any sense.
It says:
Each cache is direct-mapped, with four blocks each holding
two words. To simplify the illustration, the cache-address tag ... |
Here is the last paragraph at page 441 of the paper ‘Covariance and Contravariance: Conflict without a Cause’ by Giuseppe Castagna:
How is all this translated into object-oriented type systems? Consider a message $m$ applied (or “sent”) to $n$ objects $e_1$, …, $e_n$ where $e_i$ is an instance of class $C_i$. Suppose ... |
Let $\Sigma = \{a,b\}$, $L_1,L_2\subseteq \Sigma^*.$
$L_1 \triangleleft L_2 = \{w\in \Sigma^* \mid \exists v\in L_1, vw \in L_2\}$
For clarity, here is python code that shows $L_3 \triangleleft L_4$:
answer = set()
L3 = {"aa", "b", "bb"}
L4 = {"a", "b", "ab", "bb", "aaa", "bbab"}
for c in L3:
for c1 in L4:
... |
Let $\Sigma = \{a,b\}$, $L_1,L_2\subseteq \Sigma^*$
$L_1 ◃ L_2 = \{w∈ \Sigma^* | \exists v\in L_1, vw \in L_2\}$
For any context-free language $L$, regular language $R$, whether $L \triangleleft R$ is regular language or not? How to prove or give a counterexample?
|
Consider this post, the problem is
given an array $A[1..n]$. We don't have direct access to $A$, but we can query what is the sum of $A[i..j]$ for every interval $i..j$. We would like to find the maximum of $A[i..j]$ over all intervals $i..j$.
That answer describe an algorithm that solve the problem with at most $O(n)... |
let $L$ be a regular language, and let $A=\{\Sigma, Q, q_0, F, \delta\}$ be a DFA such that $L = L(A)$.
I need to prove that $$L_p=\{xy\in\Sigma^*\mid\delta(q_0, y)=p\text{ and } \delta(p, x)\in F\}$$ is regular for every $p\in Q$ by defining an automaton $A_p$.
I tried to define it like so $$A_p=\{\Sigma, Q\times Q, (... |
I'm interested to know if there is an algorithm to find possible solutions for the matching problem, in a bipartite network where each vertex have maximum number of connections greater than one. For reference the original matching problem only requires that each vertex only have one edge.
More specifically, imagine tha... |
Create a context free grammar for L.
$$ L=\{a^nb^mc^k | n+m \neq k\} $$
First I tried to create a CNF for a language that accepts strings in which $n+m = k$. I got this:
$$
S \rightarrow aAc
$$
$$
A \rightarrow aAc \mid B
$$
$$
B \rightarrow bBc \mid \epsilon
$$
to create a CNF for $L$, I wanted to add a new start st... |
If we indicate n as the number of nodes of a Red-Black Tree, which is the time complexity of a DFS algorithm that analyzes only the internal nodes of the Tree?
I think that the complexity is O(n), but I'm not sure because of the leaf nodes that the algorithm doesn't need to analyze.
|
This is an open question I have been thinking about lately. Let's say we are black player and we play two "harmless" moves A and B. We assume it won't change anything if we play A - B or B - A. So all chess games having the exact same position and with an option A - B or B - A could end up the same. So the question is:... |
I'm trying to learn SSC, but it is illogical to me why I need a reverse graph for it. I drew a graph and it's reverse:
So, we have a road from vertice 6 to vertice 5, and we have a road from vertice 5 to vertice 6. In the reverse graph we have road from 5 to 6, but if I delete vertice 8 we still have road from 6 to 5 ... |
I am looking for a way to generate every permutation (so order does matter) of a set of positive numbers whose sum is less than (or equal to) a given limit. I need to find the permutations themselves, and not only how many there are. For example, for the set {1, 2, 3} and the limit 6, I have to generate :
Ø
(1)
(1, 2)... |
If you can reduce A to B, does that mean B reduces to A?
Sorry for the stupid question. I think the answer should be yes, because if you can convert all yes-instances of A to yes-instances of B, then you basically just have to do the opposite to reduce yes-instances of B to yes-instances of A.
|
we have the following languages - $L_1 ,L_2$ .
we'll define new language:
pref$(L_1,L_2)$= {x $\in$ $\Sigma$*| $\exists$ u $\in$ $L_2$ s.t: x $\bullet$ u $\in$ $L_1$ }
can we say that:
$L_1$ ,$L_2$ $\in$ Lreg $\to$ pref$(L_1,L_2)$ $\in$ Lreg ?
|
Consider this recurrence relation,
$$T(n)=T(n-\sqrt{n})+1$$
I try to show that $T(n)=O(\sqrt{n})$.
Also, I read this link, but my question is, can I claim that, at each step $n$ decreased by at least $\sqrt{\frac{n}{2}}$ to reach $\frac{n}{2}$?
|
I'm starting to learn modal logic and there is something that's bothering my mind for a while.
we know from deduction theorem that $((\vdash q) \rightarrow (\vdash p)) \Leftrightarrow(\vdash (q \rightarrow p))$
and also from soundness we know that $\vdash\Box q \rightarrow \vdash q$
so here's my problem, why can't we... |
Sources:
https://en.wikipedia.org/wiki/Best,_worst_and_average_case
https://www.bigocheatsheet.com/
It can be seen that a Hash Table has no access/indexing complexity given the above sources. This doesn't make sense to me, since given a key, I can look it up in constant time by hashing it and iterating through the as... |
I just discovered the term "de Bruijn sequence", but don't quite follow what it means exactly (or how de Bruijn is pronounced :), "brown" I guess).
There are two good resources I am looking at for better understanding (it seems like they have a good model of them):
debruijnsequence.org
A Framework for Constructing De ... |
I am trying to find a grammar and prove that it is unambiguous for the language $L$, where $$L = \{ w \in \{a,b\}^+; |w|_a = |w|_b \} $$
Essentially: word $w$ contains at least one $a$ and $b$; where the number of $a$ is equal to the number of $b$.
What I tried: I am currently working with a grammar that has the follow... |
I know that a thread in a "running" state is put in a "wait" state if the thread itself needs I/O operation. Now I'm asking if even a cache miss implies that a thread is put in a "wait" state.
|
If you have an $\alpha$-approximation algorithm $A$ for some problem $f \in \#P$, such that (for $0 < \alpha \leq 1$)
$$
\alpha f(x) \leq A(x) \leq \frac{f(x)}{\alpha},
$$
does that automatically imply that you can reduce that accuracy range and have a fully polynomial approximation scheme, $B$, such that (for $\vareps... |
the error im receiving is : file "/home/lucas/python/cargame/utils.py", line 17, in blit_text_center
render = font.render(text, 1, (0, 0, 0))
pygame.error: Library not initialized
the problem which seems to be somewhere in this piece of code:
def blit_text_center(win, font, text):
render = font.render(text, 1, (0, 0, 0... |
I want to understand the proof in the following link that 2SAT is in P. What is the need for the last corollary? Wouldn't be enough to just prove the case for the graph with the help of the path search?
Furthermore, is the proof for the corollary correct? The algorithm is presented there without proof.
|
I'm currently trying to find the equation of the $d$-dimensional hyperplane which includes $n$ given points, where $n \ge d$.
Theoretically, it isn't hard - the $d$-dimensional hyperplane is represented as
$$\sum_{i=0}^{d-1} a_i x_i = a_d$$
for some constants $a_0, a_1, \dots, a_d$.
I have $d$ equations in $d+1$ variab... |
$L=\{a^n b^m:n\neq m\}$
$L=\{a^n b^l c^k :k\neq n+l\} $
Can we take in case 1
$w=0^{2p}1^p$?
But my resource says that, we need to take
$w=0^{p}1^{p+p!}$
Similarly in case 2, I want to take
$w=a^p b^p c^{3p}$
but my resource, item 23 as shown below says that we need to take something else.
$w=a^{p!}b^{p!}c^{(p+1)!}... |
I have been learning about de Bruijn sequences recently. I looked at this C library on Greedy algorithms, and took what I learned to make this JavaScript version, which tries to make as many de Bruijn sequences as possible. Then I implemented a quick "iterate over de Bruijn sequences in JavaScript" function. The latter... |
Andrew S. Tanenbaum, in his book Modern Operating Systems, states that
Once the CPU has decided to take the interrupt, the program counter and PSW
are typically then pushed onto the current stack and the CPU switched into kernel
mode.
Once the interrupt handler (part of the driver for the interrupting
device) has st... |
I have read following answer and question How to wiggle sort an array in linear time complexity?.
But while reading I came up with a question. I can't comment on answers yet, so I decided to make an extra question out of it.
John L. states that
Call A wiggle-sorted if A0 < A1 > A2 < A3 > A4<...
Call A wiggle-sortable ... |
What is the first/oldest piece of source code shown in an scientific paper or journal? I am looking for source code of assembly or a high level programming language which was real (implemented) and relevant.
Wikipedia says the first high level language would be Plankalkül, which was never implemented. Which leaves us ... |
Consider the regular expressions
$(1+01)^*(0+\epsilon)$
$(1^*011^*)^*(0+\epsilon) + 1^*(0+\epsilon)$,
where $\epsilon$ is the empty string. I need to determine if these expressions are equivalent. Intuitively it seems they are equivalent because they seem to generate the languages of strings without two consecutive $... |
I couldn't think of a poly-time solution. Moreover, I think that there is a pretty simple Karp-reduction from 3-coloring problem, which is NP-complete.
let's say that graph G is in 3-colloring.
I'll build G' in the following fashion:
every vertex with a degree >= k I'll split (as many as needed) by adding one neighbor ... |
Consider a k-bit binary counter and suppose that in the beginning the value of the i-th most significant bit is $b_i$ for each $i = 0, . . . , k − 1$. Let $b = b_0 + 2b_1 +· · · + 2^{k−1}
b_{k−1}$. The cost of each increment is the number of bits flipped. Show that for $n ≥ b$ the cost of $n$ increments from that initi... |
Consider a variant of link-by-size implementation of the Union–Find data structure, in which trees will be linked by the logarithm of the size. Let $\ell_i$ = $⌊\log_2|T_i|⌋$ and, when merging $T_i$ and $T_j$, we use the following rules:
• if $\ell_i$ < $\ell_j$ , we make the root of $T_i$ point to the root of $T_j$ ;
... |
Turing Machine for the Language $L=\{(a^n)b(a^n)b(a^n) | n\geq0\}$
Here is what I have tried:
1. Starting State
Read $a$, Write $x$, Move Right, Go To 2
Read $x$, Write $x$, Move Right, Go To 1
Read Bottom, Go to State YES.
2. Looking for $ab$
Read $b$, Write $b$, Move Right, Go To 3
Read $a$, Write $a$, Move Right, Go... |
I am currently learning Discrete mathematics.
there is a topic on dicrete probability (which I havent covered yet), but I also know there is non-discrete probabiltiy but I dont know what they really are.
My aim is to learn math so I can understand CLRS, is probability needed for clrs ?
|
Assuming I have very long words, is it worth it to use Counting Sort with its memory overhead to achieve linear time complexity?
I wrote a Python function that sorts the characters in a given string using Counting Sort, but it looks like I have to go through the overhead of constructing the output list and converting i... |
I have an old file written to a DVD-R several decades ago, and it turned out this file can potentially has some value as NFT (non-fungible token). The file was published online and have been copied several times by rather famous companies. I want to prove that I own the original file.
I know that this DVD at least cont... |
Let $\Sigma$ denote an alphabet and $[ \Sigma ]$ set of lists.
I've encountered the following function:
$f([])=[]$ (empty list)
$f([x])=[x]$, for $x \in \Sigma$
$f(x:L)=f(L)$, for $x \in \Sigma$ and $L \in [ \Sigma ]$
The function is supposed to return a tail for nonempty list. That is:
$f([x_1,x_2,...,x_n])=[x_n]$
How... |
How to show $f: \mathbb{N} \to\mathbb{N}$ with $f(x)=4x$ where $x$ is in the set of natural numbers $x\in\mathbb{N}$) is Turing Computable?
My guess is obviously there is a finite number of operations needed to reach a solution meaning it is Turing computable.
Not sure how to prove this though! Can someone please expan... |
Given a generic Red Black Tree with n nodes is correct to say that the number of internal nodes is ⌊n/2⌋ and the number of leaf nodes is ⌊n/2⌋ + 1 ?
|
In the CLRS book, section 4.4 they try to resolve the following recurrence:
$$T(n) = 3T\bigg(\bigg\lfloor \frac{n}{4} \bigg\rfloor\bigg) + \Theta(n^2)$$
Later, they write the same recurrence as
$$T(n) = 3T\bigg(\frac{n}{4}\bigg) + cn^2$$
And I do not understand why they change $\Theta(n^2)$ to $cn^2$
Mathematically spe... |
Given the recurrence
$$T(n) = 2T\bigg(\frac{n}{8}\bigg) + 2T\bigg(\frac{n}{4}\bigg) + n$$
My professor says that $T(n)$ is $O(n\log n)$ but I have calculated a complexity of $O(n)$ as shown below with the substitution method.
So $T(n)$ is $\leq cn$ for every $c\geq4$. So in my opinion $T(n)$ is $O(n)$.
Who is right?
|
Imagine you have a collection of possible "components" (C) and a set of "recipes" assembled from those components (R).
For example:
C = { 'screws', 'bolts', '2x4 pine', 'nuts', ... }
R = {
{ 'screws', '2x4 pine' }, // Shelf
{ 'bolts', 'nuts', '2x4 pine' }, // Pergola
...
}
Now let's say we have a "toolbox" (T) w... |
I should prove or give a counterexample to the above statement.
In my opinion, this statement is false but I don't manage to find the right counterexample.
My idea was to define $C = Σ^*$ because $Σ^*$ is decidable and contains all the undecidable languages but I fail to find an undecidable language that contains a dec... |
What is numerically the best value or range of values used as a reference for the load factor used in the hash table?
What is the pseudo-code of the “rehashing” method, which is applied when many elements are added to a hash table and the load factor increases and the best value used as a reference is exceeded.
|
$$
L_{1}:=\left\{w \in\{a, b\}^{*} \mid w\right. does \ not \ have \ the \ substring \left.a b b\right\}
$$
Hello,
I wanted to ask whether this dfa is correct according to L1.
|
I am using a genetic algorithm for the optimization of a thermodynamic cycle. The problem has no analytical solution and the solution space is computationally large. The question is the following: How can i combine 2 or more objective functions with different value range and dimensions into a single multi-objective fun... |
I guess I've already figured out what is a recursion tree and how to construct one. Inspired by Figure 2.5 of "Introduction to Algorithms, 3rd Edition by CLRS", I drew some recursion trees for the recurrence $T(n) = 2T(n/2) + cn$.
the recursion tree for the recurrence when n=16
the recursion tree for the recurrence wh... |
I'm trying to show that a modified 4-SAT in which at least two literals per clause must be true is NP-complete. I'll call it $4_2$-SAT. I understand the reduction from 3-SAT to 4-SAT, and I know why $4_2$-SAT is in the class NP, so I'm just struggling on the reduction from 4-SAT to $4_2$-SAT (or any other way to show t... |
I'm studying the principle of CRCs from everything we know about CRC but afraid to forget by Andrew Kadatch1 and Bob Jenkins, 2010.
I do not understand:
bPowX[k+1] = (bPowX[k] >> 1) ^ P // in Listing 1: Multiplication of normalized polynomials
//XpowN returns (x**N mod P(x))
result ^= Multiply(temp, Multiply(m, Xpo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.