instruction stringlengths 35 29.1k |
|---|
For brevity, let $s(D) = \sum_{d\in D} d$ denote the sum of the elements in $D$.
Given a set $A = \{a_1, \dots, a_n\}$ of positive integers, and a target value $K$, the subset sum problem is to determine if there exists a subset $A' \subseteq A$ such that $s(A') = K$.
Given a set $B = \{b_1, \dots, b_m\}$ of positive i... |
I'm trying to understand how to prove a language is regular or not regular, for example this language: $$L=\{a^nb^m:n,m\in\mathbb{N}\land n-m=5 \}$$
Is this language regular or not?
My solution
Using the pumping lemma, I can choose a string with a pumping length $p$ like: $w=a^{5+p}b^p$, then $x = a^j, y=a^l$ and $z=a^... |
My question concerns the version of the Master Theorem described in CLRS and in this handout.
I already understand the following:
If the regularity condition in case 3 does not hold, then we can't apply case 3.
If the regularity condition in case 3 holds then $f(n)=\Omega(n^{\log_ba\ +\ \epsilon})$ is definitely true.... |
Given an array of N non-negative integers, and a number K, we need to find two non-overlapping contiguous subarrays that have a total sum of K. Our algorithm is supposed to find the minimum total length of the two subarrays that have total sum K.
Also, after I checked the biggest test cases that we got, N doesn't go ab... |
Can someone tell me what the rules are for moving log or exponents into the $O(n)$ notation so it is still correct?
For example: Is this $\log(O(n))= O(\log(n))$ correct? Or is this correct $O(n)^2=O(n^2)$? Or am I not allowed to do this?
|
Consider a boxing match between players A and B. If A wins, then $1$ point is gained; otherwise $1$ point is lost. Assume that $A$ is as same good as B. Denote by $X_t$ the expected point of A at time $t$, then the assumption means that $(X_t)_{0\le t\le T}$ is a Markov martingale. The match ends if either of the two c... |
I've been trying to implement a program for matrix multiplication of multiple of 4 (ex: 4x4, 8x8, 16x16, etc.) and while I my program works for 4x4 matrix, it only fills the first 4 row of every other matrix (which are filled with the proper value).
My guess it's because I don't have the proper algorithm implemented, ... |
This is the knapsack problem where the items are unlimited. Let $K(w)$ be be the maximum value achievable for the knapsack capacity of $w$, and $w_i$ and $v_i$ are the weight and value of the item $i$. My textbook (Algorithms from Dsgupta et al.) boldly that
If the optimal solution to $K(w)$ includes item $i$, then re... |
I wish to construct a sequence of unlabeled binary trees $T_n$ satisfying the following properties:
$T_n$ has $n$ leaves
$T_n$ is well balanced (height $\lg n+O(1)$)
$T_n$ is obtained from $T_{n-1}$ by one of the two operations $t\to (t,\ast)$ or $(t,t')\to (t,(t',\ast))$
In other words, we are limited to right inser... |
How can it be proved that two different kinds of dfs ( for example let call them inorder and postorder) unequivocally define a unique tree?
Let's say we have two dfs arrays:
A0(inorder) = {a01, a02, a03, ... a0n};
A1(postorder) = {a11, a12, a13, ... a1n};
So can we say that the pair {A0 and A1} defines a unique tree, ... |
I believe problems like quicksort and other divide-and-conquer are problems that have optimal substructure but do no have any overlapping subproblems. I hope I'm correct here. But I'm unable to think of some examples of overlapping subproblems that don't have an optimal substructure.
|
Out of the following, which type can cause problems with encapsulation?
A. Int
B. Int[]
C. String
D. non of the above
I chose D and was incorrect. I am kind of confused what this questions is asking about... I just began to learn about the encapsulation and it seems it's just to keep the fields private and not changea... |
Preface: I know there are a lot of posts already here and elsewhere about algorithms for solving quadratic Diophantine equations in general. I am posting this in the hope that my very particular case might allow an approach much simpler (both in time complexity and the need for me to relearn combinatorics) than those f... |
In our course: Automata and Computation there is a definition about Context-Free Grammars which states:
"Two CFG's $CFG_{1}$ and $CFG_{2}$ are equivalent if $L_{CFG_{1}} = L_{CFG_{2}}$ where $L_{CFG_{i}}$ is the language that is derived by $CFG_{i}$".
Below the definition, it is stated that this defines an equivalence ... |
It's fairly well known that $REG \in TIME(n)$. I would like to know similar inclusions for the language classes $DCFL$ and $CFL$.
I have found a variety of claims for these classes on the internet. For instance,
In this diagram of the arithmetic hierarchy, it is claimed that $DCFL \in TIME(n^2)$ and $CFL \in TIME(n^6)... |
I'm starting a job soon that involves a large number of disciplines interacting at once. I'm knowledgeable in most of these areas; at least enough that when I don't know something I know how to look it up. There is however an element of distributed computing involved in my new job and I don't think I'm as prepared for ... |
So I'm trying to solve this problem(problem 8 from section 3.4) of the book Computability, Complexity and languages by Martin Davis:
Let k be some fixed number, let f be a function such that f(x + 1) < x + 1 for all x, and let
h(O) = k
h(t + 1) = g(h(f(t + 1)))
Show that if f and g belong to some PRC class C, then so... |
Can you make interesting decentralised systems, e.g. cryptocurrencies or serverless games, that aren't susceptible to 51% attacks by design? (Rather than, as I've seen proposed, external solutions like fining mining pools that have too large a hashing power)
|
I'm looking for a data structure that supports the following operations:
add(elem) - Add an element to the data structure.
remove_random() - Remove and return a random element.
The best I got so far is just shuffling a list on every insertion (or on every lookup), and popping from the top. However, this can be quite sl... |
I am currently dealing with a network flow problem and I am trying to find some similar solved problems to help me formulate my solution.
The text is:
You are the owner of a large chain of franchise shops, and you would like to expand to a new city. The blocks in your
city make an $n ×n$ grid. However, although your pr... |
I've red that a binary heap can be implemented using a priority queue. I've also red the opposite, that a priority queue can be implemented using a binary heap.
This seems strange to me as conceptually they are different: a priority queue is a linear data structure with a priority assigned to each element, whereas a bi... |
I'm reading though The Algorithmic Foundations
of Differential Privacy and the authors define a database in a mathematically convenient way. Unfortunately I'm a little confused about what the definition actually means in practice.
From page 17 of the pdf:
We will think of databases $x$ as being collections of records ... |
I'm trying to solve this discrete optimization problem:$\newcommand{\I}{\mathcal{I}}\newcommand{\R}{\mathbb{R}}$
$$\max_{|\I| \le k} f(\I) \qquad\text{where}\; f(\I) :=x_{\I}^{\top} (\Sigma_{\I})^{-1} x_{\I}.$$
Here
$\I \subseteq [d] = \{1, 2, \dots, d\}$;
$x \in \R^d$ is a fixed vector;
$\Sigma \in \R^{d \times d}$ i... |
My question is for (c), as I struggle to find an algorithm that can do this in O(m) time.
|
We are given two Turing machines $M_1$ and $M_2$ and we wish to decide whether the union of the language $L(M_1)$ accepted by $M_1$ with the language $L(M_2)$ accepted by $M_2$ coincides with $\Sigma^*$.
Is this problem undecidable? In other words, is the language $\{ (M_1, M_2) \mid L(M_1) \cup L(M_2) = \Sigma^*\} $ ... |
A common way to resolve a dependency graph is to compute an execution order, and then execute each stage in turn - storing and fetching the resources as necessary. In this example, when executing stage E we know that stage B is present in the cache due to the execution order. At the end of execution, the output of ever... |
I have a similar question as this post:Given a complete, weighted and undirected graph $G$, complexity of finding a path with a specific cost
My question: Given a weighted and directed graph $G$, it might contain negative cycles, is there a simple path(no repeated vertices) from $s$ to $t$ with total weight at most $T$... |
I want to model the following procedure. Given a shape $L\subseteq\mathbf{R}^2$ (imagine e.g. a letter) and another (could be convex if it makes life easier) shape $K\subseteq\mathbf{R}^2$, I want to compute $\{p\in\mathbf{R}^2: ((1-1_L)*1_K)(p)=0\}$ (in terms of convolution) or $\{p\in\mathbf{R}^2:\forall k\in K:p+k... |
I am currently dealing with a problem that I believe to be a Greedy releated problem and I'm trying to find some similar problems in order to solve it. I would like to have some hints or resources to study because I'm stuck on it. The text is:
You are tasked with creating a competitive programming squad, selecting stud... |
According to DFS algorithm for graph traversing:
DFS(G)
for each v ∈ V (G)
v.mark = false
time = 0
for each v ∈ G.V
if not v.mark
DFS-Visit(v)
DFS-Visit(v)
v.mark = true
time = time + 1
v.d = time
for each (v, w) ∈ E(G)
if w.mark == false
w.parent = v
... |
I know that we can compute $x^n$ in $\log n$. Are there any lower bound for computing $x^n$?
|
Recently, I studied how to prove a problem is NP-complete. From the book Introduction to Algorithms (CLRS, 3rd edition), there is an example of reducing vertex cover to Hamiltonian cycle. I believe that it is possible to directly reduce clique to Hamiltonian cycle in an undirected graph, but how to convert it in polyno... |
I was surprised to hear that the threading module from python uses OS level threads. From what I know, OS level threads are more expensive (but can achieve parallelism) meanwhile green threads are user-level, more lightweight, but can only achieve concurrency but not parallelism. Why doesn't the python virtual machine ... |
I have a DAG graph which contains two types of nodes, A and B.
I am looking for a graph partitioning algorithm that can partition a graph in sub-graphs such that each sub-graph contains up to X number of node type B. For example, given this graph, I need to partition it topologically such that each sub-graph contains u... |
I'm new in programming, I'm currently studying programming languages.
I'm trying to implement Shallow Binding with static scope, starting from an abstract syntax (producing a programming language based on Ocaml with static scope).
According to "Programming Languages: Principles and Paradigms" (Maurizio Gabbrielli Simon... |
Please correct me if im wrong but this is how I think quantum computers work.
Say we have a q-bit. The q-bit is put through a quantum gate to put it into a superposition and manipulate its probabilities.
We can represent this q-bit just like a normal bit on a vector where a normal bit would, when represented on a circl... |
Let $\Delta = \lambda x.(x)x$ and consider $\Omega = (\Delta)\Delta$. Then $\Omega$ is exactly the only $\lambda$-term of the form $(\lambda x.t)v$ such that $(\lambda x.t)v=t\{v\ /\ x\}$.
Does someone have references about this statement ? I could not find something enough relevant in my ressources or in my lectures m... |
I am stuck with the following exercise:
Is it possible to decide whether a given flow $f$ is a unique mamimum flow in $O(\lvert V \rvert + \lvert E \rvert)$ time?
I am not sure that this is possible.
I understand that we can check in $O(\lvert V \rvert + \lvert E \rvert)$ time whether $f$ is maximal. (Just build the ... |
Here's the statements of problem A, "ABC String" in Educational Codeforces Round 105 (Rated for Div. 2)
You are given a string a, consisting of n characters, n is even.
For each i from 1 to n $a_i$ is one of 'A', 'B' or 'C'.
A bracket sequence is a string containing only characters "(" and ")".
A regular bracket seque... |
I wanted to ask here a question about a simple algoirhtm to compute a div d and a mod d. My doubt specifically depend on negative numbers:
Doesn't the algorithm get wrong results for $-4$ and $2$ for instance, since the reminder of that division is 0? In this case the algorithm should give a quotient of $2$, But i ima... |
I have a polygon as a set of coordinates (fex [(0,0), (1,0), etc.). I'd like to find a way to divide this into as few rectangles as possible. The background for this is that I wish to have a user interface where the user can select a specific area on a map (a polygon). The frontend will send the coordinates describing ... |
Assume that there is a maximal matching of size k in an bipartite graph, G=(U,V,E). I now want to utilize this maximal matching in order to find a maximal matching in the bipartite graph where we add some node u to U and some edges (u,v_1),...,(u,v_n), where v_1,...,v_n are vertices in V.
I have figured out that such a... |
Came across the following question. All the answers provided there have used brute force, more or less. My hunch was that it could be solved using dynamic programming or perhaps, network flow algorithm. I am writing my unsuccesful attempt at solving it using dynamic programming at the end of this thread. What is the ri... |
For:
$$\sum^{k}_{i=1} \log(x_i)$$
where:
$$\sum^{k}_{i=1} x_i = n$$
Is there any big-$O$ result in terms of $n$ ?
I found this, but is not what I'm looking for.
|
I have about 200'000 data points distributed on the unit-sphere.
Aside of each point's location on the unit-sphere, it has also assigned a width and height.
I can perform nearest-neighbor queries by placing the cartesian 3D coordinates of the points in a 3d kD-tree, since shortest cartesian distance also means shortest... |
I am applying substitution method to find the time complexity of the following recurrence relation. But I am having difficulty solving it past a certain point.
$$T(n) = 2^n T(n/2) + n^n$$
After substituting $T(n/2)$: $$T(n/2) = 2^\frac{n}{2} T(n/4) + (n/2)^\frac{n}{2}$$
I get,
$$T(n) = 2^\frac{3n}{2}T(n/4) + n^n + 2^\f... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.