instruction stringlengths 35 29.1k |
|---|
Considering the following set, I have to say if it is undecidable, decidable or semidecidable:
$$S_1 = \{y | \forall n \text{ the Turing Machine } M_y \text{ does not accept any string of length } n\}$$
The answer given by the professor is:
Set $S_1$ is undecidable, which can be justified based on the Rice Theorem.
I... |
I attempt to find a few general encyclopedic works on computer science such that looking up relevant terminologies is easily available ready to hand. I'm not familiar with the whole picture of computer science so I can't describe precisely the delicate character of what is a good encyclopedic reference to computer scie... |
The Courcelle's theorem as following:
Obviously, we need the length of the $\varphi$~(that is $||\varphi||$)~in Theorem. However, how to caculate the length of $\varphi$?
For example, $$\begin{aligned}
\operatorname{conn}(X)=\quad & \forall_{Y \subseteq V}\left[\left(\exists_{u \in X} u \in Y \wedge \exists_{v \in X} ... |
I understand that data is transferred from the main memory to the CPU and vise versa using the data bus. But, I am unable to understand, how the data is being transferred from the main memory to the hard disk or from the hard disk to main memory.
Does it use the same data bus for the transfer? My guess is that it also ... |
The game of life is one of the most famous cellular automata in 2D. It has a variety of objects, some of them are moving like gliders, some have an oscillating behavior and others do not change at all, i.e. are still lives.
I am interested in the computational complexity of finding still lives.
Especially in a restrict... |
I am studying the $k$-gossip problem on dynamic graphs against an adaptive adversary. Essentially, we are given a set of tokens $\mathcal{T}$ which are distributed amongst the nodes such that each token is distributed to at least one node. Importantly, the nodes do not know the value of $k$. The problem is solved when ... |
Given a directed graph $G=(V,E)$ with $|V|=n$ vertices and some weight function $w\colon E\to \mathbb{R}$,
I also know that there are at most $\log\log n$ negative weight edges in $G$, and $G$ does not have any negative cycles.
Find minimum cost path from $s$ to $t$
My try so far:
I know that just running Bellman–Fo... |
Let $P$ be a YES-NO decision problem. Let $A$ be an algorithm for deciding on it such that it is correct with probability $4/5$, in both cases (YES an NO). Design an algorithm that is correct with probability at least $p$, in both cases (YES an NO).
This is my solution but I'm stuck at bounding the probability. Let be ... |
I'm having a hard time trying to build the PDA for this language:
$$L=\{a^nb^m: n,m \geq 1 \land m=4n+2\}$$
I don't know how many $a's$ should I push into the stack when reading $a$, and how many $a's$ should I pop out of the stack when reading $b$, and how to reach the final state. Can anyone help me with this? Thanks... |
Assuming I have a list L of lists. Each list in L has four entries [North, Ost, South, West] which represents the neighbours of a point i on a grid. If the entry is 0, the grid neighbour is not occupied by another point.
For example L[0] = [0,3,8,0].
This means that point 1 (which is represented by the first list in L)... |
I am trying to understand the meaning of this scheme, providing a sort of classification of sequential logic circuits. This taken from
https://www.electronics-tutorials.ws/sequential/seq_1.html
Does anybody understand what "pulse driven" stands for? I am 100% fine with "event driven" and "clock driven". I am missing t... |
I want to find 2-approximation algorithm for finding path of m messages sent from m computers to m different computers in a ring topology with n nodes.
I know about clockwise embedding, which takes hyperedges, which are basically the connection requests and makes path from the lowest numbered node to the highest in the... |
The $k$-Partition Problem is NP hard. I want to know if some slight modification of this problem makes it polynomially solvable.
Now consider the set $S=\{a_1,\ldots,a_n\}$ of IDENTICAL numbers/objects ($a_1=\ldots=a_n=1$) which needs to be split into $k$ subsets $S_1$, $S_2$, $\ldots$, $S_k$ such that the sums of the ... |
I have a rather straightforward question for this community (that I am not able to solve). Assume there is a probability of Tom having a bag of candy. If Tom has a bag, he says the truth 4/5 times and lies 1/5 times. If he does not have the bag, he is honest and says he does not. How do I devise an algorithm that would... |
Given a zero-indexed, unsorted array, $a$ of integers (can be positive, negative, or zero) of size $n$. A window of size $k~(k < n)$ is defined as a subarray $a[i...i+k]$ for every $0 \leq i \leq n - k - 1$. The problem is to find the minimum difference between two elements present in the same window, for every window.... |
The meaning of edges with zero weight in a weighted graph questions me for a long time, and I even asked a related question previously.
Yet, when I recently read here a question on real life example of graphs with negative weight edges I was amazed I never asked this one before:
Does anyone know a meaninfgul example of... |
I'm referring to a question in this book: Algorithms by Jeff Erickson, link:http://jeffe.cs.illinois.edu/teaching/algorithms/notes/J-approx.pdf, in particular, pg.21, Q11.
The author mentioned that finding the chromatic number $\chi(G)$ is np-hard, and ask to show that return any integer between $\chi(G)$ and $\chi(G) ... |
Consider this variant of set covering problem.
Input: a collection of sets $S = \{s_1, s_2, \ldots, s_n\}$ and a universal set $U$, in which $s_k \subseteq U$ for all $k$.
The problem is, divide $S$ into two subcollections $S'$ and $S''$ (i.e. $S' \cup S'' = S$, $S' \cap S'' = \emptyset$) to maximize $|U'| + |U''|$ wh... |
The steps involved in proving that a problem is NP-Complete are fairly straightforward to follow, it's the logic behind why the proof is valid that's really throwing me for a loop. Okay so an easy one: we are showing that 3SAT is NP-Complete. There are 2 things that must be shown. First we show that 3SAT is in NP and t... |
As Wikipedia states the time complexity of Integer Linear programming(ILP) is NP-hard, so this means integer multicommodity flow problem is also NP-hard?
|
i am currently struggling with a Linear temporal logic equation: $$\phi=FG( \lnot a\lor X \lnot a )$$
For my understanding, it means that starting at a certain point in the future, proposition a can never be reached again due to the definiton of "finally globally".
Now we have to transform it into an aquivalent equatio... |
I have some 3d point cloud I wish to cluster into some number of clusters.
I have the probability of two points being in the same cluster given as some function of their relative locations, with the probability being 1 for the same location, and 0 for infinite distance.
I would like some algorithm to cluster the cloud ... |
I am trying to determine some bounds for sample complexity. Suppose we have a bounded loss function $\ell$ and target function $f:\mathcal{X}\to\mathcal{Y}$. Hypothesis $h$ is learned, then the empirical risk is is the mean of the computed loss:
$$\hat{R}=\frac{1}{n}\sum_{i=1}^n\ell(h(x_i),y_i).$$
And the true risk is ... |
Will the language $\{w\in L_1\mid \exists v, wv\in L_2\}$ be regular if $L_1$ and $L_2$ regular languages?
|
Given a set $Y$ with whole number positive divisors of $N$, is there a combination of divisors that have a product equal to $N$?
Does Subset Product remain NP-hard when whole number divisors are only allowed and there are no multiplicities in $Y$?
|
While studying a book on algorithms, I came across a question that asked about essentially $d$-ary Huffman coding, where the codeword alphabet has $d$ symbols (the usual case has $d=2$, with symbols $0$ and $1$, ie, binary).
Adapting the usual Huffman coding algorithm for the $d$-ary case is simple enough, and things w... |
I know this is sort of a basic question, but I don't completely understand the following.
Let $A$ and $B$ be two problems. If I take one instance $a$ of $A$ and one instance $b$ of $B$, and show the following. Solving $a$ implies solving $b$, and solving $b$ implies solving $a$. Am I showing that $A$ reduces to $B$, $B... |
I recently have been reading a bunch about David Hilbert's famous 10th problem, and trying to understand its proof. I am currently in the process of reading through an explanation of the proof, given by one of the people involved in trying to solve the problem, Martin Davis, Ph. D. It is really well explained, but pret... |
After working through some examples of proving the non-regularity of languages I encountered this language
$$
L = \{(ab)^{i}a^{j} | i \geq j, i,j \in \mathbb{N}\}
$$
Where $a^{k}$ = a repeated k times. Is this language regular? I believe not since there are infinitely many strings $(01)^{i}$ with $i \geq j$, so a DFA o... |
Suppose that I want to know the number of the cycles of cpu clock that uses to run a specific code written with a specific programming language, like Python or others.
Can I do it?
I mean, do you have any access to count the CPU's clock cycles for your code technically?
Does this code run on any system (any minicompute... |
Given a directed, rooted tree with $n$ vertices, the height of a vertex $v$, $h[v]$ is the number of edges on the longest path from $v$ to some reachable leaf node. Give an efficient algorithm to find the following,
$
d[v] := \max\limits_{w \text{ is a sibling of $v$}} h[w] \qquad \forall v \in V.
$
Note: The algorithm... |
Let's say we have DPDA with acceptance by empty stack, w is accepted by this DPDA. Why can't wv be accepted? I know about the prefix property but i don't see where it's coming from. Can't we just continue moving after reading w when the stack is empty until we read the whole input and decide whether we accept the word ... |
My Question is, what is meant with smallest number N. Does it mean I should try every possible constellation of the n variables and put each one of them into the formula φ and then use 3Sat on that? Then it would be 2$^{n}$? Is that meant?
|
It is known that reachability of 2-counter machines is undecidable. As far as I know, it is semi-decidable though.
Now let's focus instead on the problem of deciding if a 2-counter machine has a computation which passes through the initial state infinitely often.
My understanding is that this problem is non-RE. Is this... |
Let $U$ be the set of elements and $S$ be the subset collections. There exists a tree $T$ that each node is corresponding to an element in $U$. And for every subset $s$ in $S$, $V(T) \bigcap s $ is a path of T.
And I want to find a minimum set $Z$, where $Z \subset S$, and $\forall u \in U, \exists z \in Z$ s.t $u \in ... |
Due to finite precision of number representations, we face situations like:
In: 0.1+0.1+0.1==0.3
Out: False
(on my machine, with Python 2.7 and Python 3 but this is not directly related to the language actually).
This is because there is just no exact representation of $0.1... |
Whenever an algorithm has polynomial complexity, but exponential over the encoding of the input, it is said to be pseudo-polynomial.
What about logarithmic complexity? Wouldn't be wrong to refer to such algorithms as pseudo-polynomial (as often happens)?
Shouldn't I instead refer to them as pseudo-logarithmic algorithm... |
If Turing Recognizability means a T.M. will either halt on input $w$ if $w$ is in the language, or run forever if $w$ is not in the language.
How can we know the language is Turing Recognizable if we run the T.M. on a $w$ not in the language and thus it never halts so we do not get to the next input.
|
Problem: I have two computational problems, $A$ and $B$. We know that $A \in \texttt{Psearch}$ and I want to prove that $A \leq_p B$ for all problems $B$.
Goal: It is my understanding that my goal is to prove that there is a polynomial time reduction $R$ from $A$ to $B$ given that $A \in \texttt{Psearch}$.
I know from ... |
The language given is $L = \{a^i b^j c^k\mid i+j \ge 2k\}$ for which I need to construct a simplest possible Context Free Grammar.
I tried understanding but I could only go as far as making sense of $i+ j = 2k$ but I am unable to come up with anything that caters for the condition where it it can be less than 2k.
|
I am a bit lost in the literature. Is it known whether there is a $o(n \log n)$ size boolean circuit family for the majority function?
|
Currently i am studying Kinetic Data Structure thesis by Julian Basch. I am feeling stuck in some points. Are there any other resources to understand it properly ??
Edit:- I am very new to this data structure. Are there any blogs or video tutorial to understand an introduction to the concept which is a bit more in de... |
I have exactly no knowledge of programming. I want to design/develop/etc a video game I've been wanting to do and part of this is a crafting system similar to what Skyrim has.
Let's say we are working on making an edible food or drink. I want the character to be able to mix ANY ingredient to create a food or drink or e... |
Instance: A boolean formula f(x1, . . . , xn) in 3CNF form, with m clauses labelled C1, . . . , Cm.
Is there an assignment to x1, . . . , xn such that every third clause is False and all other clauses are True? That is, Ci is False for all i ≡ 0 (mod 3), and Ci is True for all i ≡ 1 or 2 (mod 3).
how do I prove that th... |
if A be an NP-complete problem, and if B be an NP-hard problem. If A is polynomial
time solvable then is B is polynomial time solvable?
on the contrary, if A be an NP-complete problem, and B be an NP-hard problem. If A is polynomial time solvable then is B is polynomial time solvable?
My intuition is, (which may be... |
I have recently been reading up on TOC, and had this thought, which does not seem to be answered explicitly anywhere.
They way I have understood it, a system is Turing complete if it can simulate any Turing machine. But Turing machines are limited to their instructions. Does that mean not every TM is actually Turing co... |
Is it true that if an edge is included in at least two different minimum spanning tree, then that particular edge is included in all minimum spanning tree? If so why?
|
I wrote an algorithm based on the Warnsdorff's rule to solve the knight's tour problem, where you need to create a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once.
I noticed something strange, though: when the size of the chessboard is odd, about $50/60\%$ of the sta... |
Given a graph G I want to find the maximum planar subgraph which is a grid graph.
(Because the nodes of this subgraph represent points on a grid).
Is there any library in python for finding the maximum planar subgraph?
Is there some way how to implement these constraints for the grid graph?
Edit: As I understood I am l... |
In Wikipedia article on "Sum Type" it is stated that sum type Curry-Howard correspondence is intuitionistic logical disjoint.
But sum type definition states that it is
a data structure used to hold a value that could take on several different, but fixed, types. Only one of the types can be in use at any one time, and ... |
The general boolean satisfiability problem (SAT) is NP-complete, and thus can't be solved in polynomial time (assuming $P \neq NP$). But the special case of 2-SAT is in P, and can be solved in linear time. 2-SAT formulas consist of the conjunction of clauses with two elements, e.g.,
$$ (a \lor b) \land (b \lor \lnot c)... |
The group theory of $S_n$ shows that all permutations of $n$ objects can be generated from the $n$-cycle $a:=(1 2 3 .. n)$ and the transposition $b:=(1 2)$. (See Theorem 2.5 at https://kconrad.math.uconn.edu/blurbs/grouptheory/genset.pdf)
One can use this fact to label and enumerate permutations. For example, this sh... |
I was analyzing various classic dynamic programming problems:
1. Cut rod problem
Definition: Given a rod of length n inches and a table of prices pi of selling rods of different lengths i = 1, 2, …, n, determine the maximum revenue rn obtainable by cutting up the rod and selling the pieces.
Recursive top down naive im... |
For an algorithm homework, I'm asked to give a solution for a knapsack problem. I have in input a list of products. A product is assigned a cost and a number of calories. So I have two sets, one of money and one of kcal. My goal is to choose products that give an equal sum of money and kcal.
for example if I have this ... |
Suppose we have a composition of functions $F(x)=f_n \circ f_{n-1} \circ \ldots \circ f_1 \circ x$, where $f_i: \mathbb{R}^{d_{i-1}}\to \mathbb{R}^{d_i}$
The Jacobian of $F$, has shape $d_n \times d_0$ and can be written as a product of Jacobians of $f_i$'s. We can assume these Jacobians are provided, then the minimum ... |
I do not know how to solve the following problem:
Given a directed graph $G$ with a two nodes $s,t \in V(G)$ find a cut $(S,T)$ with $s \in S$ and $t \in T$ such that $(S,T)$ has the minimum number of edges with the "reverse edges", i.e. the edges in $(T,S)$, also counted.
I realise that, when the reverse edges are not... |
My professor discussed the following Turing machine M' on input (,x):
Generate number n
Run M on X, for n steps
If M stops, accept
I don't understand No.3
If we are running M on input X for final number of steps then there is no way for M not to stop... so why he wrote if M stops?
|
I am wondering if the following are decidable or undecidable and why. L is a CFL and R is a regular language. How does the complement of the context-free language change the decidability of the intersection?
∩=∅ and $\bar{}$∩=∅
This is what I think but I am not sure so any help is appreciated.
For , I think this is dec... |
Cormen's Algorithms 3rd edition Exercise 26.2-13 Page 731:
Suppose that you wish to find, among all minimum cuts in a flow
network G with integral capacities, one that contains the smallest
number of edges. Show how to modify the capacities of G to create a
new flow network $G_0$ in which any minimum cut in $G_0$ is a... |
I understand that one can use dovetailing to recursively enumerate the domain of a UTM.
However, I am trying to recursively enumerate the domain of all possible UTM.
My starting point was to use a similar algorithm to dovetailing, but then I realize that I do not know the set of all universal Turing machines.
Proving t... |
I am currently new and learning about loop invariants. I have come across this pseudocode where the goal is to shift the elements inside an array with N size in a clockwise direction by K steps.
Pseudocode:
Is at every iteration, new_index is in [0,N) a good loop invariant? I am really confused about how to pick a g... |
In Chapter 8 Question 5 of Kleinberg and Tardos, the problem is as follows:
Consider a set $A = \{a_1, \ldots , a_n\}$ and a collection $B_1, B_2, \ldots , B_m$ of subsets of $A$ (i.e., $B_i \subseteq A$ for each $i$).
We say that a set $H \subseteq A$ is a hitting set for the collection $B_1, B_2, \ldots , B_m$ if $H... |
I would like to define a Turing machine as follows.
Let Z be an alphabet, and let L be the set of all sentences of this alphabet. For instance, Z={0,1}, then L is the set of all binary sentences.
A Turing machine is a function which takes a (binary) input and produces a (binary) output:
$$
TM: L \to L
$$
However, it is... |
I'm working on a project over Bin packing being NP complete, I understand the full reasoning behind it (algorithmically), but I need to know what's a proper explanation for the Bin packing being NP complete (the computational way "theory of computation") not algortihmically.
|
In answering this question, I was looking for references (textbooks, papers, or implementations) which represent a graph using a set (e.g. hashtable) for the adjacent vertices, rather than a list. That is, the graph is a map from vertex labels to sets of adjacent vertices:
graph: Map<V, Set<V>>
In fact, I thought that... |
Can you share examples of comparison-based algorithms used in practice that are not a sort or a search over lists? Heapify is an example of a comparison-based algorithm that is neither a sort nor a search. Heapify is of course part of Heapsort and still operates over lists. Are there other examples of comparison-based ... |
I am looking for combinatorial optimization problems which have very deep local minima.
So I am searching for the global optimum (which is not unique).
Are there some games or problems you know which have this behavior? A problem without a reward function for each step.
|
I'm trying to convert 3.2 into IEEE 754 format. We find that $(3)_2=11$ and we also find that
$0.2*2=0.4 -0$
$0.4*2=0.8 -0$
$0.8*2=1.6 -1$
$0.6*2=1.2 -1$
and this cycle repeats so $.2=00110011...$
finally we find $11.00110011...$
we normalize $1.1001001...*2^{1}$
and calculate the exponent $127+1=128=10000000$
we find ... |
As I know any local DHT keeps only some of nodes - if the network is small/very small then all nodes, otherwise only some of them (nearest?).
So, when I checked different Golang implementations of DHT (Bittorrent, Node Discovery Protocol and similar) - some of them have functions listing nodes, but as I understand, jus... |
Problem:
Let $U = \{0,1,2,3,4,5\}$ be a universe of keys and $T = \{0,1,2\}$ we observe follwing 5 hash functions which map from $U$ to $T$ :
$$h_1(x) = (x+1) \mod{3} \hspace{5mm} h_2(x) = (x+2) \mod{3} \hspace{5mm} h_3(x) = x \mod{2} \\ h_4(0) = h_4(5) = 2 \hspace{5mm} h_4(1) = h_4(2) = 1 \hspace{5mm} h_4(3) = h_4(4) ... |
The Wikipedia article on Equitable coloring states that
A polynomial time algorithm is known for equitable coloring of split
graphs.
The referred paper also seems to achive the proposed polynomial time, as far as my understanding goes.
One the other hand some other published paper states the following:
EQUITABLE COL... |
Even if the hamiltonian path problem is NP-hard there exist heuristics which return a correct path for many instances in linear time. In particular one of the main rules is always choosing the adjacent vertex with the least degree; there are also strategies to manage tiebreaks but I think they are even more difficult t... |
I'm trying to solve this exercise that asks to determine whether a language is regular or not.
Following the flow of the course I figured that the exercise is a test for Pumping Lemma application. But for this particular language I'm having a problem understanding where I'm at fault.
The language given is $L_3 = \{1^{2... |
Both the Topological Sorting algorithm and the algorithm to find Strongly Connected Components build a stack whose top is the last visited vertex.
I find difficult to find an explaination because Topological Sorting algorithm is applied on DAGs, whereas the other one can be applied on any type of graph, especially cycl... |
A few months ago I learned about the magic that allows radix sort to run in O(n) time and space. Most tutorials on radix sort say it is useful for very large collections where the key values fall inside a defined range. They then go on to say that it's really only reasonable when sorting unsigned integers. The reasons ... |
How can I define a valid $\hat{C}$ for a job assignment problem where I have $n$ jobs and always $3$ employees, where the cost of an employee doing a job is defined as $C_{ij}$ and no employee can do more than $\lceil \frac{n}{3} \rceil$.
I know that if I had $n$ employees and $n$ jobs then I can do something like:
$\h... |
Is it possible to use pattern matching algorithms such as FP-Trees and others on data that resides in multiple machines?
Basically when doing pattern matching do you have to have all your data on the same disk?
|
I'm working on a project where I need to optimize both the locations and orientations of a collection of irregular 3D objects in a given simulation box.
To optimize the locations and orientations means the irregular 3D objects in the simulation box must not overlap, and the resulting packing configuration of the object... |
I was learning LALR parsers from the dragon book (Compilers: Principles, Techniques, and Tools by Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman) and I came across the example on page 267. I'll try my best to describe my question without needing the actual book for reference.
The book states that:
I4 ... |
Let
$$L_{\text{PSPACE}}=\{\langle M\rangle : M \text{ is a TM using a polyspace amount of memory}\}$$
Is $L_{\text{PSPACE}}$ decidable?
I don't think we can use Rice's Theorem because this doesn't seem to be a semantic property of TMs. I also don't see any reduction from the HALT problem, or other known undecidable l... |
Assuming we have two dense matrices $A \in \mathbb{R}^{m\times m}, B \in \mathbb{R}^{m\times n}$, is there a smart way to compute all entries of the series $A^1 B, A^2 B, A^3 B, \dots, A^k B$ up to some k? In general the matrices are arbitrary, but I'd be willing to accept some not-super-restrictive structure if that w... |
Given an array of $N$ elements, $A$, and a number $K$. ($1 \leq K \leq N$) .
Partition the given array into $K$ subsets (they must cover all the elements but can be noncontiguous too). The maximum subset sum achievable out of $K$ partitions formed, must be the minimum possible.
Find that possible subset sum.
For exampl... |
In my theoretical computer science class we learned about FSMs/lexical analysis/parsing. However, my teacher focused solely on the table-driven approach to the process for simplicity (I think, anyway), where the table is a 2D array with the row being a character and each column being a DFA state transition. The table t... |
Assume to have query access to the values $p(x)$, and $q(x)$ of two probability distributions over n elements $x \in X$, $|X|=n$.
That is, for a given $x\in X$ we pay constant time $O(1)$ to perform a query to $p$ or $q$.
What is the fastest randomized algorithm for estimating the trace distance between $p$ and $q$? Fo... |
I have $n$ sets, each of which overlaps heavily with the other sets, and I want the union of all of them. The obvious solution is to take the union of each set, one by one, which results in $O(n^2)$ running time, but is there a better solution?
Clarification from the comments: Assuming all sets have $n$ elements, so $n... |
In a textbook on systems and networks, it states "Stated broadly, a program tends to access a relatively small region of memory irrespective of its actual memory footprint in any given interval of time"
Was there some kind of meta-analysis done on multiple programs to come to this conclusion?
|
Let's say we have a function shift(array[], int s) which swaps the position of array[s] to array[0] and shifts all other elements to the right. For example:
array = {1,2,3,4,5,6} --> shift(array, 3) --> array = {4,1,2,3,5,6}
If you were to sort an array consisting of numbers 1..n using only the function shift, what wou... |
I have an excercise where I have to translate verbally formulated statements into CTL formulas. I have particularly trouble with this one:
On every path q is true at least once and p was true sometime before, after
no longer.
My attempt is the following: $AF q \land (EF p) AU q$
This is obvously wrong. The first part... |
I still am confused whether I am asking the right question but here goes
Consider a X bit processor. It can address theoretically a main memory of 2^x bytes(assuming byte addressable). Now consider an operating system which supports virtual memory. This allows it to execute programs much larger than the actual main mem... |
Consider the case where you have 3-dimensional space. You want to know whether at a given point (x,y,z) in space, does anything exist(just like checking if in a 3D array at (x,y,z) is there a 1 or 0). What would be the most efficient way to perform this kind of operation keeping hardware limits in consideration(like if... |
What would be a good choice for a key to sort a complex number $(a+ib)$ or any $n$-dimensional data for that matter. Is using the magnitude of that vector a good choice rather than using any one of the dimensions, or is there any other metric which would suit this?
This was asked to me in an interview (it went like "h... |
In my Lecture we came across something of importance for the Church-Turing-Thesis and i noticed one particular function, which confused me.
Function:
Let $bin(x)$ be the injective binary extension without leading zeros. It is not surjective because of the extension without leading zeros.
$$cod := \{0,1\}^* \to \mathbb... |
I wanted to parse strings to AST data structures instead of CSTs - which introduce a lot of intermediate nodes like terminal that might not be needed. I am not sure if one first creates a CST and then trims the CST somehow to generate an AST. This seems that should be a well solved problem so I didn't want to be adhoc ... |
I'm writing a closestSubset(s,A) function that takes an integer s and an array of positive integers A and returns an array consisting of elements of A which add up to s. If there is no subset that adds up to s, I want the function to instead return the subset which adds up to the value closest to s.
For example:
if A ... |
Apparently, each stage of the MIPS processor pipeline takes one CPU cycle. According to this, a memory write can take more than one cycle:
1 cycle to read a register 4 cycles to reach to L1 cache 10 cycles to
reach L2 cache 75 cycles to reach L3 cache and hundreds of cycles to
reach main memory.
How then can the MEM... |
I know that the fastest known algorithm for multiplying two $m \times m$ matrices runs in time $m^{\omega}$, where currently we have $\omega = 2.3728596$ due to Virginia Williams's latest result
(see here and here). But I'm not sure how this translates to matrices with other dimensions.
In terms of $\omega$, $l$, $m$, ... |
I’m a CS senior with and Individual Study period this coming semester, and I’ve decided I’d like to learn more about Programming Language Concepts. More specifically, different programming paradigms, like Functional and Logic programming.
Not sure how most universities handle ISs but I’m to essentially write a syllabus... |
(Source: https://leetcode.com/problems/jump-game-ii/)
Consider the following problem: Given an array of non-negative integers nums, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the mi... |
For this question suppose Alphabet for input is {0,1}.
Given:
L={<M> | M stops on every input after maximum 1000 steps}
My professor claimed that there is a finite different Turing machines (M) in L, But why is that?
One of the students mentioned something about finite number of snapshots (1001) But I don't agree or u... |
I know that an inverted index is a mapping from words -> documents. In the database I'm using, I'm able to do a search for apple*, and it will return apple banana, banana apple banana, and applepie. The one that confuses me is applepie. I assumed the inverted index would only have the word applepie in the mapping from ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.