instruction stringlengths 35 29.1k |
|---|
The last times i was searching a lot to understanding Big O notation or in general asymptotic notations concepts because i didnt hear about it or them before starting studying in computer science.
(In computer science) Since to get asymptotic notation of a function we must get firstly the function itself. And because... |
I want to write a regular grammar that follows the C language. I almost wrote the grammar, but was not able to resolve how to define a variable.
Def: A variable can be any combination of characters, but it should not be an existing keyword.
I tried writing something like this but not sure how to write it:
<Var> -> {a-z... |
Consider any computational problem in which the inputs are integers.
As far as I understand, if the problem has a strongly-polynomial time algorithm, it means that the algorithm uses a polynomial number of arithmetic operations in integers, and polynomial space.
Now, suppose we want to solve the same problem but the in... |
I know that the optimization version of NP-complete problems belong in NPO. What about co-NP-complete problems? Is there a co-NPO class, or is it just NPO?
I've also never seen the name for the complexity class of optimization problems whose decision version is NExpTime-complete. Is it called NExpTimeO? Is there a co-N... |
Given an integer $n$ and a tree set $S$, I would like to find the approximate median $x$ of the integer set $T := \{i \in \mathbb N : i < n \wedge i \notin S\}$. There are no constraints to the distribution of $S$, so it is not possible to assume that $S$ is uniformly distributed over $(0,n)$. This problem can be found... |
Prove the following problem is NP-Complete:
The problem gave a directed graph G, and several subsets of vertices of such graph are being specified as T1,T2,....Tn, and the subsects could intersect, does there exist a path in G where it doesn't contain any cycle and for every subsect Ti, the path consist of exactly 3 ve... |
The problem is to count number of unique binary search trees with keys $a_1,a_2,...,a_n$, given that some of the keys are not unique. For example, $a$ could be 2, 1, 1, 4, 3, 4.
We could try an approach that is similar to the case when keys are unique - choose some root node from $a$ and then solve two subproblems - on... |
I found following statements in 6.4.16. Arbitrary-rank polymorphism of ghc document.
GHC uses an algorithm proposed by Odersky and Laufer (“Putting type annotations to work”, POPL‘96) to get a decidable algorithm by requiring some help from the programmer. We do not yet have a formal specification of “some help”
I kn... |
Let $P$ be a non-empty, finite set of points in $\mathbb{R}^n$. I want to know if there is an algorithm that can find the most optimal set of $n$-spheres $S$ that follows these properties:
Each $n$-sphere in $S$ overlaps with at least one of the other $n$-spheres in $S$,
For all $p \in P$, there exists $s \in S$ with ... |
With the decision problem Clique, I mean:
Given a graph $G$, does $G$ admit a clique of size at least $k$?
From Wikipedia, one finds that the brute force algorithm of testing all possible subsets of size $k$ results in a complexity of $O(n^kk^2)$. On the other hand, Wikipedia also states that a maximum size clique can ... |
In Introduction to Algorithms, when talking about prefix code for Huffman encoding, it says that:
Although we won’t prove it here, a prefix code can always achieve the optimal data compression among any character code...
How can we prove such a claim? My first thought was in the direction of representing the encoded ... |
I have a problem set about NP Completeness proofs and I'm struggling to approach this problem:
An organizer would like to arrange all the participants in a
circle where neighboring two students must have taken the same class last semester.
How to prove that this is an NP complete problem?
Any hints/tip would be very he... |
Given a Directed Graph G, and some subsets of vertices T1,T2,..Tn(These subset can intersect) , is there a path in this graph such that it is acyclic and contains exactly 3 vertices from each Ti. I'm not sure , but I have an intuition that this is a problem that can be reduced from hamiltonian path problem , just can't... |
Is there any instance where a problem $A$ can be reduced to a problem $B$ where $B$ is easier to solve than $A$?
I've been learning about NP-Hardness recently and seems that the answer is no. Whenever we show $ A \leq_p B$ its also said that $B$ must therefore be at least as hard as $A$. If this is always the case then... |
Let $E_1, E_2, \ldots, E_n$ be boolean-valued expressions, each with an associated evaluation cost and probability of returning true. For simplicity, assume these probabilities are independent, so that $\mathbb{P}(E_i \cap E_j) = \mathbb{P}(E_i) \, \mathbb{P}(E_j)$ for $i \ne j$.
Suppose we want to compute the express... |
Assuming I have two relations:
Supplier [ID (PK), Name, City, Country] and
Item [ID (PK), Name, Department, Price, Stock, Supplier_ID (FK)]
What would be the easiest way to determine the following statement both in domain and tuple relational calculus: "List the IDs and names of those suppliers, who have delivered at l... |
I am stuck on an exercise that ask the approximation factor of a MAX-SAT approximated algorithm generalized from a MAX-3SAT algorithm
MAX-3SAT:
set every variable with a random value ($0$ or $1$ each with probability $\frac12$)
check how many clauses are satisfied
This algorithm has a $\frac78$-approximation factor... |
From abstract data types in wiki, I'm reading about two types: collection and container. Can anyone supply a better detailed difference between the difference between the two?
https://en.wikipedia.org/wiki/Container_(abstract_data_type)
https://en.wikipedia.org/wiki/Collection_(abstract_data_type)
As I understand...
Co... |
Given something similar to this.
Where you have blocks (the squares) and entries (the circles). Each block has a rating (the number inside the blocks) and is connected to other blocks. This topology is always fixed and cannot change, the ratings neither.
An entry can ask for a given rating. The algorithm then should t... |
About the language $L=\{<M>|M~is~a~TM~and~L(M)=\{0^n1^n|n\ge0\}\}$
I want to determine if it is in RE / coRE or neither.
I think that I found a mapping reduction from $\overline{A_{TM}}$ to $L$, where
$\overline{A_{TM}}=\{<M,w>|M~is~a~TM~and~M~does~not~accept~w\}$:
Define $f(<M>)=<N_{M,w}>$ as follows:
$N_{M,w}=$ "On i... |
Is it always the case that ${n \choose k} = O(n^k)$?
If it is, then why does the comment from Clement C. in this post state it is only the case when $k$ is a constant?
If it is not, then why is the asymptotic time complexity of the brute force algorithm for the Clique decision problem denoted as ${n \choose k}O(k^2)O(1... |
I'm trying to come up with a performant layout algorithm for web resources timings. For now, all that is relevant is that resource timings include a startTime timestamp and a duration and the goal of this layout algorithm is to assign each resource timing to a lane. A resource timing cannot be assigned to a lane if it ... |
I have designed an algorithm (up to making a pseudocode) that accepts a sorted array as input and finds in $O(n)$ time if there's a pair of elements (integers) in the array that have a sum zero.
What my algorithm basically does is:
set index $i$ = 0
set index $j$ = length(array) - 1
while $i<j$ : if $a[i]+a[j]=0$ then... |
Let $S$ be language $$\{\langle M\rangle \mid(\forall x \in \Sigma^*)[x \in L(M) \iff x^R \in L(M)]\}.$$
How can I show that $L_U \le_m S$ and $L_U \le_m \bar S$ where $L_U$ is universal language and $\le_m$ means it is m-reducible (or simply reducible)? Can it be done via Rice's theorem?
|
So I found another discussion regarding this, but the answers did not fully separate the differenced between SID and ML. Hopefully a discussion here can shed some light on some larger differences both in design and use case situations between the two.
SID and ML seem very similar. They both use known input and output d... |
How do I prove the runtime of an algorithm with Big O notation? I don't know much about O notation, I just I know how to compare sets of functions with each other and I'm also familiar with the master theorem.
But how do I do this? Is it just $O(n^2)$ because there are $2$ loops? That doesn't sound right. The loop in C... |
I've been studying closely about the List abstract data type - As I understand it can be implemented with linked-list and/or arrays, and really maybe with any other data types as well.
But to satisfy a list, it means to have methods:
that allow for insertion at desire 'position'.
removal at desired 'position'.
access ... |
I am recently studying the operating system, and I found the paging system a little bit confusing, for example, what will happen when there is a 52-bit virtual address and a 40-bit physical address, with 4KiB page size, so there are 2^40 pages and 2^28 frames, how pages are mapped in this case (the pages are more than ... |
Looking online I found two different definitions for euler trail. I am wondering if one of them just implicitly assumed what the other definition explicitly stated or whether one is not generally accepted and if so which the general accepted one is:
All edges exactly once, all vertices at least once
Source: https://www... |
The runtime to find a max element in max heap is $O(1)$. It takes $O(\log n)$ time to delete an element and $O(\log n)$ time to insert a new element in the heap.
Does there exists a data structure in which max element can be found in $o(\log n)$ and still the time to delete is $o(\log n)$ and $o(\log n)$ time to insert... |
I have the following problem formulated as a linear integer program:
\begin{align}
& \text{minimize} && \sum_{i \in n} x_i\\
& \text{subject to} && \sum_{i \in n}{a_i}x_i \ge \theta_1, \\
& && \sum_{i \in n}{b_i}x_i \ge \theta_2, \\
& && a_i \ge 0 \quad \forall i \in n , \\
& && b_i \ge 0 \quad \forall i \in n , \... |
The term external node is used as a synonym for a leaf node in the following.
A binary tree shall be called proper if each node has either zero or two children. If it is not proper, it shall be called improper.
I need to determine the maximum number of external nodes in an improper binary tree. Here is my current attem... |
I am wondering whether every Euler graph is also traversable. I.e. are Euler circuits Euler paths, too? Therefore I am asking the question above.
I am explicitly asking "euler circuit ⇒ euler trail?".
|
I was trying to do this exercise, but I don't know how to solve this problem is NP-complete, what reduction to do.
There is a network N of n people, in which every person i is associated with a subset of people Fi ⊆ N . For every i∈N, it holds that i∈Fi, and if person j is in Fi, then it must be that i is in Fj as well... |
Update. Since my original question was misunderstood by many, and lead to a lot of debate about various issues, let me try to pose this modified and rephrased question:
Assume that I have a computer with a giant disk that can store $2^{1000}$ bits. Is it possible for any $N<2^{999}$ to write a code in Python for any $... |
I just newly started looking into computational complexity.
Since we don’t know if P = NP, we would like to have a way of saying “This problem is in NP and is really hard unless P = NP.”
This is made more formal by the notion of NP-completeness.
Therefore, we say a problem A is NP-complete if
(a) it is in NP, and (b) e... |
Assume a tower with $n$ floors.
Each floor contains $C_i$ boxes such that $C_i>0$ for all $1\le i\le n $
Moving $C_i$ boxes from floor $i$ to floor $j$ where $i>j$ costs $C_i\cdot(i-j)$ and we can only move all the boxes at once, and they all go to the same floor. (The boxes can only be moved downstairs)
Given $C_i$ fo... |
I read a paper about Parallel Matching, and I didn't understand what the associative operator ⊕ in the following lemma/proof and how does it works in vertices and edges in the graph?
Lemma 3. Using our graph representation, each node v in the graph can apply an associative operator ⊕ to all edges incident on v in O(log... |
I am recently studying The Operation System, I am confused about how symlink work even after watching some YouTube videos, hope there's someone can help me out with some questions. According to wiki, symlink is pointing to the name of the file but not the inode, if the computer wants to access /opt/be which is a symlin... |
I'm trying to write a program that generates a Tectonic/Seguru puzzle, and I'm struggling to find an algorithm that can generate them
The rules of the puzzle are here, but basically, it involves a grid that's divided into components, and the goal is to fill the grid with numbers according to these 2 rules :
A componen... |
TL;DR: Floyd-Warshall algorithm seems to also accept "is-a" and "has-a" relationships as edge weights. I want to know exactly why this is fine, and how to generalize this notion of other unusual weights.
I also considered to ask this question on Mathematics Stack Exchange since it also contains significant portion of a... |
I found in this answer that if a problem is shown to be NP but not NP-complete then P$\neq$NP. What is the argument to prove this statement?
|
This question is about the (Edit: universal) Halting Problem on a TM with finite space.
The Halting Problem is obviously decidable on those TMs. So my question now is how efficient we can decide it.
My intuition is, that there is now better way than brute force. Because, if we have a better algorithm than that (for an ... |
Let $G$ be an abelian group. We say that $G$ has property $V_n$ if for every $m > n$ and a list $L\subset G$ of $m$ elements s.t. $\sum_{g\in L}g=0$ there is a proper subset $\emptyset\neq L'\subsetneq L$ s.t. $\sum_{g\in L'}g=0$. We define $V(G)=\min\{n \mid G \text{ has property }V_n\}$.
This is part of the problem o... |
When we move the mouse, we can see the cursor moving on the monitor. I know that mouse can send signals according to its movements. Which component of a computer is receiving those signals in the first place? Is this whole process happening only between device controllers and device drivers? Is there any involvement of... |
How many ways can we insert elements { 1, 2, 3, .... 7 } to make an AVL tree so that it does not have any rotation?
I broke it down into 2 cases:
Case 1: height of tree = 2, (a complete binary tree) only 1 structure possible.
case 2: height of tree = 3, there will be 16 structures possible.
there will not be an AVL tre... |
I have a square matrix (call it $A$) of size $n$ ($n$ is a positive integer). Each column is a permutation of $[1:n]$.
I take the first row of $A$, i.e. $A(1,:)$ and wonder what will be the frequency of the mode. This is, how many times the most common element in the first row of $A$ will appear and whether the mode wi... |
I have in the lectures a sentence in English, which I have to translate to First Order Logic.
Someone who loves all animals loves all humans.
Textbook solution:
∀x.(is_human(x) ⇒ is_animal (x))
⇒
∀y.(is_human(y) ∧ ∀z.(is_animal(z) ⇒ loves(y, z)) ⇒ ∀z.(is_human(z) ⇒ loves(y, z))))
My solution:
I would have interpret... |
Given a list of $n$ pairs (cost,points) and number $k$ ($0 \le k$), find the maximum possible sum of points s.t their sum of costs no more than $k$. return the maximum possible sum of points and their corresponding sum of costs.
For example the list $[(5,10),(1,2),(4,3),(6,12),(11,18)]$ and $k=15$, the maximum sum of... |
Consider an unweighted and directed graph G(V, E). Suppose, for every vertex v ∈ V we assign a vertex label y(v).
We say that the vertex labeling is valid if for every edge (u, v) ∈ E that is directed from u to v, y(v) − y(u) ≤ 1.
We say that the edge is admissible if y(v) − y(u) = 1. Now consider a directed path P tha... |
So I have this Recursive Descent Parser which outputs a Syntax Tree for arithmetic expressions.
While doing some reading, I learned that LL(1) grammars have a lookahead of 1 - I remembered using a lookahead so I grepped for it. But instead of finding it in my parser, I found it in the lexer.
case "*":
if self._pee... |
I've been trying to solve this problem:
Given a minimum heap $H$, which contains $n$ elements, where each of its keys contain natural numbers, as well as $k\in\mathbb{N}$.
Add the value $k$ to each of the keys on the left from the root, (Which means to add to each element in the heap which has an index of the form $i ... |
I've been trying to study some graph algorithms and, as part of it, prove a bunch of graph theorems in order to practice my ability to do theoretical work with graphs.
Specifically, I've been trying to prove that given a directed graph $G$, the minimal (in terms of vertex count) non-empty subset of vertices with no out... |
The problem:
Given an undirected graph G = {V, E}, a source-vertex s, and each vertex having a "capacity" between 0 and |V|, is there a tree which covers all vertices and does not extend from a vertex more times than its capacity allows, while also not covering every edge? Demonstrate that it is NP-complete.
An example... |
I would be very grateful if someone can clarify a little bit about the Dancing tree data structure that the Reiser4 filesystem uses. It's a presentation topic that I picked, however, there seems to be little resource about it. The only things that I could found are:
Reiser4's description of Dancing Tree: http://web.ar... |
Given the following grammar:
S -> A
A -> AB
A -> ϵ
B -> aB
B -> b
Check whether it is CLR(1) or not.
I have drawn the canonical itemsets as well as the parse table. But I'm not sure whether it is actually correct or not. I have tried searching for some similar examples that have epsilon productions but could not find... |
When applying the DC3/Skew algorithm to the string yabadabado, I can't quite get it to sort correctly. This issue happens in other cases, but this is a short example to show it.
This first table is for reference:
These are the triples of R12
We have a tie between i = 1, and i = 5 since both their triples are aba.
We ... |
Assuming $\mathsf{P} \neq \mathsf{NP}$, then all NP-complete languages are countably infinite. I know not all subsets are NP-complete, but I am wondering if there's a simple proof that every NP-complete language can be partitioned into two subsets $X,Y$ such that both $X$ and $Y$ are NP-complete.
|
Using the algorithm provided by this paper, they said that:
The algorithm defines a single phase of the local max algorithm. Each step of the phase takes at most O(log(m + n)) = O(logn) time and O(n + m) work in the CREW PRAM model. Over O(logm) phases, each with geometrically decreasing number of edges, the local max... |
Let $P$ be a partial order on $X.$ Does the relation $E(P)=$ { $(x,y)\in (X\times X)\setminus P:P$ $\cup$ { $(x,y)$ } is a partial order on $X$ } have a name? If not, what's a good thing to call it?
|
so this is my question:-
If I manage to find a vertex cover which has ....let's say 100 more vertex than the minimum vertex cover. Can I find the minimum vertex cover in polynomial time from this vertex cover?
Here, vertex cover is general vertex cover for any random graph.
Thank you.
|
I am trying to grasp the concept of triple sat compared to 3Sat. I understand that 3Sat has 3 literals for each for each clause. ${Triple-Sat} = \{ \phi | \phi $ has at least three satisfying assignments $\}$. Im just not exactly sure what the difference is between them.
|
Wondering which approach is faster in terms of time complexity. In short, is having a single loop that clears out the vector every time there's a difference lesser than the minimum so far faster than having two separate loops: first determines the minimum difference, second appends the corresponding elements with minim... |
I'm trying to apply the master method to the following recurrence:
$$T(n) = 2 \cdot T(2n)+n.$$
We have $a=2$ and $b=1/2$.
Also,
$f(n)=n$
and
$n^{\log_b a} = n^{\log_{1/2} 2} = n^{-1}$ since $\log_{1/2} 2 = -1$.
So, case 3 applies since $f(n) = \Omega(n^{\log_b a+\epsilon })$ , i.e., $n = \Omega(n^{-1+2})$ for some cons... |
I have a large array of bits of length $N$.
The query $f(k, m)$ means "find $kth$ zero in the array and the next $m-1$ zeros after it", $k \in [0, N-1], m \ll N$
Currently I use a segment tree over the bit array and my approaches were:
use kth zero search procedure $m$ times in $O(m \log{N})$
use the same kth zero sea... |
Given a collection of tuples $X=\{(x_1,y_1),\dots,(x_n,y_n)\}$, where elements
$x_i, y_i \in R_{\geq 0}$ are non-negative real values. The collection $X$ is
sorted if $x_i \leq x_{i+1}$ and $y_i \leq y_{i+1}$ for all $i \in [n-1]$. Sorting $X$ is not
always possible for instance if the given input has two tuples $(x_i,... |
I want to generate spatial scale-free networks for my project. Are there any python libraries that enable it?
I read about the BA model (https://www.science.org/doi/pdf/10.1126/science.286.5439.509) which seems like the pioneer of scale-free networks but I am not sure it takes the spatial aspect into the account.
Can a... |
Is there a standard terminology for the topological sort count over a partial order? I went with magnitude of a poset rather than dimension as this is too close to linear algebra terminology. I wonder if there is a generally accepted choice.
|
How can I convert a 1D index in the lower-left triangle of a grid into a row and column?
For example, consider this table of 1D indices, indexed by row and column
// 0 1 2 3 4
// +--------------- ...
// 0 | 0
// 1 | 1 2
// 2 | 3 4 5
// 3 | 6 7 8 ... |
I have the following problem: Given an undirected graph with n vertices v1,…,vn, a positive integer weight on each edge, and a n×n symmetric matrix Rij. The objective is to find a subset S of the edges such that the total cost of the edges in S is minimized and for every pair of vertices vi and vj there exist at least ... |
This problem's been stumping me for the better part of a week:
You're given a set of triplets of variables. The variables are all distinct and ordered. Each triplet $a,b,c$ means that either $a<b<c$ or $c<b<a$. The problem is to find an ordering of the variables satisfying all constraints.
For example, the set $\\{(a,b... |
I understand that the problem of whether a PDA accepts all strings is undecidable. However that doesn't mean such PDAs exist. To start, I'm working under the assumption that a PDA must read it's entire input, have an empty stack, and be in an accept state in order to accept. I am also working with the convention that a... |
I found many solution online on how to reduce Subgraph Isomorphism problem to Clique, but how do I prove that it is NP complete by reduction from independent set?
I'm struggling to figure out this proof through independent set. Any hints?
|
Problem: find all anagrams in a string such that one substring can be formed from another substring by rearranging its letters. Given a string $s$, find the number of pairs of substrings of the string that are anagrams of each other.
Below is the traditional solution to this problem that uses $O(n^2\times n\log{n})=O(n... |
I want to remove ambiguity from the grammar below:
S → ABC
A → abA | ab
B → b | BC
C → c | cC
I have removed left recursion and left factoring and obtained the grammar as follows:
S → ABC
A → abA'
A' → A | ε
B → bB'
B' → CB' | ε
C → cC'
C' → ε | C
Now, how can I remove ambiguity from the grammar? Is removing left recur... |
My lecture notes for minimum spanning trees say that:
A graph can have several minimum spanning trees but if the edge weights are distinct then the minimum spanning tree is unique. Without loss of generality, we can
assume that the edge weights are distinct
I'm trying to convince myself that the distinct edge weights... |
Global variables are given fixed addresses in main memory by the C compiler, called static memory allocation. Function local variables are created on the stack, this is called automatic memory allocation.
Why is it done this way?
|
I am trying to understand stacks a little better.
I don't understand why the content of the program counter is saved on the stack for the function call (call), but not for a jump (jmp)?
can someone please explain it to me?
thanks in advance!
|
I was just wondering if there exists problems that are solvable in polynomial time (a correct solution can be found in polynomial time) but not verifiable in polynomial time. My professor says no, but doesn't rlly give a clear explanation besides saying you can just use the solution to verify, but I fail to see how thi... |
Let $\Delta_n :=${$x\in \mathbb{R}^n\colon \sum_{i=1}^n x_i = 1$} denote the probability simplex in $\mathbb{R}^n$ and $A^{n \times n}$ be diagonalizable matrix.
I would like to know what is the fastest way (computationally-speaking) of solving the problem $\text{argmin}_{x\in \Delta_n} ||A x -y||^2$.
When $A=I$ is the... |
I'm not sure how to show that the language L = {M | M is a TM and {b}* ∩ L(M) ≠ ∅ } is recursively enumerable. I understand that if there is a DTM that accepts every word of the given alphabet, it is recursively enumerable. But I dont know how to properly show this, can anyone help?
|
I am struggling with this question as I am not sure whether the answer that has been provided is correct or not. The image should be sufficient to tell the question.
The attached image is of the answer. For the question, imagine all but the first two columns are empty.
Here's what I am struggling with:
1. Why is when t... |
I'm taking a course about the formality of programming languages and while reading Semantics with Applications: An Appetizer by H.R Nielson and F. Nielson
I came across the following exercise:
I'm referring to the last statement - I managed to proof that the statement is semantically equivalent using the Natural Opera... |
Prove/disprove: if $L\in \text{coRE}$ then $L$ is mapping-reducible to $\text{PAL}_{\text{TM}}$, where
$\text{PAL}_{\text{TM}} = \{~\langle M,w\rangle ~|~ M ~\text{is a TM and}~w~\text{is a palindrome}~\}$
It feels like there's not necessarily a mapping reduction from every language to a harder language, but I couldn't... |
I'm given a description of a regular language $L$, and I have a candidate regular expression $R$. Is there a systematic, step-by-step way to test whether the candidate regular expression is correct?
I know that there can be multiple regular expressions that are correct.
This is intended as a reference we can point oth... |
I'm new to optimization and I have a little problem that I want to resolve with my job. Here we go!
I need a certain number of drivers per day and each driver has 2 consecutive days off during the week. My optimization problem is that I want to have as few employees as possible with the number of driver per week. I nee... |
Let $\Sigma$ be an alphabet, and denote by $\mathrm{ind}(\varphi_M^{(k)})$ the index set (w.r.t some numbering) of the $k$-ary partial computable function $\varphi_M^{(k)} : (\Sigma^*)^k \rightarrow \Sigma^*$, which represents the $k$-ary proper function of the Turing machine $M$. Is it the case that $\mathrm{ind}(\var... |
I want to prove, that 2OrMoreSAT is NP-complete. It's defined as follows:
A formula is considered strongly satisfiable if there exists a model such that two or more different literals in every clause evaluate to true.
$\textit{2OrMoreSAT} = \{\langle \phi' \rangle \mid \phi' \text{ is a boolean formula in CNF which is ... |
Data Structure
a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
Language has primi... |
Planar Convex Hull is a problem where you have $N$ points in a Cartesian plane, and you want to find the smallest convex polygon that encloses the points. QuickHull seems to be the best available algorithm for this, and it finds the hull in $O(N \log h)$ where $h$ is the size of the output.
Interestingly, Michael Shamo... |
Consider a flow network $G$. Let $(S, T)$ be a min-cut of $G$. Let
$(u, v)$ be an edge that crosses the cut from $S$ to $T$. Claim:
increasing the capacity of $(u, v)$ causes the value of the maximum
flow in $G$ to increase.
I'm 99% sure this is false, but I'm struggling to disprove it. Can anyone give me some tips t... |
My lecture notes for gomory-hu trees says that it's easy to see that every GHT of the utility graph $K_{3,3}$ is a star with 5 edges. Is there any easy way to see this without manually computing every gomory-hu tree of the graph? Could I make use of the symmetry of the graph?
|
Given a sequence of real numbers $\{a_1, a_2, a_3 \ldots a_n\}$, I wish to design a data structure that supports the following operations on it.
$\mathrm{REVERSE}(i,j):$ Reverse the contiguous subsequence $a_i, a_{i+1}\ldots a_j$ i.e. swap $a_i$ with $a_j$, $a_{i+1}$ with $a_{j-1}$ so on and so forth.
$\mathrm{REPORT}... |
I am just wondering how you would write out a proof that the independent set is the complement of the vertex cover. I know how to explain it in common language, just wondering what a more official proof would look like.
|
I am currently learning about context-free grammar, however, I am confused as to why context-free grammar is used over regular languages(Regular expression) and what makes CFG more powerful. Even though the structure is more complex than regular expressions. Any suggestion would be highly appreciated.
|
Thank you. I see how it makes sense going in the opposite direction but i need help proving that this is true.
Below is the definition of ATM.
ATM={<M,w>| a TM, M accepts w}
The question from my understanding is that a language needs to be reducible to ATM for it to be considered semi-decidable. What I've tried to do i... |
I have been led to believe that the following statement
$X \in NP \land Y \not\in NP \implies X \not\le^m_p Y$
Is True.
But I am having difficult proving it. And I'm not even sure it IS true anymore.
At first it seemed reasonable that it was true. Since X is in NP there must exist some NP-complete problem Z that it red... |
I know that languages that have LL(1) grammar also will have LR(1) grammar as LL(1) grammar can be written only for a subset of DCFL whereas LR(1) grammar can be written for all DCFL, but I wanted to know where LL(1) will fall if I had it put it along with LR parsers.
L1 is defined as languages for which LL(1) grammar ... |
I was reading Kleinberg's and Tardo's book (especifically, this one) and, on page 38, these authors define the Big-Theta notation the following way:
Let $f$ and $g$ be two functions that $\lim_{n\to\infty}f(n)/g(n)$ exists and is equal to some number $c>0$. Then $f=\Theta(g)$.
Then, they provide a proof that connects... |
The stack allows subroutines to be used. It can store return address for "return from subroutine" instruction (RTN) and also arguments for the function.
It is not possible to store return address in the program instruction list itself, because the subroutine might be called from many different places in the program, an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.