instruction stringlengths 35 29.1k |
|---|
Lets assume $2n $ gifts such that each gift $i$ has price $a_i$
The goal is to find a partition of the gifts into $n$ pairs such that each pair $P_i=\left(a_{i_{0}},a_{i_{1}}\right)$ has maximal minimum average IE $ \min_{i\le n}\left\{ \frac{a_{i_{0}}+a_{i_{1}}}{2}\right\} $ is maximal.
How to get a contradiction ins... |
I am trying to create the regular expression for the automaton named "full closure" in the following diagram using the arden's theorem:
Since, we have 3 accepting states, we would find 3 different regular expression and then just union them up. I was able to find regular expression for q0, q1 but facing issues when tr... |
Suppose I start with a directed graph, and remove any leaf nodes, and then repeatedly remove leaf nodes from the now-modified graph until there are no more leaves. Then I repeatedly remove root nodes as well. What is the remaining graph when there are no more roots or leaves? (Assuming it's not empty.)
I have an idea t... |
On the Wikipedia article on Karatsuba algorithm (https://en.wikipedia.org/wiki/Karatsuba_algorithm#Time_complexity_analysis) it is stated:
$T(n) = 3 T(\frac{n}{2}) + cn + d$
And then, by invocation of the "master theorem" it is deduced that $T(n) = O(n^{\log_2{3}})$.
My question is, is there an easy way in this case to... |
I have a very specific problem and Im desparate for help, I've been working part time on it for almost a year without almost any success, I'll do my best to describe it as thorough as I can
Our input data is an array filled with objects who have properties time and type. From now on I'll refer to them as "events". Tho... |
I can't seem to get my head around the formulas to use for size of binary tree. Depending on who I ask, what website, etc. I see different similar answers.
So if someone could explain simply either: the differences between these formulas, the cases to use one or another, or any other explanation. It would be greatly ap... |
I am reading about Kruskal and analysing it’s time complexity.
Let’s say there are E edges and V vertices.
Kruskal algorithm has two important time complexity equations ,
Sort edges- Elog(E)
For whether edge from v1->v2 , apply find(v1) and find(v2). If cycle exist don’t connect. Other wise connect them. - E*timecompl... |
I want to split the main part(like people) in optical flow from the background, but I don't konw how to start.
I think one way is to use some kind of clustering algorithm, first split the optical flow image into small patches, define the distance function and use clustering algorithm to aggregate them. But I don't know... |
the following question came up in a problem I am working on:
Suppose you have two graphs $G_1=(V_1, E_1), G_2=(V_2,E_2)$ that have features attached to them, i.e. to every $v\in V_1$ or $v\in V_2$ there is a vector $w_v\in\mathbb R^n$ with fixed $n$ of features mapped to, and similarly for all edges. We call two of the... |
Problem Description
Given $a, b, n \in \mathbb{N}$ with $a < b < n$.
Let $M$ be the set of all possible bit strings of length $n$ which begin and end with one and have at least $a$ and at most $b$ zeros between every pair of successive ones:
$$
AZ_s(x, y) :\equiv s_{x} = s_{x+1} = \ldots = s_{y} = 0 \\
M := \left\{s \i... |
In this question, I'm going to introduce a prime factorization algorithm which I'm working on as my personal project.
I may attach a Python code to introduce the algorithm. If it contravenes the rule please let me know, I will consider it editing as a pseudo-code or substitute it with some link.
import timeit
import gm... |
I have just implemented a parser on the relational database. Parsing is done with recursive query. Note: one commenter was misled by the word "recursive" before "query" to think "recusive descent". But no. I am not talking about recursive descent top-down, I am talking about bottom up, LR, simple, no look-ahead, driven... |
It is known that the $\mathbf{P}\overset{?}{=}\mathbf{NP}$ problem is equivalent to asking whether there exists a polynomial-time Turing machine that decides an $\mathbf{NP}$-complete problem. Let's say this problem is subset-sum. Now I'm considering enumerating all the Turing machines with fewer than $s$ states. Since... |
Is there a number $\alpha < 1$ such that the independent set problem is polynomial for input graphs whose independence number is at least $\alpha n$ (where $n$ is the number of vertices)?
|
If one proves that the lower bounds of an $NP$ problem, are not bounded by any polynomial, is this enough to prove that $P$ does not equal $NP$?
|
We want to distribute 3*n known cards among 3 players evenly given a set of constraints that prohibits some players from having certain suits.
For example:
We want to distribute 1H, 2H, 3S, 4S, 5D, 6D (second letter refers to suit of card) among three players A, B, C such that A does not get any card of suit Hearts.
Is... |
I'm trying to optimize a practical problem in a database query. Suppose we have a db tableProducts and each product has a few numeric properties. I save the properties values in a different table ProductProperty table because the user can add more property types. The user wants to look for products using range filters ... |
Build a context-free grammar for the language:
$L=\{\#x\#y\#\,\,;\,\,|x|=|y|\,\,\wedge\,\,x,y\in\{0,1\}^{*}\}$ over $\sum=\{0,1,\#\}$
How can I make sure that |x|=|y|?
|
Build a context-free grammar for the the complementary language of:
$L=\{ww^{R}\,\,|\,\,w\in\{0,1\}^{*}\}$
I think $L^C$ is the set of all strings that are not palindromes,
but I don't know how to start building the grammar.
Attempt:
S→ A | B
A→ AAA | 0 | 1
B→ 0C1 | 1C0 | 0B0 | 1B1
C→ 00C | 01C | 10C | 11C | ε
|
Imagine that I have an algorithm written in C that is of, let's say, 10,000 characters in length. Such a program can be simulated on a turing machine (Wikipedia:
Anything a real computer can compute, a Turing machine can also compute. For example: "A Turing machine can simulate any type of subroutine found in programmi... |
There are several players at the end of the poker night with wins and losses, with zero sum. What is the optimal solution to settle the balance that minimize the total number of transactions (eg. if we consider a transaction as a venmo payment).
name | balance (N means how much net win, negative means lost)
A | -2... |
Given 2 integer $M$ and $N$, a recursive modulo is $M \bmod (M \bmod (M \bmod ...(M \bmod N)$ until the result is 0. What is its time complexity?
I guess that it's $O(log(M))$ but I can't prove it.
|
I have to prove whether a certain property is safety or liveliness. The property represents the absence of deadlock so I expected it to be a safety property from what I read online.
The issue is that I seem to show that it is both, but this is impossible as the only property that is both safety and liveliness would be ... |
In a database systems course, we have been presented with the following definition for third normal form (3NF):
A relation $R$ is in 3NF means:
a nontrivial dependency $A_1,\dots,A_n\to B_1,\dots B_m$ can hold in $R$ only if
$\{A_1,\dots,A_n\}$ is a key (either minimal or super) in $R$
or
for $1 \leq i \leq m$, each $... |
The problem I am trying to solve is that there is an underlying undirected graph G = (V, E) with weights on the vertices, where the weight on vertex v is
denoted by wv = d(v) (the degree of the vertex). My goal is to find a vertex cover set U (a set where for every e = (u, v), one of vertices u, v is in U) with the min... |
In depth first search each vertex can be associated with a discovery time and a finish time. I am reading the following implementation of topological sort in terms of depth first search
TOPOLOGICAL-SORT(G)
1 call DFS(G) to compute finish times for each vertex
2 as each vertex is finished, insert it to the front of a li... |
I am working on a Sparse Autoencoder but Andrew NG's notes are hard to understand.
My question is about the following equation: Loss Function.
In sparse autoencoder, the goal is to inactive some nodes to obtain low-level features or more precise features. Now if you check Andrew NG's Notes on sparse autoencoder (avail... |
Assume that I have designed an algorithm A, which runs two sub-methods: M1 and M2.
M1 has a O($n$) expected time complexity.
M2 has a O($n^2$) time complexity.
Clearly A uses O($n + n^2$) = O($n^2$) time. Since $n^2$ > $n$, in terms of time complexity, should A be described as having an expected time complexity of O($n... |
I am wondering, what is the top type, $\top$, in JavaScript? The diagrams at MDN make it look as if 'null' is a top type, but wikipedia's entry for top type indicate that it is Object in JS, which makes more sense. Am I misreading the MDN article?
|
i got this question in a theory of computation quiz "give pda for a^(n) b^(2n) c^(2n) d^(n)"
i am arguing that there is no pda for that question but our ta says that we can push 5x to the stack then pop x each time we read a b or c or d. i am arguing that doesn't guarantee count because we might get only "d"s which one... |
I'm currently studying virtualization and while looking at hypervisors I realized that bare metal hypervisors are quite similar to operating systems.
So while from an application standpoint they are different, can an operating system theoretically be viewed as bare metal hypervisor?
|
The Kind programming language has a sufficiently powerful type system to support proving theorems like in Lean, Coq, Idris, or Agda. I've seen it said that Kind has an even more powerful type system that goes beyond what these other languages support. Since Kind is a work-in-progress, I've struggled to find documentat... |
Problem statement
We're given a directed simple acyclic graph with weighted vertices. Find an edge $e$ such that reversing it would create a strongly connected component (SCC) whose price is maximal. The price of an SCC is defined to be the sum of the weights of its vertices.
In the example below, reversing an edge $(7... |
What problems belong in NSPACE(n^2) and DSPACE(n^2) class? Examples?
|
As I understand, all modern CPUs perform register renaming: given a sequence of instructions to interpret, they check which registers these instructions use, detect patterns where a register's previous value is overwritten, and then map the instruction sequence so that each instruction's "architectural" register is map... |
We have a set of people, and each person has a list of wished items (not unique, they could want multiple copies of each item). We have an inventory of items that we want to assign to the people. We want to maximize the number of people who receive all the items on their list. The inventory may not have enough items to... |
In statistical computing, we often have linear models that involve computing multiple vector dot products, but there's a high amount of redundancy in the operations when you break them down. As an example, let X be the following 12x3 matrix:
[[-1,-1,-1]
,[-1,-1,1]
,[-1,1,-1]
,[-1,1,1]
,[0,-1,-1]
,[0,-1,1]
,[0,1,-1]
,[0... |
Knowing that $log(n!) = \theta(nlogn)$
|
Let $H=\left( E_0 ,E_1 ,E_2 , \ldots , E_d \right)$ be a $d$-dimensional full-hyper graph/complex. That is to say, if for some $i\in \left[d \right]$ the hyper-edge $e_j \in E_i$ than for any $i-1$-dimensional $e_k \subset e_j$: $e_k \in E_{i-1}$. The vertices are $E_0$, the hyper-edges between $2$ vertices are $E_1$, ... |
(I haven't read any literature on this paradox nor am I good at formal proofs, so this is just my intuitive thoughts on the paradox.)
If we assume the statement "This statement is false" as a function f() on a state machine M, where M has 2 states S0 and S1 representing false and true, we'd just be evaluating M.f() in ... |
For any 2 strongly normalizing terms in the Simply Typed Lambda Calculus, s and t, is st also strongly normalizing? And why? I'm a bit confused as this is used in a proof regarding strong normalization and the typable lambda calculus, but I have not been able to show that this is the case. Any help would be much apprec... |
I am interested in tight bounds for the Parallel Machine scheduling problem with a gang scheduling constraint.
In the notation of Graham, Lawler, Lenstra and Rinnooy Kan, this might be called $Pm|\rm{gang}|C_{\rm{max}}$.
There are $m$ identical machines, and $n$ jobs. Each job has both a processing time $p_j$, and a g... |
Previously, I've asked a question about coinduction. That gave me a lot of useful high-level insights on what coinduction provides, and what are the usefulness of coinductive proofs.
This question is about walking through an example in more detail. The example is based on this other question "What is coinduction?". I'l... |
In a hypothetical scenario, where a precise and formal definition does not exist here, and thus expressed with analogies and verbal reasoning for the sake of simplifying the P, NP problem.
A(lan) Turing Machine arrives to the "Universal-Algorithm-Island", and meets Christopher, an oracle with a True or False response.
... |
I have a matrix of size NxM.
Each coefficient can have either some fixed value or a joker denoted by *
Let's take two random rows. We are going to loop through the columns. For each column, either we color it green or in red.
We color using red when the two values in the same column have an intersection, i.e. either ... |
There are two types of sets $\mathcal{X} = \{X_{1}, X_{2}, \ldots, X_{n_{1}} \}$ and $\mathcal{Y} = \{Y_{1}, Y_{2}, \ldots, Y_{n_{2}}\}$ such that $X_i, Y_j \subseteq [m]=[\mathrm{poly}(n)]$ and $n = n_{1} + n_{2}$.
Given a sequence $\alpha$ over $\mathcal{X} \cup \mathcal{Y}$, the goal is to find the longest (increasi... |
I am new to Linear Programming and Approximation algorithms. and I am trying to do this exercise for writing an IP and relax it to LP. What I am given:
A digraph G = (V,E) with wv being the weight on vertex v for every v ∈ V.
A multi-set S is a set such that it contains elements more than one time. Suppose from a dir... |
I have read that 1NF, 2NF and 3NF decompositions are lossless and dependency-preserving.
Consider this example on a relation $R(A,B,C,D)$ with functional dependencies set as $FD =${ $AB \rightarrow CD, A \rightarrow C, BC \rightarrow D$ }
Here when we do 2NF decomposition we get $R_{1}(A,C)$ with $FD =${$A \rightarrow ... |
So i'm defining the embarassingly parallel complexity class as the set of decision problems which can be solved in time $O(T(n))$ on a single computer and in time $O(T(n)/g(n))+O(\log(g(n))$ if you have access to $O(g(n))$ machines where $g(n)$ can be of a total size up to $T(n)$.
So these are the types of problems, wh... |
In my OS course, the instructor mentioned the following: In UNIX if a parent process creates a new child ("fork") then the child is an exact duplicate of the parent. This means its memory space is a copy of the parent's.
Now if the child process immediately calls "exec", it replaces its own memory space with that of a ... |
I am currently reading reading Chapter 11 of Operating Systems: Principles & Practice by Anderson and Dahlin, which speaks about file systems as abstractions for non-volatile storage.
The distinction between files and directories is first made. Afterwards, in examining what files are, a distinction between file data (i... |
Donald Knuth's The Art of Computer Programming, Volume 1 Fascicle 1 contains the following exercise:
If $\alpha$ is any string of 0s and 1s, let $\operatorname{s}(\alpha)$ and $\operatorname{u}(\alpha)$ be the integers that it represents when regarded as a signed or unsinged binary number. Prove that, if $x$ is any in... |
I understand that pumping lemma can only be used to prove that a certain language is "non-regular", it cannot be used for proving regularity
But since, it's a property of regular language, we should be able to pick up a language that is regular, literally, and then see if this property exists in that language, which sh... |
One popular algorithm to find the Voronoi diagram out of a collection of points (sites) in the plane is Fortune's algorithm. It is usually described in terms of a sweep line, whose interaction with sites give raise to parabolas, whose intersections eventually provide the Voronoi diagram.
The Wikipedia page also include... |
In a project of mine, I want to represent states as efficiently as possible. Initially, I went ahead with a BitBoard representation and some clever tricks to speed up the evaluation of the game tree. That works fine. Though when looking up any given state in the Look-Up table, I need to do some heavy calculations.
Afte... |
Prove or disprove: f(n-1) is omega(f(n)).
I actually need a more specific example of this but I thought this claim was interesting.
I want to know if (n-1)log(n-1) is omega(nlogn)
|
I'm learning how to write my own theorem prover. After skimming Decision Procedures (Kroening & Strichman, 2016), I didn't find any SMT algorithms for solving quantified n-ary predicate formulas. I realize that some quantified predicate formulas with an arity above 2 are undecidable. But I'm not sure if all of them are... |
I have this grammar:
E -> E + T
E -> T
T -> T * F
T -> F
F -> ( E )
F -> id
And this is the state diagram for it:
I tried to construct a parse table and I am getting shift/reduce conflict. More specifically in state 2 I can shift *. Also, FOLLOW(LHS) = FOLLOW(T) contains * so I can also reduce using rule 2. Hence shi... |
I’m reading Leslie Lamport’s white paper, “Time, clocks, and the ordering of events in a distributed system”. His explanation for total ordering has me a bit confused in the following excerpt.
I've interpreted this as if event x's timestamp is less than event y
then x happened before y.
If x's timestamp is the same a... |
I was wondering if there are any mathematical functions or algorithms that take a known minimum amount of time to calculate. The closest thing I could find to this is Proof of Work algorithms used for blockchain, but the speed at which hashes for these are calculated is affected by device hardware. I'm interested to kn... |
In the SKI combinator calculus, Kxy returns the constant function which always returns x. Since y is always ignored, why not just define K as having a single parameter, namely, x? What is the purpose of having a variable y which is guaranteed to be ignored by K? I'm guessing that there would be some deleterious effect ... |
I apologize if I did not use the terminology entirely correctly in the title. This problem seems to me quite similar to an assignment problem and likely something that occurs in real life in business.
The problem:
In this problem, we have a set of assets (in the economics/finance sense) $\left\{ a_i \right\} $ with va... |
It is known that the general traveling salesman problem is NP-hard. Even when the distances follow the triangle inequality. But let's take the problem very literally. There are actual cities (points) on a 2-d euclidean space and a tour must be devised to visit all of them in the smallest total distance. We are given th... |
Is there a reason why you cannot use flash memory as a HD? Less moving parts and more affordable. Whats not to like?
Why dont we see Pci-express cards with a couple of terrabytes of flash memory that you can use as a HD?
|
If L is NP-complete then how can I prove that $L_1$:
$L_1= (1$ { $0, 1$ }$^∗) \cup ${ $0x | x \in L$}
is also NP- complete.
My thoughts: A reduction from (for example) SAT to L can be converted to a reduction to { $0x | x \in L$} by adding a 0 to the output.
|
I have a PhD in theoretical physics, where I had worked on mathematical models of hydrodynamics around compact objects. I have basic knowledge of programming in C/C++ and Python. Currently, I am more interested in computational work, particularly on numerical simulations and machine learning algorithms for data mining ... |
The question is in the title. What do you call "root nodes" in directed graphs. Is there a commonly accepted term? "Root" implies there's only one, which is not the case. I've scanned half a dozen glossaries before asking. I'm starting to suspect that no, there's no agreed moniker.
|
I am working currently on Path-Packing problems and found this Book:
https://jeffe.cs.illinois.edu/teaching/algorithms/book/Algorithms-JeffE.pdf
My question is about exercise 23b on page 184.
Here is a description of the problem :
Assume $T$ is a tree (T is not necessarily a binary tree) with $n$ nodes and root node $r... |
I'm interested in this functions
\begin{align*}
g(m) &=
\begin{cases}
\text{defined} & \text{if turing machine $m$ computes $g$} \\
\text{defined} & \text{if turing machine $m$ loops on $m$} \\
\text{undefined} & \text{otherwise} \\
\end{cases}
\end{align*}
\begin{align*}
f(m,n) &=
\begin{cas... |
The class DP is defined as the set of languages L for which there are
two languages $L1 \in NP$ , $L2 \in coNP$ such that $L = L1 \cap L2$. (Do not
confuse DP with $NP \cap coNP$, which may seem superficially similar.)
Show that
(a) EXACT INDSET ∈ DP.
(b) Every language in DP is polynomial-time reducible to EXACT INDSE... |
Prefetching is a task that the compiler feels like it should be suited for. Prefetching requires knowing in advance what data the program is about to load, and the compiler has a ton of information at its disposal about control flow and what data the program is likely to access in the new future.
And yet, when I could ... |
I have the following alphabet $\Sigma = \{0,\dots,9\}$ and the following language over $\Sigma \cup \{\#\}$:
$$L=\{\#w \ |\ w \in\Sigma^*,\sum_{i\geq1}w_i\ \text{is prime}\}\\\\$$
This language represents all numbers wich have a prime as digit sum. I now want to show that this language is not context free. I want to s... |
Can't understand how to apply pumping lemma to see if a language is context-free or not.
I tried to verify the context-free's pumping lemma, and the language seems to be not context-free but I can't understand if I'm correct. I tried writing all factorizations, but I don't know when I have to stop or if there's a way t... |
We know according to the pumping lemma if a language is regular, then a string already exists and it can be separated into 3 parts ( called decompositions ), 1 string can have multiple decompositions.
If we were to cross check this property with, basically prove for regular langauges, then we would need to prove it for... |
(Initially this question was on cstheory, but I was told cs would be a better fit, so posting it here.)
All other things being equal, which of the following languages would be more challenging to design a compiler and/or interpreter for? (If the answer would vary depending on whether one is designing a compiler or inte... |
Show that the following language or problem is not recursive:
$$
L=\{\langle M,w\rangle\mid \text{computation of TM } M \text{ on input } w \text{ uses all states of } M\}
$$
I was trying to prove it using reduction, but I cannot seem to find a language to reduce it to. I also tried it for the complement of L:
$$
\over... |
Seth Lloyd claims in this video that free will stems from our impossibility of determining how a system capable of self-reference will behave in the future (e.g. whether a human being will have chosen to drink tea or coffee in 5 minutes). He relates this to Gödel's incompleteness theorem in a way that seems completely ... |
Please note I don't use any of the "verifier" notation, I only concern definitions made with DTM and NTM .
Now there are two definitions of decidability:
1. A set (predicate) is decidable (solvable) iff exist a machine (DTM/NTM) M(x) that accepts iff x∈A, and rejects iff x∉A. i.e. if it halts correctly against all inpu... |
Can you please explain to me why the following is true?
Ιf 3SAT reduces to its complement then NP=coNP.
Thoughts:
3SAT is NP-complete so for every X in NP
$X \leq 3SAT$
$\overline {3SAT} $ is NP-complete so for every Y in coNP
$Y \leq \overline {3SAT} $
So,
$X \leq 3SAT \leq \overline {3SAT}$
But don't we have to also ... |
Consider $N$ points that are located on a 2D plane where the $i$-th point’s location is denoted as $(x_i, y_i)$.
Is there any efficient algorithm that can compute $d_i$ that is defined as the number of points with $x<x_i$ and $y<y_i$ for all $i$? In other words, we would like to count the number of points on the lower ... |
I am wondering if my solution is correct or I am on the right track. I have searched online and found a paper about Java type system being unsound but that doesn't really answer the progress and preservation issue.
Question:
Give a non-obvious problem in the language definition that would prevent “progress”
from being ... |
If we have a regular expression $R$, will $R$ describe only regular language $L$, but that language $L$ can have multiple different regular expressions such as $Q,W,A,S,D \ etc..$ describing it
Also, $R$ can be equivalent, in terms of describing $L$, to infinite regular expressions including $ Q,W,A,S,D \ etec..$
Is my... |
Let's say that we have a DFA, where the initial state was also the accept state. Meaning the DFA accepts the "empty string". Now, let's say that we convert the DFA to regular expression $R$, using Arden's Method ( my prefered method )
Now, the resultant expression looks something like $(R)^*$, which is obviously capabl... |
I have a sequence of integer tuples $t_1, t_2,..., t_N$ of different sizes in lexicographic order, e.g.:
$(1, 1), (1, 2), (1, 3, 5), (1, 3, 6), (1, 5), (3), (3, 2, 3), (3, 7), (3, 8, 1), ...$
sequence length is $N \le 10^9 \space (2^{30})$,
a tuple size bounded by $S, |t| \le S \le 32$,
$i$-th element of a tuple is bo... |
It's an exercise question from chapter 0 of Michael Sipser's book Introduction to the Theory of Computation.
e. The set containing the empty string
f. The set containing nothing at all
I guess the empty string is still something, which is not nothing. Would this be the difference?
|
I am doing an exercise related to maximizing Independent Set, I have $G = (V = \{v_1, . . . , v_n\}, E)$ as an undirected graph. This graph as $n!$ possible orderings for the vertices $V$.
If we pick any such orderings uniformly at random i.e. let $\sigma = (\sigma_1, . . . , \sigma_n)$ be such random ordering then con... |
Intuitively speaking, it would seem like the graph isomorphism problem (which might be $NP$-intermediate) should be $P$-hard. But maybe it's not? Or maybe it's an open question?
If it is indeed $P$-hard, how can that be shown/argued?
Doing some searching, I found the following statement in the Wikipedia article on the... |
I was wondering, in terms of complexity and "precision", what are the differences, if any, netween the computation of
$$2R \sin(\alpha)\cos(\alpha) \qquad \qquad \text{and} \qquad \qquad R\sin(2\alpha)$$
It's the same thing, for it is a goniometric identity. So are there differences in terms of order of complexity, com... |
I am a researcher starting to work on the field of parsing and recognition of languages.
As part of my background research, I am reading up on CYK. I understand that it requires the grammar to be in CNF. This however, is restrictive, as it forces the grammar to be restructured to remove $\epsilon$ rules from arbitrary ... |
I have N nodes, a node might have an undirected edge to other nodes, resulting in K connected components (K<=N, K unknown).
I can test if a given pair is connected. In each step in time, I can run N/2 such tests in parallel (a given node can be tested once per step). Each connected component is a cluster graph (it has... |
Why sometimes we would want to convert generic trees or forests into a binary tree? And what's the main principle behind this convertion?
|
Say you have a directed graph consisting of n nodes and containing edge weights. A starting node is also given. You want to begin your route at that node and visit each other node in the graph exactly once before returning to the starting node. Your goal is to take the route that has the smallest sum of edge weights po... |
I am having some difficulties understanding how the remove() operation works step by step with the splay tree. My tree looks like so:
2
/ \
1 13
/
10
/
9
/
5
now I want to remove(10) and get the following tree (9 is the previous item from in-order traversal, s... |
I heard in my lecture that there are non regular languages which meet the requirements for the pumping lemma for regular languages but I never actually saw one. Does anybody have an example?
|
Consider the geometric set cover problem https://en.wikipedia.org/wiki/Geometric_set_cover_problem.
The Wiki article says there is a simple greedy algorithm for the one-dimension case, what is the analysis of that?
Is there a constant approximation factor possible for the one-dimensional case if each of the sets in the... |
I see why ordinary Horn clauses (of the type Prolog might accept) are first order eg something like (with all variables universally quantified)
$$
P(x) \leftarrow Q_1(x),Q_2(x,y).\\
P(x) \leftarrow Q_2(x,y),P(y).\\
$$
(I'm using the conventional notation of upper case for constants and lower case for variables, rather ... |
Pierce's Types and Programming Languages has the following definition of terms:
$$S_0=\emptyset$$
$$S_{i+1} = \{true,false,0\} \cup \{succ(t), pred(t),iszero(t)|t \in S_i\} \cup\{if(t_1)then (t_2)else(t_3) |t_1,t_2,t_3\in S_i\}$$
So then that means this language has terms like $succ(false)$ and $if(succ(0))then(true)... |
Consider the geometric set cover problem https://en.wikipedia.org/wiki/Geometric_set_cover_problem.
The Wiki article says there is a simple greedy algorithm for the one-dimension case, what is the analysis of that?
I have already asked this question before: Geometric Set Cover in one dimension which was answered. I ask... |
This is a follow-up question to my previous question
I have been reading this post and it comes up with the following example showing how Java type system is unsound:
interface IFoo<T> {
Number foo(T t);
}
class Foo<T extends Number> implements IFoo<T> {
public Number foo(T t) { return t; }
}
Number bar(IFoo<St... |
Prove the $NP$-hardness of $CONNECTEDNESS$ - the problem of counting over an oriented graph $G$ and two vertices
$s$ and $t$ the number of subgraphs of $G$ in which from $s$ to $t$ can be traversed by an oriented path. Does the corresponding problem of recognition in $P$? If necessary, one can use the $NP$-hardness of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.