instruction
stringlengths
35
29.1k
Question: How are hash table's values stored in memory such that space if efficiently used and values don't have to be relocated often? My current understanding (could be wrong): Let's say I have 3 objects stored in a hash table. Their hash functions generate these values: 0 10 20 I would presume that the pointers of...
Given $n$ rows with $k$ columns, is there a storage mechanism/data-structure and/or algorithm that enables dynamic restructuring such that I can get the top $t=\mathcal{O}(1)$ results efficiently? Example strategy 0 $$k_0 \le k_1 \le \cdots \le k_{n-2} \le k_{n-1}$$ Example strategy 1 $$k_{n-1} \le k_{n-2} \le \cdots \...
While trying to improve the performance of my collision detection class, I found that ~80% of the time spent at the gpu, it spent on if/else conditions just trying to figure out the bounds for the buckets it should loop through. More precisely: each thread gets an ID, by that ID it fetches its triangle from the memor...
I have an acyclic edge-weighted graph and have used Dijkstra's Algorithm with topological sort to find any shortest path to every other node from a root $s$. This is performed in time proportional to $V + E$, where $V$ is the number of vertices and $E$ the number of edges. I have $V= N^2$ vertices in my graph. Now supp...
I have seen that in the material made by Andrew Ng about neural networks, he uses the following weights: so when I replace the final values of h_theta(x) in the formula: I got values near 0 and 1. The problem that I have is when I use the values that are in the Tom Mithell book about Machine Learning, he uses the val...
Imagine: you are monitoring a system, and want an alert when certain measured value goes over a threshold value X. But perhaps the measured value is constantly fluctuating close to X, and you get a lot of alerts. There's an solution to that, where you only get new alerts when the measured value has dropped to below Y ...
Does anyone know of an algorithm that can solve the following special case of SAT in polynomial time? Are there any algorithms that can solve the counting (#SAT) version of it in polynomial time? Special case: If clause $a$ and clause $b$ have one or more variables in common, that is, there exists some variable $x$ tha...
My confusion is that if the recursive call calls the left nodes, and then adds with the right nodes, how are the nodes that are to to right of the left nodes and vice versa being called? int size (BinaryNode t) { if (t == null) return 0; else return 1 + size(t.left) + size(t.right); }
In Computer Architecture course, I have learnt how computer performs numerical computations. While using MATLAB, I was introduced to symbolic mathematics toolbox. I was amazed to see it manipulating trigonometric expressions, indefinite integration etc. What sorts type of algorithms are used for doing symbolic mathemat...
following question on undirected graph without weights can be solved by using DFS and in O(|V|+|E|) times. check that G is bipartite. check G has one simple cycle. find number of connected component G with given two vertex u, v, find a path between u and v with minimum edges anyone can describe, how the authors of t...
It's possible to parse a document using a single pass from a state machine. What is the benefit of having two passes, ie. having a lexer to convert text to tokens, and having a parser to test production rules on those tokens? Why not have a single pass that applies production rules directly to the text?
Usual parallel algorithms require a number of processors that grow with the size of the input, usually $O(\log n)$ or $O(n)$. This is great from a theoric point of view, but strange from a practical point of view, where the number of the processors that we can use is bounded by a constant. A corollary of the Brent Theo...
I have a simple recursive solution as below: public int countPaths(int x, int y) { if(x == 0 && y == 0) { return 0; } else if(x == 0) { return 1; } else if(y == 0) { return 1; } else { int count = countPaths(x-1, y); count += countPaths(x, y-1); return co...
Every time I think I get what Rice's theorem means, I find a counterexample to confuse myself. Maybe someone can tell me where I'm thinking wrong. Lets take some non-trivial property of the set of computable functions, for example let $L = \{ f : \mathbb{N} \to \mathbb{N} \;|\; \text{f is a computable and total functio...
A [smooth number] is one whose factors are all "small". For a computational problem, I would like all smooth numbers up to $10^8$. I think it's unfeasible to factor a billion numbers. Instead, I am choosing a set of primes, $P = \{2,3,5,7,11,13,17,19,23,29,31\}$. How can I find all possible product of them less th...
I need to evaluate if the picture was resized (upscaled). Are there any approaches to that already? If not, what do you recommend me to start with?
I have a program that fills a matrix of size N with characters such that all words formed by each row satisfy one regular expression, and all the words formed by each column satisfies a second one. For example, say I have $N=3$, regular expression $c^*ab^*$ for rows and $b^*ac^*$ for columns. A solution would be $\qqu...
I am reading the book: "Code: The Hidden Language of Computer Hardware and Software" and in Chapter 2 author says: Morse code is said to be a binary (literally meaning two by two) code because the components of the code consists of only two things - a dot and a dash. Wikipedia on the other hand says: Strictly speak...
I tried it as follows and would like to know if it is correct.
I went through the algorithm’s for finding the LCA of two nodes in a binary tree (let’s say the values are random – not a binary search tree) and I chose the method where the path to root is stored in an array. That is, an array stores the parent values from one node to the root and the same is done to the second node ...
For example $-\tfrac9{16}$. $$\tfrac{9}{16} = \tfrac{1}{16}+\tfrac12 = 0.1001\,,$$ which when normalised becomes $0.1001\times 2^0$. Can its mantissa be $0.0001001$ in 8 bits? If so, as $-\tfrac9{16}$ is negative, twos' complement is done to make its mantissa $1.1110111$. How do we normalise that?
I recently came across the paper "QMDD: A Decision Diagram Structure for Reversible and Quantum Circuits" by Thornton and Miller. It deals with a way of compactly representing transformation matrix for a given quantum circuit or a quantum gate. I tried very hard to construct a QMDD of a Toffoli gate but I failed. Then ...
This question is inspired by the Bogo-Sort algorithm and the discussion of whether there are any worse sorting algorithms than Bogosort. Assume that $A$ is an array initialized by a random permutation on the set $I_n=\{1,2,\ldots, n\}$. Consider the next algorithm: While $A$ is not sorted: Pick two random numbers $i\...
Has the following version of the stable matching problem been studied? There are $k$ types of objects. There are $n$ producers, each of whom can produce a single object of any type, and has a personal preference relation over the objects (e.g. Bob prefers to produce shoes, then socks, then cars, etc.). There are $n$ c...
Given matrices $A \in \mathbb{C}^{n_1,m_1}, B \in \mathbb{C}^{n_2,m_2}$ a naive way to computer the Kronecker product would be as such: $M = \operatorname{zeros}(n_1n_2,m_1m_2)$ (initialize an empty array)     For $p = 1,2,\ldots n_1n_2:$         For $q = 1,2,\ldots m_1m_2:$             $M_{p,q} = A_{{\lfloor {{p}{n_1...
Rice theorem says every non-trivial property of languages of Turing machines is undecidable. As David Richerby said in here : Undecidable means not decidable. Undecidable problems may or may not be semi-decidable. I would like to know how to find out Rice Theorem leads to semi-decidability or non-semi-decidability?...
I would like to prove $\exists t\phi_t = \phi_{t^3+t+1}$ where $\phi_0,\phi_1,\phi_2,...$ are sequence of all of the partially computable function. $\phi_t = \phi_{t^3+t+1}$ only if $t = t^3+t+1$ and it means $t=-1$! and there is no program with number $-1$!
Is it possible to insert a sequence of non-unique elements into an AVL tree? For example, what is the AVL tree result of inserting 3, 3, and 3 into an initially empty AVL tree? Is it: 3 / \ 3 3
I've reading up on Kosaraju's algorithm to compute the strongly connected components of a directed graph and I found that using an adjacency list representation gives a time complexity of $\Theta(V+E)$. using an adjacency matrix representation gives a time complexity of $O(V^{2})$. Why $\Theta$ in the first case and ...
I am confused about the definition of a strict transaction. What is the difference between a transaction that is strict and a transaction that is both strict and 2 phase?
If $A$ is turing recognizable and $A \leq_m\bar{A}$ then $A$ is recursive? If it is true how to prove it? Update It is my attempt, If $A$ is turing recognizable (r.e.) and $\bar{A}$ is r.e. then $A$ is recursive. but by $A \leq_m\bar{A}$ I can't deduce that $\bar{A}$ is r.e.
I have a regular language consisting of such {0,1}^k sequences, in which every subsequence of length 5 has at least two 0's in it (which also means every sequence of length <5 is 'good'). I need to find a DFA which generates this language. I can't say I tried everything, but each time I encountered the same problem, th...
My gut tells me the time-complexity of the following code is simply O(n^2). However, I'm not convinced, thinking it could possibly be O(n^3): cin >> n; sum = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n * n; j++) sum++; Can anyone provide a distinction, and why? Thanks in advance.
How can we show that the class of regular languages is closed under the following operation? Let $L_1$ and $L_2$ be laguages over $\Sigma=\{0, 1\}$. The operation is: $$\{x \in L_1 \mid \text{ for some } y \in L_2, \text{ strings } x \text{ and } y \text{ contains equal numbers of } 1s \}$$ Is the only way to show t...
I've researched several algorithms for determining whether a point lies in a convex hull, but I can't seem to find any algorithm which can do the trick in O(log n) time, nor can I come up with one myself. Let a[] be an array containing the vertices of the convex hull, can I preprocess this array in anyway, to make it p...
I've been reading Linear Algebra and its Applications to help understand computer science material (mainly machine learning), but I'm concerned that a lot of the information isn't useful to CS. For example, knowing how to efficiently solve systems of linear equations doesn't seem very useful unless you're trying to pro...
For k inputs, the complexity of naive algorithm is O(2^k). I understood this one. What is meant by "the size of the instance to be solved should be polynomial in k". Is it equivalent to the statement "The number of clauses in CNF of the boolean expression is polynomial in k"? What should be complexity of a hypothetical...
I have collection $U$ of sets, where each set is of size at most 95 (corresponding to each printable ASCII character). For example, $\{h,r,l,a\}$ is one set, and $U = \{\{h,r,l,a\}, \{l,e,d\}, \ldots\}$. The number of sets in $U$ is nearly a million. Also a set in $U$ will mostly contains 8-20 elements. I am looking fo...
How to prove if $B$, $\overline{B}\neq \varnothing$ , then for every recursive set $A$, $A \leq_m B$ ? it means every recursive set is mapping reducible to set $B\neq \aleph$. I really have no idea to prove this. UPDATE $A,B$ are sets, $A \leq_m B$ if there is a computable function $f$ such that $A = \{ x \in N | f(x) ...
I can't prove the correctness of the following algorithm by R. E. Tarjan amd U. Vishkin, as described on wikipedia: Given an undirected tree presented as a set of edges, the Euler tour representation (ETR) can be constructed in parallel as follows: We construct a symmetric list of directed edges: For each undirecte...
The integer feasibility problem is NP-complete: $Ax=b, x \geq 0, x \mbox{ integer}$ $A$ contains elements in $\mathbb{R}$ If we restrict this: $A$ contains only elements in: $\{1,0\}$ $\{1,0,-1\}$ $\mathbb{N}$ $\mathbb{Z}$ Does this change anything in term of hardness? Can all these problems be reduced to each other?...
I have a question related to representing numbers in base 2 with floating point. For example, if I have such a number $$0.000011 \cdot 2^3$$ then is its normalized form this? $$1.1\cdot 2^{-2}$$ Generally speaking about normalizing, normalizing with hidden bit, does it imply that the first number of mantissa should a...
How can I prove that a stable algorithm cannot solve an ill-conditioned problem with a precision greater than that of input values ? It seems obvious to me, since an ill-conditioned problem is that in which exact input values(D) are totally different from error valuesI(D') (judging by something), thus the exact soluti...
One sentence question Is there any algorithm able to prove (solve) a logic problem (first-order, propositional, pddl) by finite induction? Background I am researching Hierarchical planning solvers and I found the following problem. Let a problem climb a stairway. An agent is able to move up or down. For example, suppos...
I need to write a program that does the following: Take an input list of objects whose properties include latitude and longitude to, say, 5 decimal places Store them in a data structure once Provide a "nearby" lookup function that can efficiently return the N closest objects for a given lat/long Currently, I'm doing ...
I was asked this question in an interview. I was not able to find a better solution than $O(n)$ which is just going over the array and finding the sum. Can it be done any better? I am not really interested in the actual sum, I just want to know whether it's even or odd. Or how do I prove that it cannot be done better t...
[redirected from math.stackexchange.com] Let $U = \{u_{1}, u_{2}, \ldots, u_{n}\} \subset \mathbb{R}^{3}$ be the finite set of points on the unit sphere in $\mathbb{R}^{3}$: $||u_{i}||_{2} = 1$ Definition: Quadruple of points $(u_{i}, u_{j}, u_{k}, u_{l})$ is said to be positive if $$ \exists \alpha_{i j} > 0, \alpha_{...
how many BST exist with same postorder and inorder traversal? I know that in binary tree (Not BST), it is one. but i have a book from that said for BST it is CATALAN number. i become confused.
I think my problem can easier be explained via an example: Assume we have a dataset containing the images of 10 different mammals, let's say lion, elephant, cat, ... and horse. We have a 20-class image classification task where we want to detect whether an image belongs to lion-male or lion-female or cat-male or cat-fe...
Given n different numbers, I would like to find out whether there exists an algebraic expression using all the n numbers, with n−1 binary operators and unlimited number of parentheses, that evaluates to a certain number T. My idea is to make use of binary expression trees, construct all possible trees and then find the...
I've found the following algorithm for selection sort on the internet. program SelectionSort(input,output); var A : Array[1..80] of Integer; n, i, j, k, m, loc, temp : Integer; begin writeln('size of the array?'); read(n); for i := 1 to n do read(A[i]); for k := 1 to n - 1 do begin m := A[k]; ...
Introduction to Algorithms said that quicksort "works well even in virtual-memory environments," but didn't explain why. I've tried looking an Wikipedia and Stack Exchange, but found no reason why. Is it just because quicksort sorts in place?
I know that the equivalence of two context-free grammars is undecidable, but what about the equivalence of a regular grammar and a context-free grammar?
I'm literally so confused on how to even start this problem of proving that the given language is not Context Free. L = {a^i b^j c^k d^l | i = k and j = l} I know that we have to find cases where it contradicts the three conditions of the pumping lemma in all cases, but I'm not good in doing so. Thanks for the help!
I am currently working on the asymptotic analysis of Karatsuba algorithm and I have this line "return (X * B^ (2 * m)) + ((Z) * B ^ (m)) + (Y)" where X,Z,Y are some numbers, m is in fact floor(n/2), where n is the length of the input, and B is a base(could be 10, then we would have decimal numbers). I was wondering wh...
Physically based rendering form theory to implementation - http://www.amazon.ca/Physically-Based-Rendering-Theory-Implementation/dp/0123750792/ref=sr_1_1?s=books&ie=UTF8&qid=1425451050&sr=1-1&keywords=physically+based+rendering has all the information which is in Real time rendering - http://www.amazon.ca/Real-Time-Ren...
Assuming $P\neq NP$, is there a computational model in which OWFs cannot exist? What more should we include beyond non-determinism, randomness, quantum model to preclude existence of OWFs?
I've come across a programming question. I can't solve it but I can write the question in mathematical form as follow: Receive k equations,and for each equation receive 3 variables a, b, and c in the following form: ax + by + cz >= 0 This is an example input of k = 4: 1) 2x + 1y + 0z >= 0 2) 1x - 2y + 0z >= 0 3) 3x + ...
I was given a target function to design a neural network and train: $y = (x_1 \wedge x_2) \vee (x_3 \wedge x_4)$ The number of inputs and outputs seems obvious (4 and 1). And the training data can use a truth table. However, in order to train it as a multilayer artificial neural network, I need to choose the number of ...
I'm reading Lamport's "Time, Clocks, and the Ordering of Events in a Distributed System" and there's a detail that's bugging me. Lamport defines the "happened before" partial order, which I understand. Then he says that "Another way of viewing the definition is to say that a -> b means that it is possible for event a t...
PR is defined as "the complexity class of all primitive recursive functions" and also equivalently as "the set of all formal languages that can be decided by such a function". (wiki:http://en.wikipedia.org/wiki/PR_(complexity)) Unfortunately I fail to understand, why these two are equivalent?
This is a follow-up of another question here, and I hope it is not too philosophical. As Raphael pointed out in a comment on my previous question, I don't really get the definition of "computable", but according to some papers I read, the definition is also not really clear when it comes to models of computation weaker...
I've been trying to understand time complexity and space complexity by writing my own snippets of code and solving them. Can you see if I'm correct? for(int i=1; i<=n; i*=2) c = i+8; for(int j=n; j>0 ; j/=2) a[j] = 8; I think the time complexity is $O(log_2n)$ and the space complexity is $O(n)$. for(int i = 1; i<=n;i*...
I am interested in whether a graph (say, a complete graph) with one capacity negative (or many, but one should suffice) can be reconstructed as a graph with all non-negative capacities where the max flow between vertices of the original graph can be identified with max flows between vertices of the new graph. It is ok ...
So I've been interested in learning more about formal verification, and I've seen a lot of interesting things like ACSL and JML which are based on the concept of Hoare triples. My question is, that these seem to be a way to describe the behaviour of imperative programs via specification languages that are mostly functi...
We want to store a set S of distinct positive integers and support the following operations on S: Insert(a): insert integer a !∈ S into S. Delete(a): delete integer a ∈ S from S. FindNext(a, k), where a ∈ S and k is an integer: if S consists of some elements a1 < a2 < · · · < an, and a = ai (for some i, 1 ≤ i ≤ n), th...
Each time the camera generates a ray, the first task of the renderer is to determine which object, if any, that ray intersects first and where the intersection occurs. This intersection point is the visible point along the ray, and we will want to simulate the interaction of light with the object at this point. To find...
Say I have two simple graphs, $A$ and $B$ In $A$, I know: one node has 3 nodes at distance of 1, 4 nodes at distance 2, etc. one node has 4 nodes at distance of 1, 1 nodes at distance 2, etc. etc. In $B$, I know: one node has 3 nodes at distance of 1, 4 nodes at distance 2, etc. one node has 4 nodes at distance of ...
I thought I understood dependent typing (DT) properly, but the answer to this question: https://cstheory.stackexchange.com/questions/30651/why-was-there-a-need-for-martin-l%C3%B6f-to-create-intuitionistic-type-theory has had me thinking otherwise. After reading up on DT and trying to understand what they are, I'm tryin...
I'm having trouble determining the correct way (if there is one) to find the witnesses in any given big O problem. The example I'm struggling with: $2^x + 17$ is $O(3^x)$. I am expected to find two witnesses such that $2^x + 17 \leq C(3^x)$ whenever $x > k$. Unfortunately, my textbook isn't very clear on how to actual...
I was wondering what would be a time complexity of shifting a binary or a decimal number? For example: 0011, when I shift it left I get 0001. I was thinking that the time complexity is $\Theta(n)$, because we have to shift every number. I need it to calculate $m*{b^\frac{n}{2}}$, where $m$ is some number and $b$ might...
Can you pipeline a pure Von Neumann architecture based CPU or do you need seperate data and instruction caches for this? If you include seperate instruction and data caches (then it isn't a von neumann CPU anymore, it's a modified Harvard), how do you unify the data of these caches so that they get stored in a single m...
I am trying to understand how PCA works, and think I got most of it except... By calculating eigenvalues/vectors of the covariance matrix of the original dataset allows to find those dimensions where data is least correlated (lowest covariance). Sorting them based on eigenvalues is the method which allows the sorting o...
Edit: answerers keep finding (valid!) problems with my example. I'll try again. The older version is below the horizontal line. Thanks to Klaus below for pointing out the last problem. My question is how to unify skolemizations that have differing numbers of arguments. As he points out, there is rarely any need ...
This is a homework question, I'm wondering if anyone could help. Recall $RP$ is the set of languages recognized by randomized algorithms in polynomial time. The question is given an algorithm in $RP$ allowed to consult an oracle in $RP$, prove the "lowest complexity bound" for a set recognized by this algorithm. I do...
In The Algebra of Programming page 5, the authors defined structural recursion foldn (c, h) over natural numbers: f 0 = c f (n+1) = h (f n) They then went on to defin factorial as follows: fact = outr . foldn ((0, 1), f) outr (m, n) = n f (m, n) = (m + 1, (m + 1) * n) This doesn't seem right, first of all, foldn ...
The following is my own set-up code: Search_and_Sum(key, A,n) A[1..n] int sum = 0; for(int i=0; i<=n+n+1000; i++){ for(int j=A.length; j>=1; j/=2){ if(key==A[j]) break; else sum+=j; } } return sum; Well, I think the first loop has time complexity $O(n...
Consider the recursion tree: $T(p) = 3T(\frac{2p}{8}) + 2T(\frac{p}{8}) + O(p)$. I determined that there are at most $1 + log_{4}\ p$ levels, because the longest simple path from root to leaf is $p \rightarrow \frac{2p}{8} \rightarrow \frac{4p}{16} \rightarrow \frac{8p}{32} \rightarrow\ ...$. This means that the time c...
Studying for my qualifying exam, have a past exam here, which has the following question, verbatim: Give a proof of the Folklore statement: "sequential space is parallel time." In other words, the space used by a sequential algorithm for a problem $X$ can be equated (within Big Oh) to the time taken by a parallel alg...
I'm reading Neil Gunther's Practical Performance Analyst, and he provides that when there's one queue and one server, the residence time (total time spent per request) is: R = S + QS S is service time Q is number of customers ahead R is residence time Then he describes a case with a single queue and two servers and ...
Assume $f$ decides a language $A$ in $O(g(n))$ time, where $n$ is the length of the input string. How to write a recursive algorithm to decide $A^*$ (recursive)? Moreover, can an $O(n^2g(n))$ time algorithm be written to decide $A^*$ (dynamic programming)? Yes, the dynamic programming portion is a hw assignment. CLRS...
I am a little confused which of the two laws above i should use: Suppose I have a computer program that can be parallelized by 70%. 30% cannot be parallelized. Every single data (100% of data) will pass the parallelizable part and also pass the non-parallelizable part. I want to calculate how much more data i can proce...
In ray tracing if we are tracing a ray from camera to the object, then why there is need for light source as in this image and also rays are going towards the light source instead of outgoing from the light source? Recursive ray tracing associates an entire tree of rays with each image location. Image from: Physically...
I'm working on the following problem: Suppose that we're given a connected, undirected graph $G = (V, E)$ with edge weights $w_e$ and a subset of vertices $U \subset V$. We want to find the lightest spanning tree in which the nodes of $U$ are leaves (there may be other leaves as well). We want to do so in $O(|E|\log(|...
Here's the statement: Take a set of finite inputs from some alphabet. If for any two turing machines: All inputs in the set produce the same output for both machines In both machines, the following is true: every state transition (i.e. every row in the state table) occurs at least once for at least one of the inputs ...
I have studied the following recurrence. The ratio between f(n) and n^log_b(a) is log n so there is non polynomial difference but I have studied from book that it can be solved by master method. $T (n) = 2T (n/2) + n log n$ On the other hand ratio in $T (n) = 2T (n/2) + n /log n$ is $1/log n$ so this also has non...
Please let me know, if this goes here, if not, please point out where I should post this. Thanks in advance. So I require huge number of training data, mostly images. This is a pet project, only for learning. So how and where do I collect them, free of cost? Will it be suitable if I use a crawler and pull out images, t...
I have a set S (so no duplicates) of d-dimensional vectors of non-negative real numbers (or if you would prefer, floats). I say a vector u "covers" a vector v if, in every dimension 1..d, u[i] >= v[i]. So for d=3, (3,3,2) covers (2, 3, 1), but (3, 3, 1) doesn't cover (2, 2, 2). I am interested in finding a subset T of ...
So I'm reading "Search Through Systematic Set Enumeration" by Ron Rymon (currently available online for free. I'm having a problem with the notation in the following definition presented bellow: The Set-Enumeration (SE)-tree is a vehicle for representing and/or enumerating sets in a best-first fashion. The complete S...
Can anyone think of a way to use Huffman Encoding to improve the compression rate of Lempel-Ziv Encoding? My initial idea was to encode with higher probabilities given to shorter strings (i.e. the string "e" would have a higher probability than the string "ef"). Does anyone know of a good way?
I edited my question trying to make it as short and precise. I am developing a prototype of a facial recognition system for my Graduation Project. I use Eigenface and my main source is the document Turk and Pentland. It is available here: http://www.face-rec.org/algorithms/PCA/jcn.pdf. My doubts focus on step 4 and 5. ...
I am trying to solve the following problem: A set $S$ is self-reducible if the following holds: $x \in S$ iff $x = 1$(Base case) or (recursively) $l(x) \in S$ and $r(x) \in S$ where $\left|l(x)\right| < \left|x\right|$, $\left|r(x)\right| < |x|$, and $l$ and $r$ are both deterministic polynomial time computable functi...
How to solve this using the recursive tree method? I'm stuck with the $\max$. $$T(n) = T\left(\left\lceil \frac{n}{\max\,\{\sqrt{n},2\}}\right\rceil\right) + n\,.$$
I have the following problem: $x$ is the number of operations I have to perform. $O=\{o_1,o_2,\ldots o_n\}$ is the set of possible operations. I know beforehand the cost in terms of time and memory of every operation $o_i \in O$. I have a limited amount of memory and computation time, $M$ and $T$ respectively. What is ...
Given a directed graph $G = (V, E)$ and an edge $e \in E$, I'm trying to come up with an algorithm to construct the minimum induced subgraph $H$ of $G$ with the property that every circuit in $G$ that traverses $e$ is in also in $H$. As an example, suppose graph $G$ has vertices $V = \{1,2,3,4\}$ and edges $\{(1,2), (2...
Consider a boolean function $f:\{0,1\}^n\rightarrow\{0,1\}$. If $f$ satisfies $f(\bar{0})=0$ where $\bar{0}$ is vector of $0$, $f(x)=1$ with every $0/1$ vector of hamming weight $1$, then communication complexity of function is $\Omega(n)$. This is claim $4.23$ in Jukna's book. If $f$ satisfies $f(\bar{0})=0$ where $\b...
From page 29 of The algebra of programming : For any category C the opposite category $C^{op}$ is defined to have the same objects and arrows as C, but the source and target operators are interchanged and composition is defined by swapping arguments: $$ f \cdot g \text{ in } C^{op} = g \cdot f \text{ in } C. $$...
From page 31 of The algebra of programming : Next, consider the squaring functor $()^2: Fun \leftarrow Fun$ defined by $$ A^2 = \{(a, b) | a \in A, b \in B\} \\ f^2(a, b) = (f a, f b) $$ Functors are required to preserve identities and composition: $$ F(id_A) = id_{FA} \\ F(f \circ g) = Ff \circ Fg $$ The second ...
I'd like to begin the question by saying I'm a programmer, and I don't have a lot of background in complexity theory. One thing that I've noticed is that while many problems are NP-complete, when extended to optimization problems, some are far more difficult to approximate than others. A good example is TSP. Although a...
Suppose that there are a set of $n$ points $P = \{(x_1,y_1), \dots, (x_n,y_n)\}$ in 2D. Given two coordinates $(a,b)$ and a number $r \in \mathbb{R}$, is there an algorithm with $O(|Q| + \log n)$ running time that can find the point set $Q \subseteq P$ containing those points of $P$ that are inside the circle with cent...