instruction stringlengths 35 29.1k |
|---|
In "Syntax and Semantics of Dependent Types" at the top of page 24, Martin Hoffman describes $\mathit{Ty}_{\mathcal C}(\Gamma)$ as the collection of semantic types under context $\Gamma$.
It makes sense that he used the word collection rather than set, because in the set-theoretic CwF he describes, the types under a co... |
Let's say I have a point $(x_0, y_0)$, and some other points $(x_1, y_1), (x_2, y_2) ... (x_n, y_n)$, such that all of them are lattice points; all have integer coordinates. Let's further assume that all points are distinct.
Is there any way to sort points $1...n$ by order of the angle they make with $(x_0, y_0)$ and t... |
If so what are they? These are Computational Complexity Classes that are not in RE but are in ALL. What would a problem in one of these classes look like? Would any of these problems be decidable?
|
Consider the following problem:
input: pairwise distinct natural numbers $k_1,\dots,k_m$ that are all $\leq n$, and matrices $A_1,\dots,A_m \in \Bbb Q^{n \times n}$ where $m \leq n$.
output: a matrix $B \in \Bbb Q^{n \times n}$ such that $B^{k_i}=A_{i}$ for every $i \leq m$, if such matrix exists. If no such matrix e... |
I'm trying to figure out following assignment and I could use your help, because I'm stuck.
Task:
Construct a Turing machine accepting words in format $1^k$, where $k=n^2$, $n$ being an integer. Basically it accepts those words, where you can arrange ones into square. For example first three acceptable words will be:
... |
Code:
a=10
b=5
temp=a
a=b
b=temp
I am studying Python and I stumbled upon the classic program: The Swapping Program.
It is simple:
temp binds to a.
a binds to b.
b binds to temp.
I can decode what is happening in memory as well. I will show it here:
But sadly, I can't wrap my head around how we got to this program? W... |
There are n cities and m possible roads and k temples. The cost of each road is given. Build roads with minimum cost such that each city has access to at least 1 temple.
Note that there can be multiple roads(edges) between two cities and each temple is inside a city.
My attempt : I tried running Kruskal's Algorithm of ... |
In the past I've implemented a branchless Bitonic Sorting Network on a gpu using CUDA, for integers.
I am facing a related problem:
In my Order Independent Transparency implementation, I would like to employ similar sorting method in the Fragment Shader to avoid branch divergence, but the set I am using is floating poi... |
I was reading about the machine cycle. Everything was clear until I started with the execution of instructions. I know how an ALU and a CU work. I'm also aware of the process of fetching and decoding. But, I'm a little bit confused about the part that is responsible for executing instructions in a CPU.
Note: I've searc... |
Define the following languages:
$$
\text{SUCC-CVAL}=\{(S,x,i) : \substack{S \text{ is a succint representation for circuit } C \\ \text{ and } C_i(x)=1 \text{ where } C_i \text{ is the i'th gate in } C(x) } \}
$$
$$
\text{CorrectSuccintSolver} = \{C \, | \, \forall S,x,i\,C(S,x,i)=1\Leftrightarrow (S,x,i)\in \text{... |
I'm trying to bound this recurrence with the substitution method. My guess is $O(n^3)$. These are some steps:
$$T(n) \leq cn^3 \\ T(n) \leq 27cn^3+n^3$$
How can I continue?
|
In Special Vertex Cover, we are given an undirected graph $G$, and an integer $k\in \mathbb{N_0}$. The objective is to decide whether there exists a vertex cover $S$ of $G$ of size at most $k$ such that $G[S]$ (the subgraph of G induced by S) has minimum degree 1 i.e the at the subgraph that induced only by the verti... |
Given a problem A is NP-Hard and A ≤ B, is there a way to prove that B is also NP-Hard?
|
Suppose we are given a tree $T=(V,E)$ where $|V|=10$. Now, one of the vertices is goal and we want to find it. The structure of the tree is given as input, but which vertex is the goal is unknown. In each time step, we can visit a arbitrary vertex $v$ and find out which edge of $v$ is nearest to goal.
What is the numbe... |
So I was going through the exercises in the 'Kurose and Ross' book.
Suppose users share a 2 Mbps link. Also, suppose each user transmits continuously at 1 Mbps when transmitting, but each user transmits only 20 percent of the time. Suppose packet switching is used. Why will there be essentially no queuing delay before ... |
Won't both the methods ultimately give a max/min heap? So if I am given a binary tree, as an array, and am asked to convert it to a max heap, can I just use the bottom up construction of the heap?
Bottom up construction method:
void bottomupheap(int arr[size],int n){
int i,ele,p,c;
for(i=(n/2)-1;i>=0;i--){
... |
So I am studying an introductory chapter to dynamic programming that suggests a general solution to an optimization problem that occurs straightforwardly from expressing the problem with a reccurence equation.
Compute-Opt(j){
If j =0 then
Return 0
Else
Return max(vj+Compute-Opt(p(j)), Compute-Opt(j ... |
I am learning computational complexity and parameter complexity. In order to proof that a problem is np-hard, we should reduction one which is np-hard to the problem. However, I don't have any idea about the various reductions of problem.
How should I learn the reduction technique, is there a special teaching material... |
Let $a,b,c,d,e,f$ be integers selected from the set $\{1,2,\cdots, 100\}$ uniformly and at random with replacement. Let $M=a+2b+4c+8d+16e+32f$. What is the expected value of the remainder when $M$ is divided by $64$?
I was trying to write a python code to calculate the answer. Let $f(x)$ be the remainder when $x$ is di... |
I was trying to solve a discrete math question regarding the comparison needed by a merge-sort algorithm. I wanted to ask if there were a more formal way to put organize my reasoning for this problem and if my reasoning were right in the first place.
"Show that for all positive integers m and n there are sorted lists w... |
My idea of the program is :
Input = n sets
objective function ObjFn equals to O(n^3)
Output = the order of n sets
Steps:
Applying ObjFn to all n sets
Choose the n of the Minimum ObjFn to be ordered first
Eliminate the chosen n
Repeat steps 1:3 for the rest n-1 sets
Note: If there are more than same minimum ObjFn for ... |
I'm having a hard time understanding how to solve this problem for my Computer Science 101 class.
On a circle there are $2n$ nodes. $n$ out of these hold -1 power and $n$ hold +1 power. Say we play a game where we randomly start from a node and move clockwise. As we move and land on different nodes, the number on each ... |
I have a game about drone delivery company.
The game consists of a rectangular map, which contains tiles that cannot be passed. I can control a certain amount of drones, each one of them starts at a certain tile.
In addition, There are clients that move along a certain circular path (each client has his own path). Ever... |
I was reading the definitions of p vs np in [this post] (What is the definition of P, NP, NP-complete and NP-hard?) and I was wondering about how to classify the example decision problem where you return 1 if a natural number is even and 0 otherwise. I think this would be P complexity, but my TA said that there are inf... |
Suppose we have a Turing machine $M$ as black box that decide $SAT$ problem. Now suppse we have a $CNF$ formula $\phi$ with $n$ variables. How it possible checking satisfiblity of $\phi$ and then finding that assignment with at most $2n+1$ times using $M$?
I know that every $SAT$ instance can comverted to $CNF$ clauses... |
Is there an efficient algorithm to solve the following decision problem?
Given a finite set $S$ and a set of relations $\mathcal R$ from $S$ to $S$, determine whether there is any sequence of relations $r_1,r_2,\ldots,r_k\in\mathcal R$ such that
$$r_1\circ r_2\circ \ldots\circ r_k = \emptyset$$
where $\circ$ is the us... |
We have an undirected, weighted graph $G=(V, E)$ with two weight functions
$W_1 : E \rightarrow \mathbb{R}^{+}$ and $W_2 : E \rightarrow \mathbb{R}^{+}$
such that for every $e \in E$ we have $W_1(e) > W_2(e)$.
The length of a walk $\sigma$ is calculated in such a way that
for every edge $e \in E$, for the first appeara... |
Let $S$ be a set of $n$ circles in the plane. I need to describe a algorithm which computes
all the intersection points of the circles. The algorithm should run in $O((n + k)\log n)$ time,
where $k$ is the number of intersection points.
I was thinking about some sort of a variant to the bentley ottmann algorithm to cou... |
Given an enumeration of register machines $R_n$ that take a single natural number as input, and a constant $k$, the function $f$ is defined as:
$$
f(n) = \begin{cases} 1 & \exists m \text{ such that } R_n(m) \text{ halts in } k \text{ steps} \\ 0 & \text{otherwise} \end{cases}
$$
I'm trying to show that this function i... |
Let $G$ be an undirected fully connected weighted graph with $N=|V|$ vertices. Given $M<N$ we wish to choose $M$ vertices such that the sum of weights between the chosen vertices is maximal, i.e. we wish to find a set of vertices $S$,
$$\max_S\sum_{i\in S} \sum_{j \in S, j\neq i} w_{ij}\quad \text{s.t.}\quad |S|=M$$
S... |
When I was undergrad student, wondering how the inventor of the algorithm thinks like that. What was he/she writing out/drafting on papers/boards? I still cannot throw the thougt out the window, even after years. For example, Tony Hoare’s quickselect. I thought myself whether I could find 5th highest number in an array... |
This is a problem I've come across while studying on my own; it's from Algorithms by Papadimitriou, Dasgupta and Vazirani.
Specifically, the problem statement is:
Give a linear-time algorithm that takes as input a tree and determines whether it has a perfect matching: a set of edges that touches each node exactly once... |
Take the following case
uint256 x = z * 100/1000;//1st statement
uint256 y = z * 1/10;// 2nd statement
uint256 superOptimized = z /10;
///special cases z * 4/3 or any other number with rounding error or NaN
///z = uint256::MAX
/***********
As you can see all statements are essentially doing th... |
I am currently studying CS and came across a question in my lecture.
Question: Two theories in the same complexity class can always be reduced to each other in polynomial space and time. This is part of our First-order logic lecture.
I am quite sure that this is possible if both problems are decidable and that the poly... |
In an algorithm where I have to search for the pair of points in a plain, with the smallest distance: suppose that we want to use a "Divide and Conquer" approach. Is it possible to make it working by just sorting the points by X coordinates at first and Y coordinates after and get the min distances for all subsequent p... |
I need a reference for sorting algorithm where all possible orders are considered.
example:
if we have four values of n, and we do know there values n1(3) n2(5) n3(5) n4(10) and want to order them in ascend
The two solutions are:
n1(3) n2(5) n4(5) n3(10) and
n1(3) n4(5) n2(5) n3(10)
what is the name of this technique?... |
A typical proof of Cook-Levin's Theorem proceeds like this:
Suppose problem X is in NP. Then there is an NTM M
deciding X in time n^k, for some k. Given a word w,
NTM M, and k, we construct a Boolean formula φ in polytime(|w|)
that is satisfiable iff the NTM accepts w, as follows. [...]
Question: why can we assume th... |
I'm trying to analyse the time complexity of the following algorithm for generating the power set:
public static List<List<Integer>> generatePowerSet(List<Integer> inputSet) {
List<List<Integer>> powerSet = new ArrayList<>();
directedPowerSet(inputSet, 0, new ArrayList<Integer>(), powerSet);
return powerSe... |
Consider I have a user program of 6 pages and 4 byte page size. Now my memory has 300 frames out of which 10 frames are free for allocation. Can the OS allocate page 1 of the given process to any of these 10 frames or is there any specific algorithm to select a frame?
|
When we discuss data structures, linear typically means that we can iterate through the data sequentially. For example, a linked list or array can fall into this category while a binary search tree is a non-linear data structure.
On the other hand, when we discuss mathematical functions, a linear function $f(x)$ satisf... |
Let $G = (V, E)$ be a directed acyclic graph. Let every node $v \in V$ have an additional field $v_d$.
For each vertex $v \in V$, we need to store in $v_d$ the length of the longest path in $G$ that begins at $v$. The length of a path is given by the number of edges on this path.
How can i modify the above algorithm t... |
I wanted to find shortest time algorithm for finding the diameter of a convex hull, so I found Shamos algorithm on wikipedia:
GetAllAntiPodalPairs(p[1..n])
i0 = n
i = 1
j = i + 1
while (Area(i, i + 1, j + 1) > Area(i, i + 1, j))
j = j + 1
j0 = j
while (j != i0)
i = i + 1
... |
Given a directed graph $G = \langle V,E \rangle$ with $n$ vertices and
$m$ edges and a weight function $w:E \rightarrow \mathbb{R}$, together
with two vertices $s$ and $t$ in $V$:
Describe an efficient algorithm that finds the "cheapest" (in terms of
$w$) path from $s$ to $t$ that uses at most one negative edge, or
re... |
I am not sure I understand correctly the following assertion (source):
For all $\epsilon > 0$, approximating the chromatic number within $n^{1−\epsilon}$ is NP-hard.
Does this mean that, for any given graph G, it is NP-hard to decide whether G is $k$-colorable with $k<n$ given colors?
Otherwise, could you explain it ... |
I have created a neural network architecture by considering the data for one study area. Have performed grid-search to tune almost all the hyperparameters of the model. I want to use the same network architecture (without any hyperparameter tuning) on the data of another geographical area for the same topic/ problem.
W... |
Let $S = \{\{x_{1},y_{1},z_{1}\},\{x_{2},y_{2},z_{2}\}, \ldots, \{x_{n},y_{n},z_{n}\}\}$ and a target $t$. Let $S_i$ be the subset list $\{x_{i},y_{i},z_{i}\}$. Find a subset sum that sums to $t$ such that one and only one element is chosen from each subset list $S_i$.
I can also imagine this is the same as finding the... |
Is there a name for this algorithm?
I have an array {1,2,3} and all my possible sums are
{1},{2},{3},{1+2},{1+3},{2+3}, {1+2+3} = {1},{2},{3},{4},{5},{6}
{1,1,2} => {1}, {2}, {3}, {4}
I tried to find another algorithm rather than brute-force combinations, is there any formal name for algorithm that solves this problem ... |
I've been pondering on whether Finite State Machines, particularly Mealy machines, can describe any computable function as Turing machines do. However "Mealy-computability" does not seem to be a term Google likes, and the most I was able to find was an answer in a post of this website:
"Turing Machines have has more co... |
I am looking for a reference to a proof that for every list of size $n$ comparison-based sorting cannot make less than $n-1$ comparisons. Do you have a reference of a book that covers it (with page specification)? Or a scientific publication that covers the proof? The reference is needed for a publication.
|
I am looking for a realistic physical memory access trace/dump of significant, but not insane, length (on the order of 1M accesses) for the purpose of cache simulation. Preferably for a 16-bit or 32-bit RAM. Preferably in Tarmac format. The actual architecture is irrelevant. Are such files publicly available, and if so... |
Given the two equations below
$$ \begin{aligned} 300x + 400y &= 700 \\ 100x + 133y &= 233 \end{aligned}$$
how can one find a solution for those equations using Kalman filter (and suppose the same with increasing the constant by $1$?
|
Do the Prim’s algorithm and the Kruskal’s algorithm always obtain the same minimum spanning tree (MST) on a given input graph?
I have tried drawing a bunch of graphs with non-unique edges and executing both algorithms (for Prim, I tried every different starting node) and always end up with the same MST as Kruskal.
|
In Independent Feedback Vertex Set, we are given an undirected graph $G$, and an integer $k \in \mathbb{N}$.
The objective is to decide whether there exists a feedback vertex set S of G of size at most $k$ such
that $G[S]$ (the subgraph of $G$ induced by $S$) is edgeless (i.e $S$ is an independent set in $G$).
Remind... |
Consider UCYCLE, the problem of recognizing undirected graphs containing a cycle. On the one hand, it's in LOGSPACE, see this stackexchange thread: start at every vertex $v$ a DFS and check whether it returns to $v$ along a different edge than it left. On the other hand, there are linear-time algorithms in the number o... |
I read in [Razborov, "An equivalence between...", p.248] that
It is well recognized in Theoretical Computer Science that when we change the representation of integers from binary to unary, the class $\mathsf{EXPTIME}$ becomes not the class $\mathsf{P}$ but the class $\mathsf{TIME}\left(2^{(\log n)^{O(1)}}\right)$.
Un... |
I'm given a target integer range $[x, y]$ which needs to be covered $n$ times, and a stream of integer ranges $[x_i, y_i]$. I need an algorithm which consumes integer ranges from the stream and returns immediately after processing the first element which causes $[x, y]$ to be covered $n$ times.
Example:
The target rang... |
Suppose I have a set of $n$ equations (each equation can be linear or quadratic).
I want to determine whether the system is underdetermined or overdetermined.
For example, $a_1=2,a_1=3$ is overdetermined since I already know $a_1$ from the first equation, while $a_1+a_2+a_3=1,a_1^2+a_2=5$ is underdetermined.
If I know ... |
I will explain whatever I understand about SSL handshake or simply SSL.
First client sends hello to server
Server sends signed certificate with its public key.
Client checks if certificate is valid, if it looks valid it generates its own private key, encrypts with server's public key and send back to server.
After th... |
At https://www.javatpoint.com/singly-linked-list-vs-doubly-linked-list, it says:
In a singly linked list, the time complexity for inserting and
deleting an element from the list is O(n).
And:
In a doubly-linked list, the time complexity for inserting and
deleting an element is O(1).
Is this not a mistake? Why would... |
In my ADS course we were given this pseudo code for the "exact string matching brute force" algorithm:
1 ESM-BF(P, S)
2 m = length(P), n = length(S)
3 k = 0 # number of matches
4 for j=1,...,n-m+1do
5 i=1
6 while i ≤ m and P[i] == S[j+i] do
7 i = i +1
8 if i == m+1 then
9 k=k+1 ... |
I was just curious how do RTS games actually implement this.
There are usually thousands of units on the whole map. They all have usually unique range of sight and then there's also settings for aggressiveness.
Secondly when an enemy unit goes out of range of sight the unit stops aggressing on the enemy unit. So how do... |
Assume a parralled adder program:
CPU0:
ADD sum,eax;or
LOCK ADD sum,eax
CPU1:
ADD sum,eax;or
LOCK ADD sum,eax
If these 2 instructions are issued in the same clock cycle, and reach memory control unit/cache control module, how does it decide which one will be served first? If not using lock, it seems that ADD require... |
First, let $H$ be a graph represented as an array of adjacency lists say. Next, let FindDegree$(H,y)$ be a standard subroutine that takes $H$ and a vertex $y$ in $H$ as input, and that returns the degree $d_H(y)$ of $y$ in $H$ as output. I am writing pseudocode that does the following: The subroutine FindDegree$(H,y_k)... |
My professor recently brushed over the formal definition of Big O:
To be completely honest even after him explaining it to a few different students we all seem to still not understand it at its core. The problems in comprehension mostly occurred with the following examples we went through:
So far my reasoning is as f... |
I have an expensive operation; I'll use the symbol + and the word "concatenation" to represent it. This operation is:
Binary: A + B
Associative: (A + B) + C == A + (B + C)
Non-commutative: A + B != B + A
Idempotent: A + A == A
These properties mean, for instance, (A + B) + (B + C) == A + B + C and (A + B) + (C + B) =... |
I'm trying to solve a problem that may arise in a system I am concerned with. It will be uncommon in practice, so I am more concerned about simplicity and correctness than performance. I have N nodes that I want to reach agreement on a boolean value v. F of the nodes might exhibit arbitrary faults. I would like to ... |
I'm very new to P and NP complexity classes and reductions. I'm trying to solve this problem and I want to verify my solution and if it is wrong, understand why.
Suppose that I'm given a polynomial time algorithm $A$ that takes a
graph $G=(V,E)$ as input along with integer $k$ and outputs yes if
there is an independen... |
I don't know how to search a bitonic array with roughly $2\log n$ comparisons in the worst case.
What I am trying now is to find the maximum integer using roughly $\log n$ comparisons (binary search) — this divides the array into the increasing and decreasing pieces. Then apply binary search again to these two pieces. ... |
I have been working on this particular question since yesterday and I can seem to figure out how to solve it:
Assume that your files are organised based on slotted page array which contains a header (8B) and slot references of 2B each. Insert in the text below the number of tuples that you believe can fit completely in... |
Exact cover by 3-sets is -complete:
Instance: Given a finite set $X = \{x_1, x_2, …, x_{3n}\}$ of $3n$ elements and a collection $C = \{(x_{i_1}, x_{i_2}, x_{i_3})\}$ of 3-elements subsets of $X$;
Question: Find a subcollection $C'$ of $C$ such that every element in $X$ is contained in exactly one member of $C'$.
Now i... |
I am looking for proper algorithm for so called "delta-homogenization" of 1-D non-equidistant grid.
Definition: The sorted monotonically changing vector $x = x_{homogeneous}$ is $\delta$-homogeneous if for specified $\delta > 1$ , the differences ratio $r_i(x) = (x_{i+1} - x_i)/(x_i - x_{i-1})$
satisfy to the condition... |
What are the differences between the CEK machine and the modern variant of the SECD machine (which combines stack and dump) from the point of view of performance, memory efficiency, and other factors? Are there any papers that explicitly compare the two?
|
Im working on a problem for a homework assignment in finite automata, but I'm having trouble conceptually grasping the problem in the first place.
Prove that the following is undecidable:
$SUB_{TM} = \{\langle M_1,M_2 \rangle \mid L(M_1) \subseteq L(M_2)\}$
I'm not sure what kind of Turing machine $SUB_{TM}$ is even de... |
I'm very new to complexity theory, please help me fill in the gaps in whatever knowledge I have acquired till now.
A decision problem is a problem $X(D)$ that outputs for each input
instance $I$, a Yes or No. $I$ is called Yes instance if $X(D) (I) $
is Yes, No otherwise.
Is my above definition of a decision problem ... |
I have a problem that's been bugging me, but I'm not sure what algorithm can solve it.
Alice has medicine that she needs to use as quickly as possible in case of an allergy attack. She wants to distribute $k$ number of medicines in caches throughout her house, but doesn't know what is the ideal distribution such that a... |
I'm supposed to perform actions corresponding to the different steps in Sipser's explanation of the Modified Post Correspondence Problem, but I'm not sure I understand the third step.
The part I'm referring to is:
Part 3. For every $a, b, c ∈ Γ$ and every $q, r ∈ Q$ where $q$ != $q_{reject}$,
if δ(q, a) = (r, b,L), put... |
I am reading The Art of Multiprocessor Programming. I was able to grasp almost everything up to Counting Networks in chapter 12 - Counting Sorting and Distributed Coordination. However I am having trouble understanding counting and sorting networks.
Does someone know a bit beginner friendly resource about counting/sort... |
I am unable to relate to any real life examples of negative weight edges in graphs. Distances between cities cannot be negative. Time taken to travel from one point to another cannot be negative. Data transfer rates cannot be negative. I am just blanking out while thinking of negative weight edges in graphs.
Can w... |
In Section 4.7.4 of the book "Compilers: Principles, Techniques, and Tools" (2nd Edition), it reads:
"The revised parser (LALR(1)) behaves essentially like the original (LR(1)), .... The error will eventually be caught; in fact, it will be caught before any more input symbols are shifted."
I understand an LR(1) parsi... |
I read different things online about this:
In Sipser, p. 283. The time-complexity of a NTM is defined as the maximum number of steps it uses on any branch on any input of length n.
So this is only defined for a decider.
In other sources (like the lecture notes I inherited from my predecessor at the university I work at... |
As shown in this post @ stackoverflow, ANTLR4 seems able to resolve the "dangling-else" ambiguity @ wiki in the following "if-then-else" grammar by prioritizing the "'if' expr 'then' stat" alternative to "'if' expr 'then' stat 'else' stat". But I have some difficulty
stat : 'if' expr 'then' stat
| 'if' expr 'then'... |
A graph $\mathcal{G}=(\mathcal{V},\mathcal{E})$ may be represented in central memory as follows:
an associative array (hash table) $V$ gives for any $v\in \mathcal{V}$ the list of its neighbors $V[v]$, each of these lists being represented as a dynamic array;
another associative array $E$ gives, for any $(u,v)\in \ma... |
I am currently trying to study the Quicksort algorithm. I understand how it works for integers but can anyone explain how does Quicksort algorithm work with strings?
The reason for my confusion is that strings do not have values assigned to them and the Quicksort algorithm seems to be using values to arrange an array o... |
I am looking for a clustering algorithm that is scalable up to large sparse undirected, unweighted networks (10-40M nodes, 10-80M edges). The most important aspects I care about are scaling efficiency to this size network and maybe consistency/stability. I'm mostly interested in this as a way to try and understand the ... |
I'm new to algorithm, and I am already overwhelmed with the term ∈ I really could use some good explanation.
|
I was trying to find all subsequences constrained to the following conditions:
remove element from the end.
remove element from the beginning.
remove element from both sides.
For example, given the sequence $(1,2,3,4)$ have subsequences $\{(1,2,3,4), (1,2,3), (1,2), (1), (2,3,4), (2,3), (2), (3,4), (3), (4)\}$. So, w... |
If i have a parameterized reduction from multicolored independent set (W[$1$]-hard) to some problem $A$, which take polynomial time. Can i say that problem $A$ is NP-hard?
in other words, Is multicolored independent set (non-parameter version) NP-hard?
Further, does exists a problem belongs to W[1]-hard but don't belon... |
Say you are a salesperson and you want to make a sale; there are $N$ customers on your list; customer $i$ takes $t_i$ time to talk to and there is $p_i$ probability to make the sale to that customer - you find out immediately at the end of the conversation with that customer whether they agree or not. You have no contr... |
Need to find the shortest distance between the closest pair of 'r' and 'b' nodes. You can traverse along '.' elements, but not 'o' elements. How can we do this in $O(MN)$ time? (M rows, N cols). $O(RMN)$ time would also be sufficient (R is numbers of 'r' nodes).
Below is an adopted version the Lee algorithm from here t... |
Given a binary relation $R$ on a finite set $S$, is there an efficient algorithm to transform $R$ to a transitive relation $R'$ by minimum number of addition or deletion of pairs $(x,y)$ to or from $R$ where $x,y \in S$?
|
In Special Matching, we are given an undirected graph $G$, a function $w:E\rightarrow\mathbb{N}$, and an integer $k$. The objective is to decide whether $G$ contains a matching $M$ of size at least $k$ such that for every two edges $e , e' \in M$ then $w(e) \neq w(e')$.
I want to design a random Dynamic Programing th... |
Let's say that I have a file that I really don't want to lose.
I want to convert the original file into $n$ files in the way that will allow me to recover the original file if I have any $m$ of the converted files. I want an algorithm that will solve this problem for any given $m$ and $n$, where $0 < m < n$.
A trivial ... |
I have a 2D bitmap with various shapes (each pixel is either 1 or 0).
How can I find the largest axis-aligned rectangle that covers only set pixels?
|
This is motivated from a homework question. Let $A$ be an algorithm with probability of success equal to $q$ for solving a given problem. Let $p \in (0, 1)$. Find an algorithm that has a probability of success of at least $p$.
My idea so far is to run the algorithm multiple times and counting the number of times the al... |
If one has a vector of size $n$, one can sort it in $O(n \log{n})$. If one has $m$ vectors of size $m_i$ each, such that $\sum_{i}{m_i}=n$, what's the total time complexity to sort all of them? I belive it's still $O(n \log{n})$ but can't formalize.
|
I was curious is there a really efficient way to see if a value is in a set? This question comes from me thinking about youtube views. As far as I understand youtube view count goes up for every unique view it receives (let's imagine it does if it doesn't already). There are millions or billions of viewers per video. T... |
I'm having a hard time trying to write a two tape Turing machine
I wanted to first think Oh all I'd have to do is scan from left-to-right till I find the strings that matches the accepted strings) but I'm stuck now and don't know how to continue
(Note** Σ = {0, 1, #} but the # character is only allowed as a marker to ... |
We were assigned to draw NFA for regular expression a|b|c, so like any one I draw this
But my professor told me it is wrong, the correct way is
So, I checked it on online tools toolbox by cyberzhg, and regexper and according to both of them I am also correct.
Professor's argument was in maths for 4+5+1, we first add ... |
These sources cp-algorithms and geeksforgeeks
state that query complexity (for example, submatrix sum) of 2-D segment tree is O(logN * logM), because
it first descends the tree in the first coordinate, and for each traversed vertex of that tree, it makes a query from the usual tree of segments along the second coordin... |
The rules of the question state that:
Only one element is different.
Rest are all same.
Array A size is 8.
I need to find the different element and remove it (Hashing cannot be used).
I have not developed the code but I have come up with an algorithm.
There will be two cases one where the different element value is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.