instruction stringlengths 35 29.1k |
|---|
Note: I am searching for an algorithm that can do what I need or something similar to it, so that I can try to adapt it to my needs. My idea here was to ask for a reference (e.g. "This can be solved using an algorithm called xyz") but obviously I would also appreciate it if someone took the time to create one on-the-fl... |
Given the following function
$$
f(x,y) = (x \cdot y + 999)\; \text{div} \; 1000
$$
where $x \in \{0, 1, 2, \dots, 2^{63}-1\}$, $y \in \{1, 2, 3, \dots, 500\}$, and the div operator is defined to round down, i.e. $a\;\text{div}\;b \;\colon= \lfloor a / b \rfloor$, is there a way to rewrite the expression such that the d... |
I'm trying to implement multiple precision arithmetic operations modulo P, with P < 2^256.
More specifically, P = 2^256 - 2^32 - 977.
I want to support the following operations: +, -, *, /, pow (each mod P)
As P is close to 2^256, numbers are represented with 8 u32 or 4 u64.
a + b mod P can be done like this (in pseudo... |
I was looking at paging in OS.
It seems like there are two concepts with the same name but with different features, and I wanted to be clear about those, Paging and page cache.
Before I thought paging as
(A page, memory page, or virtual page) a fixed-length contiguous block of virtual memory, described by a single ent... |
While making a circuit connection between Micro Processor and Memory Chips, the Address Lines A0 and A1 got interchanged. Means A0 of address bus got connected wrongly with A1 of Memory chip and A1 of address bus got wrongly connected with A0. Same error has been committed for both RAM and ROM chips. What would happen ... |
Let $\Sigma = \{a, b, c\}$ and $L = \{wa^{1 + k + 2n}b^nw^{rev}\mid n, k \in \mathbb{N}_0, w \in \Sigma^*\}$. It is clear that $L$ is context free, but the question is the following:
Let $L'$ be the language of all words $z \in L$, where between the $i$-th and the $(i+1)$-th occurence of the substring $abc$, $z$ has at... |
If $f(n) = 3n^2$, then can I say that $f(n)$ has an asymptotic upper bound $f(n)=O(n^5)$?
While that bound is not tight, it is still true, right?
|
As said, I had to prove that the greedy algorithm:
Initialize $C = ∅$
Look for an un-covered vertex and add one of its edges to $C$
Repeat 2 while there's uncovered vertices
Is a 2-approximation algorithm.
My take was:
Let's say that $OPT$ (the optimal solution) takes $k$ edges, we should prove that $ALG$ takes at ... |
say that we have {2,3,5,4,6} as input that we want to sort in ascending order. Then, we know that we can use any of the sorting algorithms: bubble, insertion, selection, quick, merge, heap or counting.
How can we determine the resultant running time for each of the above algorithms given {2,3,5,4,6} as an input?
|
I originally posted this question here
Lets assume we have a highly connected directed acyclic graph (DAG, more edges then nodes). Since it is a DAG, we can retrieve a topological order of nodes to traverse the graph with different algorithms. Lets assume we want to traverse it in a dynamic programming approach to ret... |
Consider, we are only allowed to use loops ($while$), addition ($+$), substraction ($-$) and checking if a value is $> 0$. How can one find out, if a certain variable $x$ equals a value $y$? E.g. how can I find out if $x=4$ by only using the aforementioned methods? For $x=0$ I came up with the following:
y = 1
while x... |
If we the language $A$, which is defined like this:
$$A = \{\langle G,s,t \rangle \} \mid \text{ There is a maximum path in graph $G$ that begin in $s$} \} $$
I want to build a Turing Machine that decides $A$ to prove that $A\in NL$.
How can we build the machine?
I try this:
Begin from $s$ and choose a neighbour $u$ o... |
I am studying conversion from left recursive grammar to right recursive grammar. The given grammar is
$$E \to E + T \mid T $$
It's equivalent right recursive grammar will be
$$\begin{align}E &\to TA\\
A &\to +TA \mid \epsilon\\
\end{align}$$
I understood this, that it is derived from changing the grammar $A \to Aa \mid... |
i am taking a basic Linear programming class this semester and we've recently started solving integer linear problems. I have a question regarding how to solve one of these exercises.
$$
z = max\: 5x_{1} - 7x_{2} - 10x_{3} + 3x_{4} - 5x_{5}
$$
$$
s.t. \: x_{1} + 3x_{2} - 5x_{3} + x_{4} + 4x_{5} \leq 0
$$
$$
-2x_{1} - 6... |
I am reading the paper[1] at: https://arxiv.org/abs/1905.07147
The paper says in Overview section 3:
The figure shows a constructed function Bar, which is written in
Solidity and contained in a smart contract. (The comments should be
ignored for now.) There are three assertions in this function, on
lines 14, 19, and 2... |
I have drawn the DFA for language L1 containing 11 as substring and language L2 containing 010 as substring. But I don't know how to concatenate these two to get the final answer. Please help!
|
I was reading the description of Anime4K (a video upscaler software) and I found a statement triggering my attention:
[upscaling is done] without any meaningful decrease in entropy (lost information
is lost).
If someone sits down and redraw a cartoon, they may be perfectly capable of using their experience to undo th... |
It is well known that the $p$-stable distribution can be used to generate locality sensitive hash code for $\ell_p$-norm distance measure where $p \le 2$. However, it seems that the situation for $p>2$ is not clear. Does there exist a locality sensitive hashing for $\ell_p$-norm distance where $p>2$? If not, what does ... |
I had been curious as to which page replacement algorithm is used in OSes like Windows and Linux. I could find that most information on the internet pointed at LRU(Least Recently Used) Algorithm.
But I was reading Modern Operating Systems by A. Tenenbaum and H. BOS, and it's stated that-
"LRU is an excellent algorithm,... |
Given a cost function like this $f(n)=\frac{1}{n^c}$ where $c \ge 1$, can we say that $f(n)=o(n)$ and $f(n)=O(n^2)$ are all correct upper bounds, but $f(n)=\Omega(n!)$ and $f(n)=\Omega(2^{n/1000})$ are not correct?
The problem with $f(n)=\frac{1}{n^c}$ is that it decreases as $n$ increases... so for large value of $n$,... |
Let $f$ be any function from $\{0, 1\}^{n}$ to $\{-1, 1\}$. For a given $f$, let us define another function $g_f$ as
\begin{equation}
g_f(x) = \sum_{x \in \{0, 1\}^{n}} f(x).
\end{equation}
Let us be given black box access to an unknown $f$ (you can assume the function to be chosen uniformly at random from the set of a... |
I am trying to formulate a multi-tape Turing Machine which converts one's name in the form of "(Firstname with the first letter in caps)(space)(Lastname with the first letter in caps)" to "(First letter of Lastname in caps). (space)(Firstname with the first letter in caps)".
For example, "Jayajit Banerjee" will be conv... |
We'll consider the RAM as a sequence of cells that can contain data. Some cells already contain some data, some are empty. The empty cells form the so-called memory clusters. Thus, a memory cluster is a sequence of some consecutive empty memory cells.
You have exactly $n$ memory clusters, the $i$-th cluster consists o... |
I have drawn the DFA for language L1 containing strings starting with 01 and language L2 containing strings ending in 11. For the final DFA, I have concatenated both DFA's. The finals DFA does not accept 011.
Kindly help!
|
With the following grammar:
$$S \to SxS \mid a$$
Is L(G) inherently ambiguous? What is the proof?
I know how to prove the grammar is ambiguous but I don't know how to prove if the grammar is inherently ambiguous. Can someone help me?
|
Problem: implement a Deterministic finite automaton which accepts 01 ∪ (2∪10*2)*
∪ <- is union symbol
I have a lot of problem trying to implement that DFA, the union symbol always confuse me
Can someone help me
|
I am sorry if these are such stupid noob questions. I am just getting into CS.
I read a passage in a book that says:
Time complexity is written T(n). It gives the number of operations the algorithm performs when processing an input of size n.
We also refer to an algorithm’s T(n) as its running cost. If our code follow... |
I'm trying to figure out how is the recurrence of $maxheapify()$ is $T(n)=T(2n/3)+O(1)$
If size of max heap is $n$, then calling $maxheapify(A, 1)$ will (at worst case) go through only one element in each level (in the downwards direction) up to level $h$ (where $h = \log n$)
So, the recurrence should be $T(n) = T(n/2)... |
We can read on the internet: BFS finds the shortest path to the destination.
But how ? Check this example:
for this example we can get 40 10 20 30 60 50 70
What is going on here ?
In my opinion the shortest way to 50 is 40 - 20 - 50 so this algorithm is not good for shortest path.
Could someone explain how this algori... |
I am looking for the computational complexity of the following problem.
Divide a given set of constraints into a minimum number of satisfiable clusters such that the constraints within the same cluster are satisfiable together.
Constraints can be in any type, such as Boolean logic or CSP and you can assume that there i... |
I'm trying to prove this expression 2^(2n+2) ≠ θ(2^2n)?
Firstly 0 <= c1.2^(2n) <= 2^(2n+2) for this n=1 c1=1 is a solution set.
For n = ∞, 0 <= ∞.c1 <= ∞ c1=1 is provide it. So omega notation part is okay.
Second part is Big O notation so it should be 2^(2n+2) <= c2.2^2n.
For n=1 it's 8 <= 4c2, c2 can be 3.
For n=∞, it... |
Decisional 4-XOR Problem: Assume $M>>n$ (e.g. $M=50n$ ). Let $A_1,A_2,A_3,A_4$
be sets consisting of $M$-bit elements. Each set has order exactly $2^n$. Decide whether or not there exists $a_i \in A_i$ such that $$a_1 \oplus a_2\oplus a_3\oplus a_4=0$$
The standart methods solves the search version of the problem in $... |
Wolfram Alpha is able to solve a few basic functional equations. For example, it knows how to solve equations like this. My question is: how does it do this? I am planning on creating a program to find solutions to functional equations (doesn't have to be anything too fancy -- start with just testing for polynomial sol... |
I have an edge-weighted tree, and for each leaf of the tree, there's a corresponding point on the 2D plane. For each pair of points $u$ and $v$, let $d_{uv}$ be the distance of the corresponding leaves on the tree (i.e. sum of edge weights of the path connecting the leaves), and then $u$, $v$ must satisfy at least one ... |
Suppose i want to check if my position is enclosed in a closed loop by following the connection of waypoints that surround it:
Now if i travel from node 0 to node 1. I'm at node 1 and i need to find the next connection of which as you can see i have multiple choices this time.
I can rule out where i came from quite ea... |
So I am studying for my Algorithm theory exam and this is the problem i could not solve:
Given numbers $x_1, x_2, ..., x_n$ which are the sizes of $n$ files and disk capacity $D$. Determine if you can seperate these files into $3$ disks so that, in every disk sum of doesn't exceed $D$. Justify that this problem belong... |
When proving a problem in NP, e.g. k-clique problem defined as k-clique:= {<G,k>| G has a clique of size at least k }, from what I understand is that all we assume for the certificate "c" to be is some string that is of polynomial length of the size of the input.
My question is when designing the verifier, does this ve... |
I am trying to implement a radial/angular sweep algorithm that finds all segments (segments are disjoint) that are visible from one particular point in $O(n \lg n)$. So I am trying to order vertices by their angle with point P that we are checking visibility from. But I am uncertain with which point to start first with... |
I tried to prove this by starting at RHS:
$$ϵ+a(a+b)^*b = ϵ+a(a^*b^*)^*b$$
But I dont know how to convert $(a^*b^*)^*$ to something else that will be helpful.
Any ideas?
|
I'm trying to develop an algorithm in Ruby to allocate one university to each student of a list. As opposed to Gale-Shapley algorithm, universities do no choose nor rank students; only students make a 6-wish ordered list.
There are 336 students
There are 151 cities, each with an available number of places between 1 & ... |
I am interested in a variant of the Feedback Vertex Set (FVS) problem.
For an undirected graph $G$ and $k\in \mathbb{N}$ we need to decide if there is a subset $S \subseteq V(G)$ of size at most $k$ s.t every connected component in $G-S$ is a cycle or a tree.
I am trying to solve this problem and find an FPT algorithm ... |
Consider a special kind of graph where the nodes can be partitioned into $n$ layers. There are edges only between successive layers and no edges between the nodes of any given layer. So for example, the nodes in layer-1 are connected only to the nodes in layer-2, the nodes in layer-2 are connected only to the ones in l... |
I was reading about proof assistants, formal verification etc, also I have a lambda calculus implementation. My question is: Is it possible to prove that my implementation is correct?
In fact I have two implementations, having a single proof for both would be nice but I have no idea how to attack the problem. What I kn... |
Can you help me with what steps to follow to find the Fourier transform of t/(t^2+1)^2. I know it will be solved on the lines of time-frequency duality but cannot seem to get the exact steps for it. Any help will be appreciated.
|
Statement:
If G has no simple path on x vertices ,then the treewidth of G is upper bounded by x.
Hint: Begin by computing a DFS tree, and prove an upper bound on its height.
I am supposed to prove the above statement. I tried but without success. I would be happy If you can help me to solve, thanks in advance.
|
Does higher cpi give better performance?
Lets say there is a code and we can run it by 3 methods.
1 cpi for single cycle
99 cpi for multi cycle
70 cpi for pipeline
Multi cycle has the highest cpi for this code. So is multi cycle method the best for this code?
|
I don't know how to prove the following:
Let $a$ be randomly chosen out of $\{ 1,..., p-1\}$ and $b$ randomly chosen out of $\{ 0,..., p-1\}$.
Let $m$ be a natural number smaller than a prime number $p$. Let $ h_{a,b}:$ $\{ 0,..., p-1\} \to \{0, ..., m-1 \}$ which is defined as $ h_{a,b} = (ax + b \mod p) \mod m$. Pro... |
I'm looking for the name of the problem stated below or, if available, even the algorithm to solve it. This is a hypothetical idea of mine, I don't actually have the necessary data to implement it. But I like the algorithm challenge behind it and would like to know more about it. I just can't find the name of the probl... |
If P=PSPACE then by padding argument EXPTIME=EXPSPACE.But what about class L(Logarithmic space)?What will it be equal to?I can't think it as equal to DLOGTIME.There are problems that can be solved in constant space which are contained in L.But many of them can't be solved in logarithmic time like linear search. So do t... |
I saw this problem:
$\langle G,w,k_1,k_2 \rangle \in L$ iff Graph $G$ has a spanning tree whose sum of edge wights are less than $k_2$ and greater than $k_1$. The problem says that we can prove this problem is NP-complete with reduction from Subset-Sum problem. First i cant see how is that possible. Second i know that... |
I am building a program that analyses a students mistakes and that mistake is linked to a topic. Then the program gets the information that a certain person has made x mistakes on some topic. I want an algorithm that can sort out the topic that the student made the most mistakes in and give them a weighting. Then I wan... |
We have the following pairs of strings.
$$\begin{bmatrix} aa\\b \end{bmatrix} \begin{bmatrix} ba\\baa \end{bmatrix} \begin{bmatrix} aba\\a \end{bmatrix}$$
The problem is now, to find a concatenation of those pairs, such that the resulting string of the upper row equals the string of the lower row. E.g. if $$\begin{bmat... |
Given is an algorithm that finds the transitive shell of a graph:
Transitive Shell(G)
for v in V
BFS(G,s)
for w in V with d(w) < infinity
E* = E* U (s,w)
I've been knacking at this problem for a while, and I can't come up with a solution. Also no results for this on Google either. Any help is appreciated
|
Could someone tell me how many stopping points are needed for the traveling salesman to be impractical to be solved by current computing?
|
Given a weighted bipartite graph with nodes of type A and B, I want to output an (approximately) ordered list of type B nodes as defined by the following heuristic:
For each node of type B, sum over all the edge weights for edges to node B.
Select the node from type B which has the highest value and append it to the o... |
The following question (in two parts) comes from a homework sheet of the fall 2019 semester cs170 course taught at UC Berkely taught by professors Vazerani and Tal.
Design an algorithm that takes in a stream $z_{1}, . . . , z_{M}$ of
$M$ integers in $\mathbb{Z_{n}}$ and at any time $t$ can output a
uniformly random el... |
There are several researches studying translating 0-1 integer programming into CNF form. For example, this paper and this C++ library. As the lecture notes here goes, translating 0-1 integer programming problem into CNF form might introduce $O(n\log^2 n)$ extra variables. However, it seems that the time complexity of s... |
When the architectures of the teacher and student networks do not just vary by network depths but are completely different, is it logically correct to distill knowledge at feature level (say from middle layer) in such scenario? Thanks in advance
|
Saw it on another post that there is a way of solving FVS in polynomial time if the treewidth is constant, using dynamic programming?...
If I'm given the treewidth of a graph, how do I solve it in time $tw^{O(tw)}\cdot n^{O(1)}$ ?
thank you very much!
|
I am learning Turing machine in automata. Following problem might be simple, as that's the first question on Turing machines in my textbook, however I am not sure if I am doing it efficiently.
Give Turing machine with input alphabet {a} that on input $a^m$ halts with $a^{m^2}$ written on its tape.
My approach: The ma... |
I was trying to find a grammar that generates $B=\{a^n b^m \mid n \not= 2m\}$ but I couldn't so I'm not sure that it is a CFG.
This is what I did :
$$
S\rightarrow X \mid aX \mid a \mid b \mid \epsilon
$$
$$
X\rightarrow aa Xb \mid Y \mid Z
$$
$$
Y\rightarrow aY \mid a
$$
$$
Z\rightarrow bZ \mid b
$$
|
I may sound stupid, but few people say that programming is witchcraft (maybe Joking) as a Christian I Must take it seriously, because I am planning to become Software Architect in the future. Honestly I do not think it is like Witchcraft, since it has nothing to do with evil spiritual world. How can compiler translate ... |
I am trying to convert this recursive algorithm
isqrt(n){
if(n==0){
return 0;
}
a = 2*isqrt(n/4)+1;
if(n<(a*a)){
return a-1;
} else {
return a;
}
}
into an iterative algorithm. So far I was able to do this:
isqrt(n){
vector c;
for(d = n; d>0; d = d/4){
... |
I'm trying to simplify the following REGEX:
$$R:=0^*+0^*1\left(1+000^*1\right)^*0^*$$
$R$ is the result of transforming a GNFA that recognizes $L:= \{w \in \{0,1\}^* | \left(\forall \ i \in \left[1,|w|-2\right]\cap \mathbb{N}\right)\ w_iw_{i+1}w_{i+2} \neq 101\}$
I already know that there exists $R':=0^*\left(1+000^*1\... |
I'm reading Computational geometry book.
In exercise 4.9 of the mentioned book we encounter the following problem:
Suppose we want to find all optimal solution of 3d- linear programming with $n$ constraints. Argue that any algorithm for solving this problem have lower bound $\Omega(n\log n)$.
I try as follow: i thi... |
I need to prove if the following languages are recursive:
$A_1 \subseteq \{0, . . . , 9\}^∗ $ consists of all finite sequences of $\pi$ without the decimal point.
We may thus write $A_1 = \{3,31,314,3141, 31415, 314159,... \}.$ The idea is to apply the
Turing machine and prove if it can recognize a given string or wo... |
Hey I was wondering I did all the 3 neccessary things so Head to Head comparision,
Diagraph and the Head to Head Strength Comparision with the help of the Diagraph.
In first method there is no condorcet winner so I went on and did the graph with a,b,c,d,e
candidates and as result comes out that a wins all his pairs and... |
Is assignment atomic is Promela? That is, can concurrent
x = value1;
and
x = value2;
produce anything different from value1 or value2 ?
And can a concurrent execution of
x = expression1;
and
x = expression2;
produce anything else than the values of expression1 and expression2, executed atomically (especially if re... |
I've proven the following:
For each $n\in\mathbb{N},n\geq 2$ there exists a graph on $n$ vertices such that all degrees are distinct except two. Formally for each $n$ there exists a graph on vertices $v_1,\ldots,v_n$ such that there exists at most one pair $i\neq j$, such that $\deg v_i = \deg v_j$. The construction go... |
Suppose we have PDA (same for DFA and Turing) that has a transition from a state to itself. Can we convert this PDA to another one without any transition like this?
EDIT (My thoughts):
I guess we can do it. for example in a PDA
we might be able to do this(?)
|
I have a not so large network/graph that contains roughly 4000 edges and 1200 different nodes. Each edge has a weight (or cost) and a type (let's say either red or green). Going from one type of edge to another should add an additional cost to the total cost of the desired path. So staying in the same type of edges wil... |
Given an array of size n, find minimum number of swaps required, so that no two adjacent elements are equal. For ex-
n = 6, a[] = {1, 1, 5, 2, 5, 5}, answer = 1, ( swap a[0] with a[4] or
a[5] )
n = 8, a[] = {1, 5, 5, 1, 4, 6, 1, 1}, answer = 2, (swap (a[0] with
a[1]) and (a[5] with a[6]) )
n = 8, a[] = {3, 1, 1, 5, 3,... |
Below, I appended a fragmented paragraph from Operating Systems Concepts on interrupts.
To start an I/O operation, the device driver loads the appropriate registers in the device controller.
The device controller, in turn, examines the contents of these registers to determine what action to take (such as “read a cha... |
Input: An undirected, unweighted graph $G=(V,E)$.
A cut is defined as a partition $V=A\dot\cup B$.
A bisection is defined as a partition $V=A\dot\cup B$ with $|A|=|B|$ if $|V|$ is even (or $|A|= |B|+1$ if $|V|$ is odd).
We define the value of a cut/bisection $V=A\dot\cup B$ as $E[A,B]$, i.e. as the number of edges betw... |
I know that given any regular expression, we can find always find a minimal DFA which accepts the language it describes. However, this process can take up to exponential time and space. I'm wondering though if there are any known bounds on the number of states in the DFA even without going through with a construction.... |
I need to generate a set of square tiles that are colored and are grid-able. Each square tile must have a unique set of 4 colors and each exterior edge of each tile is colored with a different color. There are 8 colors, so that leaves us with 8 choose 4 (70) tiles.
In order for these tiles to be placed into a grid, ort... |
I was asked in the test to draw a Spacetime diagram for debugging in message-passing parallel programs, I want to know is this even a valid question?
|
Consider the CBC mode where the block cipher is replaced by a function $\pi$ where $\pi(k,x)=k\oplus x$. Show that the mode is not CPA secure.
I am not got how to proceed to solve this question. Please someone helps me out to know how to solve it.
|
I have a problem on my hands, and would like help matching it to the existing, studied problems. I explain it like so:
I have a sequence of $n$ equal-sized glasses of water. Each has a different amount of water inside, some are very full, some are near empty, and some completely empty. I can pour water from one glass ... |
I am trying to understand this paper, in which (k, b)-clusterability is defined like so:
A set $X$ of points in a metric space is (k, b)-diameter clusterable if $X$ can be partitioned into $k$ subsets (clusters) such that the maximum distance between any pair of points in a cluster is $b$.
The paper offers an algorith... |
I am working on a related Steiner tree problem that I have reduced to Minimum Set Cover, but stumbled across this related problem and got stuck.
Given an universe of $n$ elements $U = \{1,2,\ldots,n\}$, let $F_1$ be a family of subsets on $U$, that covers the elements, and $msc_1$ be its minimum set cover. Let $F_2\sub... |
The closes related question I have found for this is Find string patterns preferably in regex for string streams, but it has no answer and is also a little less constrained as my idea.
Given a set of strings as for example:
Foo 25 bar zoo animals
Foo 50 bar zoo animals
Foo 1 bar and boo decorative plants
Foo animals
F... |
Wiki states: "...partitioning algorithm guarantees lo ≤ p < hi which implies both resulting partitions are non-empty, hence there's no risk of infinite recursion."
What prevents Hoare partition from not returning j equal to hi?
If our pivot is max number, we may execute j <- j – 1 only once and exit with j=hi
E.g. A= [... |
I was trying to get an arbitrary linear language to its GNF, and I converted it into one where all the productions were of the form $A\to Ba, A\to aB, A\to a$.
In this question, the accepted answer shows a way of converting some productions of a linear grammar to the GNF. The issue would be, what about the transitions ... |
The Problem
I am working on a problem that boils down to finding the closest representation of an arbitrary number ($x$) in the form:
$$x = A\times\frac{N}{D}$$
Where $A$ is a 32-bit integer, and $N$ and $D$ are 16-bit integers.
Typical inputs are real numbers between 1 and 1 billion.
My Attempts
I first attempted to ... |
I am trying to understand this paper, in which (k, b)-clusterability is defined like so:
A set $X$ of points in a metric space is (k, b)-diameter clusterable if $X$ can be partitioned into $k$ subsets (clusters) such that the maximum distance between any pair of points in a cluster is $b$.
The paper offers an algorith... |
I have a sorted (by key) sequence of key value pairs:
< (1,"A"),(1,"C"),(1,"G"),(1,"B"),(2,"D"),(2,"F"),(3,"E") >
And I have to produce a sequence of tuples like this:
< (1,< "A","C","G","B" >),(2, <"D","F">),(3, <"E">) >
Where the second element of the tuple is a sequence with the values corresponding to the key.
I... |
I want to learn programming.
I have knowledge of mathematical logic.
So, what I am searching is a book (or varios books) for learning to programming, but I think that a book like one which I imagine would be great. As I said, I have knowledge of mathematical logic, hence I have experience with formal languages.
So, I a... |
If $L=\{w \in \Sigma^*\mid w=uv,\text{ number of occurnce a's in $u$ equal to number of occurrence b's in $v$}\}.$
I think $L=\Sigma^*$ because for any string in $\Sigma^*$, we can split it to $uv$ such that it contain equal number of a's and b's. But I can't prove it or maybe that language isn't regular. Any help for ... |
I am having a little bit of a hard time distinguish between a TM which accepts a language, and a $TM$ that decides a language. To be more precise:
$L_1 = \{\langle M\rangle\; | \; M$ accepts the 10-PCP $\}$
and $L_2 = \{ \langle M\rangle \; | \; M$ decides the 10-PCP $\}$
I guess $L_1$ is undecdiable, since I could pot... |
Many complete problem of different class of complexity has SAT variant. Like 3-SAT or $k$-SAT is $NP$-complete, Horn-SAT is $P$-complete, 2-SAT is $NL$-complete, and so on. So I was wondering if there is a $L$-complete variant of SAT?
|
I am currently reading Arora and Barak's Computational complexity. In Chapter 4 (Space complexity), they say the following:
Since the TM's work tapes are separated from its input tape, it makes sense to consider space-bounded machines that use space less than the input length, namely, $S(n) < n$. This is in contrast t... |
We have n box and an array of weights, where weight of ith box is given by arr[i]. We have a container which can carry a maximum weight of w. Now we have to find minimum number of containers required to pack these N items.
Exact question link : -
link
Useful Resources :-
https://www.geeksforgeeks.org/bin-packing-probl... |
Which one is asymptotically larger? $\log^*(\log(n))$ or $\log(\log^*(n))$? I think they are asymptotically tight bounds for each other (one is $\Theta$ of the other).
|
Let's say for example we have 1000 points and 50 dimensions.
And we build a quadtree where each node represents a 50-dimensional box and is divided by splitting the box into smaller boxes that are half the size in every dimension? How would i calculate how many children each internal node has?
|
Henry Yuen's youtube comment on this video https://www.youtube.com/watch?v=HL7DEkXV_60 (should be one of the top comments) explains that with the help of quantum entanglement (or quantum computers), it is possible to solve a problem that has been proven to be unsolvable by a turing machine.
Does that mean quantum compu... |
One approach to solve recurrences is the so called substitution method.
While practicing I encountered some recurrences, where non integer arguments can occur, e.g. T(n) = 2*T(n/2) + n, if n is not a power of 2.
My understanding of the substitution method, is that it only works, if all arguments are integers. Is this c... |
I am trying to prove something, and it will help e greatly to show that the maximum degree of any vertex, $d$ is a connected simple graph, goes up asymptotically linearly along with the number of edges in the graph.
I came up with a somewhat hand-wavey "proof", and I wonder if it is anywhere near correct:
For fixed $|... |
*a = *b
In C, the above expression is always interpreted as the assignment of the value at the address contained in b to the value at an address in a.
But, according to the precedence of operators and associativity rule, * has higher priority than the assignment operator '=', and is associative from right to left.
If w... |
I am new to programming and trying to get better at writing efficient code.
The obvious thing to do is practice and gain experience.
I did learn a few general pointers through exercising, but in most cases, the only option is to simply think of a better algorithm to solve a given problem.
What would be a good source (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.