instruction stringlengths 35 29.1k |
|---|
How can we manually read and interpret packets properly without using wireshark?
Now from the Ethernet header I know that the Destination MAC Address should be at the 5th byte (after converting bits/bytes). So from this data, I thought it would be 4a onwards. However, in reality it's 00:17:f2:d0:4c:82.
Same goes for th... |
Would a sparse NP-Complete language imply L = NP?
Update: Thanks to Noah Schweber for clear and comprehensive answer. Having thought about it more, one would need a logspace reduction from NP-complete to L-complete for NP=L. [4] below does not directly address this.
Here is my proof attempt:
[1] Assume there exists a (... |
BACKGROUND
I am writing a grammar and parser for a domain-specific language. There is a specific form of expression that, while simple, is giving me headaches.
Given terminals:
"a": KEYWORD
"b": INTVAL
"c": DECVAL
"d": STRVAL
Given rules:
"E": VALUE <- INTVAL
"F": VALUE <- DECVAL
"G": VALUE <- STRVAL
"H": VALUES <- ... |
How do you find a sub-digraph in a digraph such that the in degree and out degree of each vertex is 1. My professor told in the class that an algorithm can be build for it using bipartite matching but I have not able to do so. I am just looking for hints on how to proceed because I am kind of stuck on where to start.
|
I want to translate a java switch-case statement to intermediate representation of the three address code form. Three address code or TAC is a form of intermediate representation where each instruction contains at most three addresses and one operator. An address is a name such as x (stored in the symbol table), compil... |
I created an algorithm to convert a hexadecimal digit into an alphanumeric string, but now I want to create the inverse of this algorithm. The algorithm, in short, is as follows:
hexadecimal digit % length of alphanumeric character array = index in alphanumeric character array
For example, the algorithm takes hex dig... |
I am a CS undergrad and a huge enthusiast of pure math. I have been doing competitive programming and proofs for a while. My ambition is to become an academic in theoretical computer science. The problem I face, like any math enthusiast, is that academia pathway jobs are not reliable in terms of funding. So, I thought ... |
I think this is a basic topic in complexity, but I would like to ask how to understand co-$\mathcal{L}$ where $\mathcal{L}$ is a class of languages. From the definition of my textbook, $$co-\mathcal{L} = \{ \overline{L} \mid L \in \mathcal{L} \}$$
and where $\overline{L}$ is the complement. From what I read in an earl... |
so this is more or less a shot in the dark as I am feeling stuck. Maybe some of you have an idea which helps.
Here is the problem description (pseudo formal):
I want to have a structure $T = \{ \hat{x_1}, \hat{x_2}, ... \}$ with $\hat{x_i} = (p_i, k_i, v_{k_i})$.
$p_i \in \mathbb{N}$ can be interpreted as an associated... |
I'm given an array $A$ = ($a_1, a_2, \cdots a_n$), where n is uneven. For an element $a_i$ we denote its position in the array with $p(a_i)$. This element would be an $ε$-approximate median of the array, if after we sort it, the following inequality holds:
$$\frac12 ((1 - ε) × n) < p(a_i) \leqslant \frac12 ((1 + ε) × ... |
The following question is taken from leetcode: 1278. Palindrome Partitioning III
You are given a string $s$ containing lowercase letters and an integer $k$. You need to:
First, change some characters of $s$ to other lowercase English letters.
Then, divide $s$ into $k$ non-empty disjoint substrings such that each subs... |
I have the grammar $S = aSbS|bSaS|\varepsilon$. When I was first looking at the problem I thought it was unambiguous. When I looked at the answer it said that it was ambiguous. The solution it gave was:
$S \rightarrow aSbS \rightarrow a\varepsilon bS \rightarrow a\varepsilon b\varepsilon \rightarrow ab$
$S \rightarrow ... |
def find_perms(s):
"""
Finds permutations of the given string.
>>> find_perms("abc")
['cab', 'acb', 'abc', 'cba', 'bca', 'bac']
"""
if len(s) == 1:
return [s]
elif len(s) == 2:
return [s[0]+s[1], s[1]+s[0]]
else:
perm = find_perms(s[0:len(s)-1])
last_char ... |
Consider an array of sets. As you know a set must not have multiple elements. I need a data structure to handle following queries:
Insert element x to all sets on interval [ L, R ].
Erase element x from all sets on interval [ L, R ].
Query the sum of sizes of sets on interval [ L, R ] of the array.
Is there any data ... |
Suppose i have a quadratic equation like this, 2x^2 - 4x - 5 = 0, the solution here is x1=2.87 and x2=-0.87. I tried this python snippet to find the non-negative solution(2.87) by setting range 0 to 1000 and it worked but how to find the negative one too?. I tried the range -1000 to 0, but no luck!
def solve():
low... |
I am working on a simple quantum circuit identity. I proved it on paper with the tensor product, but i'm having trouble showing that with qiskit. I know I need to measure them somehow but i don't know how.
Can someone help? :)
|
Related to my answer on this question, I'm not sure of a detail.
Assume you have a Turing Machine which simulates all possible Turing Machines all at once (meaning it does not "page" its data, i.e. it can't erase data from one "process" to write data from another "process"; it must keep all "processes" "in memory" at t... |
I have solved that the recurrence of running time of the algorithm given as
$$
T(n) = \begin{cases} \Theta(1) & \text{if n=1} \\ T(n-1)+\Theta(n) & \text{otherwise} \end{cases}
$$
So the question is that solve the recurrence that I have solved above.
So this is my answer.
Case 1
Show that $T(n) = \Theta(n)$
Guess $T(n)... |
I understand how monadic computation works, I am just wondering where does the name come from. I cannot relate the thing that the bind operator actually does (i.e. unbox the monadic value, and then apply a function to produce another monadic value) and the name bind (which, to me, means associate two things together).
... |
How to answer on many requests by type:
Count amount simple paths passing through chosen edge in an acyclic undirected graph using dynamic programming?
|
Write a parallel algorithm which runs in $\Theta(n)$ time and transposes an $n \times n$ matrix on the $2D$ mesh SIMD Model with wraparound connections. Processing element $P(i, j)$ has local variables $A(i, j)$ and $T(i, j)$, where $1 \leq i, j \leq n$. When the algorithm begins execution $A(i, j) = a(i, j)$. After e... |
Suppose I want a function like
f: ((A, B) -> C) -> A -> B -> C
A statement I've often seen made is that f has just one implementation, namely the 'curry function', i.e. g => a => b => g(a, b)
Taken at face value this doesn't seem to actually be true, I can always define f as acting differently from this in special case... |
I think the intuition is to disprove this by counter example, but what are 2 specific well known problems I can use as counter example?
|
I'm having some difficulty understanding ip addresses. Let's say:
Question Info:
private subnet 192.168.0.0/24
IP addresses 212.201.49.1-5
Now, a host 192.168.0.2:1234 retrieves a web page from the web server at 42.35.12.33.
Then, host 192.168.0.5:1234 retrieves a web page from the web server at 100.12.45.11
Answer Par... |
I know that 3SAT is in NP and 2SAT is in P. And 2SAT can reduce to 3SAT just says 3SAT is strictly harder than 2SAT, so I don't think this proves P = NP, but it doesn't seem to disprove it either.
|
Im trying to find an algorithm which returns array elements that a[i] > 2a[j] with i < j in O(nlogn). I can think how to implement this algorithm using double for but i cant implement it in O(nlogn). Does anyone have an idea about how to implement that?
|
From some of the texts I read, one definition of NP is: "An equivalent definition of NP is the set of decision problems solvable in polynomial time by a non-deterministic Turing machine." and that we have the following, where $n$ is the length of the input:
$$
\text{NP}=\bigcup \text{NTIME}(n^k)
$$
This means that one ... |
Can someone please explain to me why this function runs in O($n^2$) rather than O($n^3$). I feel like since that for loop runs in O($n^2$) and f() is recursively called around n times, that it should end up being $n\cdot n^2$ for an overall O($n^3$).
f(n) {
if (n == 0) {
return 0
}
int result = 0
... |
Intuitively if A can reduce to B, and B is NP-Hard, A might be NP Hard but maybe not. If there is a way to solve A that does not involve reducing to B, it might be faster.
How do I formally disprove this statement using a counter example or some well known algorithms, or using some other technique?
|
I am looking for an optimal solution of an interval scheduling variant.
Basically, given n tasks with the start time Si and end time Ei, select EXACTLY two tasks whose execution periods are maximum and do not over lap (Equal start/end time counts as overlapping).
So if there are these task [9-14], [7-13],[1,4],[2-5],[2... |
To the best of my knowledge, the best algorithm for the minimum s-t cut in a weighted digraph is the Goldberg push-relabel algorithm with $O(n^{2}\sqrt{m})$ time complexity. I'm interested in solving this problem as a separation sub-problem inside a branch and cut algorithm, so I don't always need the optimal solution.... |
We have $h_1(n)$ and $h_2(n)$ which are both admissible heuristics. We know that $h_1(n) < h_2(n)$ for every state $n$ in a search problem.
Now we are given two heuristics $h_3(n)=\frac{h_1(n)}{1+h_2(n)}$ and $h_4(n)=\frac{h_2(n)}{1+h1(n)}$ and we want to prove $h_3(n)$ and $h_4(n)$ are both admissible.
|
The class of function $\mathcal{F}$ is PAC-learnable if there exists an algorithm $A$ such that for any distribution $D$, any unknown function $f$ and any $\epsilon, \delta$ it holds that there exists $m$ such that on an input of $m$ i.i.d samples $(x, f(x))$ where $x\sim D$, $A$ returns, with probability larger than $... |
Given an alphabet $\Sigma$, let $c=|\Sigma|$. Can a set of languages $\{L_k\}$ be created, such that any DFA for $L_k$ has $\Omega(c^k)$ states and a NFA for $L_k$ exists with $O(k)$ states?
I'm having trouble creating an $L_k$ such that any DFA for it has $\Omega(c^k)$ states. There are constructions that require $\... |
I have a following graph-based problem:
Input: positive integers K and L, undirected graph G
I have to choose K vertices from this graph
In the path between each pair of chosen K vertices there has to be at least L vertices, i. e. there has to be a "space between" each two of chosen vertices made of at least L v... |
I am trying to solve a maximization problem using the Tabu search algorithm but there is no relevant code available on the internet. Any kind of sample code is highly appreciable.
My function is F(x)= x^3-60.x^2+90.x, 0 < x < 31
|
I am reading the following paper:
MPCircuits: Optimized Circuit Generation for Secure Multi-Party Computation
Paper Link
I have following question:
We have two groups shown in the circuit. Why we call it a multi-party circuit?
Paper provides a comparison of its multi-part technique with the old 2 part based technique:
... |
The unrestricted grammars characterize the recursively enumerable languages. This is the same as saying that for every unrestricted grammar G there exists some Turing machine capable of recognizing L(G) and vice versa.
Context: Grammars are Turing-complete. Therefore complexity classes like NL have equivalences in gr... |
I have an instance of the stable marriage problem in which the first side $S_1$ has $n_1$ agents and the second side $S_2$ has $n_2$ agents with $n_2$ is very big in comparison to $n_1$. In addition, the agents of $S_2$ have the same preference list. The stability constraints can be modelled as follows:
$ 1 \leq \sum\l... |
I came across this problem online and found no solutions or insight. The problem is stated as:
Given a map as a square, and a set of locations on the map, users are able to select a rectangle on the map and all of the locations on the map are returned
How would you preprocess the map data so that the find operation ... |
I have a problem statement where i am having many inputs lets say A,B,C,D.... and this inputs can take any real value(e.g A-a1,a2,a3, B-b1,b2). Now, i have file which will be have record of the all the inputs and there values at given point of time. I also know what should be the specific sequence for example A-a1,B-b1... |
I want to create a regular expression for the language:
$L=\{w \in \{0,1\}\mid w \text{ does not contain 00 as a substring}\}.$
I've tried various things, but I can't seem to get the correct regular expression.
|
We have an array of numbers and we are supposed to do the following queries on it:
Add number x to all elements on the subarray with indices [ L, R ] of the array.
Query for number of elements less than number x of the whole array.
Note that x is given in each query and is not fixed.
I have a solution with time compl... |
Many references say that the large constant term is hidden in the calculation of the time complexity of the Strassen algorithm.
I want to know how the huge constant term is constructed or how it is calculated mathematically. (assuming when n matrices are given)
You can add more matrix constraints to help with the solut... |
Given a grammar where every rule has the form $X \to YZ$, $XY \to Z$ or $X \to a$ where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
What complexity class does this correspond to?
Related questions:
What complexity c... |
I want such data-structure, which can:
add element at the end of the array in $O(log (n))$.
find out the minimum value in the sub-segment in $O(1)$
|
Let $G$ be a connected weighted undirected graph. Let $T$ be a minimum spanning tree (MST) of $G$. Consider removing an edge $e=(a,b)$ from $T$, which will give two subtrees $T_a$ and $T_b$, where $Ta$ contains the vertex $a$ and $T_b$ contains the vertex $b$. Now consider the subgraph of $G$, $G_a$, which contains the... |
I'm searching a data structure that supports O(1) concurrent insertions (thread number is known in advance) and iteration over its elements (insertion order doesn't need to be preserved).
While one thread is iterating over the elements there won't be any insertions.
So basically I'm looking for a concurrent dynamic arr... |
Is it a good idea to store a pointer to the parent node in a binary search rather than to find the parent node several times?
struct BSTNode
{
Node* leftChild;
Node* rightChild;
Node* parent; //nullptr for root
int data;
};
or
struct BSTNode
{
Node* leftChild;
Node* rightChild;
int data... |
This is my first question here!
If I have a non-planar graph where every vertex connects to 3 other vertices, and where the edges are allowed to intersect, how do I find the boundary of the graph?
For example in the below graph, the pink line shows the boundary of the graph which needs to be found. The boundary should ... |
Suppose we have a weighted undirected graph $G$ and a minimum spanning tree $T$
Let $G2$ be a new graph by increasing the weight of one edge $e = (a,b)$ that is part of $T$.
I'm using a common algorithm to update $T$ so we don't have to find a mst of $G_2$ from scratch. The algorithm is to first take out $e$ from $T$,... |
I would like to encode a binary tree where every node has either 0 or 2 kids into a binary word.
I was thinking about marking every left edge with a "0" and every right edge with a "1"
and then use every path from root to a leaf concatenated to encode the tree, but I'm not sure if this results in a unique code for ev... |
Let $ n∈N $ . Construct a circuit with $ C_n(x_1,\dots,x_n) $ with $ 2^{2^n} $ outputs $ y_1,\dots,y_{2^{2^n}} $ which computes all
distinct boolean functions $ f_i:\{0,1\}^n→\{0,1\}$ such that $ y_i $ is the
output of $ f_i $ and satisfying $ Size(C_n)\in O(2^{2^n}) $
Remark: The circuit is in a model of fan-in ... |
I'm interested in creating a graphs whose vertices are strings, and whose edges represent the relation of having an edit distance of 1 under a given string metric.
An obvious approach is to make all $\frac{n^2-n}{2}$ comparisons among the $n$ vertices, giving us $O(n^2)$ time complexity.
Excluding parallelizing the com... |
Given a grammar where (every rule has the form $X \to YZ$, $XY \to Z$ or $X \to a$), (($X \to YZ$) implies ($X \to ZY$)) and (($XY \to Z$) implies ($YX \to Z$)) where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
What... |
Given a grammar where every rule has the form $X \to YZ$, $XY \to Z$, $X \to a$, or $X \to \epsilon$ where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
(Thanks Yuval Filmus for pointing out this characterization - se... |
I was going through the classic text "Introduction to Automata Theory, Languages, and Computation"
by Jeffrey Ullman,John Hopcroft and Rajeev Motwani, where I came across the simulation of MULTI-TAPE turing machine using SINGLE-TAPE turing machine as follows.
Before the simulation the MULTI-TAPE turing machine is defin... |
I don't know this is off-topic (if not, someone can direct me to the proper Stack), but here goes: Let's say there is some algorithm $T$ that can find the integer roots of any arbitrary real-valued continuous univariate function $f(x)$. For any value of $x$, $f$ can be computed efficiently ($O(n^k)$, where $k$ is some ... |
I'm trying to implement graph power calculation using BFS. According to Wikipedia, BFS with depth limit k will suffice (I'm using adjacency list representation, my graphs are sparse, so adjacency matrix power is not optimal).
Complexity of BFS is O(V+E), running it for every vertex is trivially O(V*(V+E)). I also hav... |
Consider we need to solve the Matrix chain multiplication using dynamic programming for this problem :
The table for min. cost is shown below :
Edit : Reference https://www.radford.edu/~nokie/classes/360/dp-matrix-parens.html
The table for Optimal locations for parentheses:
I know how to construct these tables but ... |
I am wondering if we had a large array to sort (let's say 1,048,576 random integers), chosen because it is a perfect power of 2, if we can just keep dividing those blocks into smaller and smaller half size blocks, how would someone know (on a particular computer using a particular language and complier) what the ideal ... |
Is it possible that using the Machine Learning classification model we can classify/predict the LOCATION/ORIENTATION of the lot number and expiration date on different vials label?
If yes, possible approaches.
Update: So far what I have observed is with EAST model
https://arxiv.org/abs/1704.03155
one can locate text i... |
I have ran into a wall with this question in the exercise my teacher gave me, is there any actual connetion between the Von Neumann architecture and imperative programming ?
I have tried googling and finding questions similar to this, but I couldn't find anything, and the one question that I have found actually said th... |
I am trying to write a compiler that converts a simple imperative language to SSA form, but I am having trouble with loops. As an example, I have some code that looks like:
fun count() {
i = 0;
while(i < 10) {
x = i + 1
i = x;
}
return i;
}
I then convert it to a control flow graph that... |
In 2-D dynamic programming problems like Edit Distance and binary knapsack, there can be multiple optimal solutions. By tracing back from the last element in the matrix one could trace out all the possible solutions.
Here's the question: How to count the number of unique optimal solutions without backtracking? Is it e... |
How do I convert this PDA to CFG?
I am currently stuck with this, any help would be appreciated, thank you in advance!
|
Consider the following question
There are K magical pens (numbered 1 through K). You are given strings P1,P2,…,PK (each of which consists of characters from 'a', 'b', …, 't') ; for each valid i, the i-th pen can only write letters from the string Pi
.
You want to write a word S
of length N. All the characters of S are... |
Assume A is an m sized array containing n ($m \ge n$) natural numbers (excluding $0$), sorted on the left of it.
All remaining cells on right are filled with zeros.
For example, $m=10, n=4$:
$$A = \{5,7,11,24,0,0,0,0,0,0\}$$
How can I find the index of a natural number x in A with $O(\log \boldsymbol{n})$ complexity?
E... |
Is there a language A that cannot be polynomially reduced to by some language B? Or is it always possible to reduce a language B to A?
|
In my code i want to solve the Fermi-Dirac-Integral numerically. This can be achieved with a Polylogarithm.
Actually I'm coding in C#, so my function to calculate this polylogarithm looks like that:
public double PolyLog(double s, double z)
{
double sum = 0;
for (int k = 0; k < 1e5; k++)
sum += Math.Pow... |
Show that there are at most $\lceil n/2^{h+1}\rceil$ nodes of height $h$ in any $n$-element binary heap.
How can I show this? Or, how can I prove this?
|
Prior to ASCII existing, we already had at least four number systems, namely
Binary
Decimal
Octal
Hexadecimal
So what were the needs that lead to the implementation of ASCII codes? Why was this code chosen, from a computer architecture perspective?
I have searched online, but I haven't found a satisfactory answer.... |
People in theoretical computer science stack exchange advises me to ask this question here. I ask the same problem in https://cstheory.stackexchange.com/questions/46668/examples-for-derandomization-via-small-sample-spaces and if you are interested in answers there, you can go to see it.
I read the book the Probabilisti... |
In many algorithms, it's easy to understand how the algorithm is executed, but as for why it works well and how it can work, it's not very easy to see, sometimes, authors construct trees or graphs to put things analysed in them and use those structures to describe the property of the research object and prove some prop... |
Given a polynomial circuit consisting of only $AND$ and $OR$ gates. Is it true that any such circuit is easily parallelizable i.e. it belongs to the complexity class $NC$?
I think this is the case but I can't find a source confirming it.
|
Focusing on the 2D plane:
Lawson's Flip Algorithm works in worst-case $O(n^2)$ flips. I have seen it mentioned that (other?) flip-based algorithms work in expected $O(nlogn)$ time for two dimensions. What is a simple example of an algorithm like this (perhaps with proof of complexity)? How would this be found?
Edit: If... |
Is it possible to convert any problem in P to any other problem in P in polynomial time?
|
Given two ellipsoids $\mathcal{E}_1 = \{ X | X^T A_1 X + 2B_1^T X + C_1 \leq 0\}$ and $\mathcal{E}_2 = \{ X | X^T A_2 X + 2 B_2^T X + C_2 \leq 0\}$ both non-empty, it is possible to test if $\mathcal{E}_1 \subseteq \mathcal{E}_2$. Indeed, by the use of the so called S-procedure, $\mathcal{E}_1 \subseteq \mathcal{E}_2$ ... |
I am studying Computer Architecture,
and am a bit confused about the difference between device descriptors and device handlers in operating systems. Am I correct in saying that a device handler is actually a device driver?
What confuse me is that while the terms
device handler and device handler appear in the course s... |
Suppose we have a complete graph, with say 100 nodes. We divide the nodes in the graph into groups, for example 10 nodes in each group, identified by color. We want to obtain a minimum spanning tree under the constraint that at least one node will be present from each group ("group spanning tree").
How to write an eff... |
I have noticed that in the blossom algorithm, we need to find the blossom while finding the augmenting path. What will happen if I just know there is a blossom in a graph and the contracted graph has an augmenting path. Will the original graph not have that augmenting path or will be same?
|
Traditionally, the $W$ hierarchy is defined around the problem of weighted circuit satisfiability. More precisely, the class $W[t]$ is defined as the closure under $\mathrm{fpt}$-reductions of the following problem.
Given a circuit of weft at most $t$, and depth bounded by a constant, decide whether there is a satisfyi... |
I know it's a silly scenario but I wolud like to know if it's relevant and maybe there are some sort of theory/studies on it or it's merely a non-sense situation.
Immagine a language much close to a Turing machine that is compiled in an higher language (let's say C). This language can accept an integer as input, but us... |
Consider the decision problem: Subset sum. For an input set of integers, it asks for a Yes/No answer to the question of whether or not we can find a subset of elements of this input that add up to 0. The output for this problem is $O(1)$ and simple (e.g. 1/0). This problem is NP-Complete, which as far as I understand i... |
I came across this question:
At the beginning of transmission t, a TCP connection in congestion avoidance mode
has a congestion window w = 60 segments.Packet loss is observed during transmission
rounds t, t+10, and t+20 by getting multiple ACKs. What is the congestion window
at the end of round t, t + 10, and t + 20? ... |
apologies if this is in wrong place (very new to CS). I know there must be some flaw in my reasoning here, but I can't quite see it. Here's how I've stated the problem.
There are two generals, A and B. Messages start from A with a request M and B replies with an agreement N. Thereafter, the generals must exchange ackn... |
Subset Sum is a well-known dynamic programming problem, which states that given a succession of numbers and a number, the algorithm determines if exists a subset that its sum is equal to the given number. I was asked to use this algorithm (however it is implemented) at most $O(n)$ times to build a subset which satisfie... |
For TSP there are well known heuristic and approximation solutions which run in low-polynomial time, like Christofides / 2-OPT and so on.
I need a practical, fast algorithm, ideally sub-quadratic complexity, to solve the minimum weighted set cover problem (which is NP hard). It solves subproblems in a genetic algorithm... |
The top accepted answers to the questions below allude to two complexity classes of optimization problems: NPO and PO (in relation to NP and P for decision problems):
Decision problems vs "real" problems that aren't yes-or-no
Optimization version of decision problems
“NP-complete” optimization problems
The way these... |
Suppose there are n nodes.
These nodes are connected by m unique directed edges. Sets of these edges may form cycles.
Each node has an associated quantity.
r of these nodes are selected as root nodes.
A node a can be said to reach node b if
a is b or
there exists a directed path from a to b.
The goal: For each root n... |
So I have a problem in which I have two lists of physical exercises (routines) and I want to merge them such that the merged list maintains the relative order of the previous lists, so for example, if the list A is [a,b,c] and the list B is [d,f,g], a valid merge between the two may be [d,a,f,b,g,c], or even just the c... |
Suppose I have a hash table which stores the some strings. Let the index/key of this hash table be the length of the string. what is the time complexity of checking if the string of length K exists in your hashtable? is it O(1) or O(k) ?
|
I'm solving distance-d independent set problem, as a follow up to my last question. I'm not quite experienced in a subject, so I'm looking for a simple algorithm (which has to be an exact algorithm). So far I have:
Input: undirected planar grid graph $G$, which might not be "full", but be a subgraph of a full rectang... |
Problem statement
I am looking for an algorithm to maintain a very large number of disjoint sets under node and edge additions. Due to the data size, keeping everything in memory is not feasible, so the algorithm needs to work efficiently with SSD storage.
Ideally, the algorithm should:
support link(v1, v2) operation ... |
Before anything I want to preemptively thank anyone who drops by for their patience, I don't have any formal CS background so I'm probably going to use some of these terms wrong.
I have a puzzle: Given two numbers which define a set of continuous counting numbers of the same number of digits, between roughly 5 and 12 d... |
I am reading the Resolution proof system exponential lower bound via Haken's bottleneck method for the Pigeonhole Principle as presented in Arora and Barak's Computational Complexity: A Modern Approach, Chapter 15. However, I don't like how the proof is presented in the book and I am having some difficulties following ... |
I'm quite struggling with calculating the probability of a rule for a PCFG.
I've been looking for examples online and more information, but I am none the wiser.
Here is an image of the slides. I cannot understand how the numbers are calculated on the left. From what I understood, I have to take a rule and see how many ... |
I saw several questions discussion the benefits of adjacency lists over matrices to represent a sparse undirected graph. On the other hand, none of them discuss sparse matrix representations such as scipy's coo or csr formats.
Do adjacency lists still provide benefits in this case?
Definitions of the above:
Adjacenc... |
I've been trying to create a NFA that accepts strings that end with a letter that exists in the string. For example abcdb, cbdd, acac etc. while strings like abc aacd etc are not accepted since the last letter wasnt in the string before the last letter was read. I only seem to be able to create a NFA that accepts a sub... |
I have an exam in two days and I am not sure if I have understood correctly the way of proving np-completness and how to pick a known np-hard problem to reduce it. Bellow I present a problem which I need help with to understand how to prove it's NP-complete. Any help will be much appreciated!
[Background] A directed gr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.