instruction
stringlengths
35
29.1k
I was given the following homework assignment: Consider a set of $p$ points and $t$ triangles in the plane. The triangles are pairwise disjoint, that is, their edges do not intersect, no triangle lies in the interior of another, and no edge/vertex is part of more than one triangle. The points are in general position wi...
If I am implementing binary search using a recursive algorithm on an array it will be bounded by $O(\log(n))$. However, what will occur if the array is NOT passed by referenced and rather by value. This means that the recursive call will have to first copy the elements of the array (half the original items). Does th...
How many data addresses are specified in an ADD instruction in accumulator based architecture, stack based architecture, and in the most common register-based architecture? I'm not sure what I should look at - diagrams? Assembly code? Thank you for any help in advance!
I have written an algorithm for find all the pairs in a BST which have a given sum. def getPairsForSum(rootNode : Node, expectedSum : Int) : List[(Node,Node)] = { def check(node1 : Node, node2 : Node) : List[(Node,Node)] = { if (node1 == null || node2 == null) Nil else { val actualSum = node1.va...
Given a graph $G=(V,E)$, metric spaces $\delta:E\rightarrow \mathbb{Z}^{+}$ and $w:E\rightarrow \mathbb{Z}^{+}$, terminal vertices $s,t\in V$, do there exists $s\rightarrow t$ path $P=(V_{p},E_{p})$ such that $\sum_{e\in E_{p}} w(e) \leq W$ and $\sum_{e\in E_{p}} \delta(e) \leq K$, where $W,K\in Z^{+}$. This is Weight ...
In the paper "An introduction to algebraic effects and handlers" (Pretnar, Matija. Electronic Notes in Theoretical Computer Science 319 (2015): 19-35), handlers get a handler type that looks like a function type: $\underline{C} \Rightarrow \underline{D}$. These can be "applied" with the with h handle c syntax. What I'v...
In "Call-by-push-value: A subsuming paradigm." (Levy, Paul Blain. Springer, Dordrecht, 2003. 27-47) terms of the lambda calculus get split in to values and computations, with the slogan "A value is, a computation does". What I don't understand is: why are abstractions computations and not values? Intuitively a function...
Good evening everyone, I have a question that I am having a bit of trouble formulating properly and thus it is making it complicated to look up literature on the subject. What I am looking for is a name for a more general problem of the same nature, and I think it will have something to do with the title of this questi...
Let's say we are given this table of the relation Person(name, hobby) name hobby bob hockey alice basketball mary cricket mark basketball rick snowboarding andy hockey How would I use relational algebra to find the hobby that had only one person had. It should give me hobby cricket snowboarding My ATTE...
I am look for a tool with any or all of the following features: Regular Expresstion to NFA converter that represents transitions as Binary Decision Diagrams NFA to DFA converter NFA minimization NFA union/complement/intersection Can you recommend one?
I realize that we must do a minimum of $n - 1$ comparisons to find the median in a list of numbers, therefore the time complexity would be $\Omega(n)$. However, given a hypothetical scenario in a world where the median can be found in $\mathcal O(log(n))$ time, what would be the implications on the fastest sorting time...
I have a struct like this: struct UInt128 { UInt64 s1; UInt64 s2; } In this struct, s1 represents the highest 64-bits of my 128 bit integer, and s2 represents the lowest 64-bits of my 128 bit integer. I'm attempting to implement a method that produces the product of two UInt128's. My current thought process is...
Suppose all the spaces between the words(only small letter alphabets and no punctuation) in a file has been deleted and we need to reconstruct the file. There is a dictionary available which answers whether a word is valid or not in O(1). Brute force approach is to use backtracking i.e try out all the possibilities. Ta...
Is it more efficient to simulate Quantum Computer using a non-deterministic Turing machine? Would it be more efficient than simulation using a deterministic Turing machine or probabilistic Turing machine? I am not sure what are the relations between Turing Machine, Probabilistic TM, Non-deterministic TM and Quantum TM ...
In probability theory, the mixing time of a Markov chain is the time until the Markov chain is "close" to its steady state distribution. Lets fix some $\varepsilon\in (0,1]$ as our closeness parameter. Now suppose that we have a Markov Chain M with mixing time T, and suppose that we want to draw 10 independent sample...
When I search for Dijkstra's algorithm and hypergraphs, I don't get any results discussing it. The Wikipedia page regarding Dijkstra's algorithm doesn't mention hypergraphs and the one regarding hypergraphs doesn't mention Dijkstra's algorithm. When I search for shortest path algorithms for hypergraphs, I only get resu...
I know that it is as hard to find a solution to a SAT formula, as it is to decide it has a solution at all. See the answer to: Is finding a solution of a satisfiability problem harder than deciding satisfiability? Are there also families of formulas for which it is guaranteed that there is a solution, but it is hard to...
I see many algorithmic problems that always reduce to something a long the lines of: You have an integer array $h[1..n]\geq 0$, you need to find $i,j$ such that maximizes $(h[j]-h[i])(j-i)$ in $O(n)$ time. Obviously the $O(n^2)$ time solution is to consider all pairs, however, is there any way we can maximize the expr...
In Hoare logic, there's a thing called a Hoare triple, e.g.$$ \begin{array}{ccccc} \{x = 2\} & & x := x+1 & & \{x = 3\} \end{array}. $$ What does '$x :=$' mean?
Although I am new to the computer vision domain, I am tasked with automating handwritten text recognition from bank cheques. I first did some preprocessing(blurring and binarization) and then dilated it so that I could segment the words. But since the words are handwritten (cursive and unconstrained), the segmentation ...
Given a decidable problem, how would I go about proofing that the problem and the complement of the problem have to be semi-decidable?
Which one has a higher order time complexity: $n ^ 3$ $3 ^ {\log n}$ I know that an exponential time order is higher than polynomials. However, it uses a logarithmic power which is low for a large n, while n^3 or more could remain still high, not?
Consider the following formula: $T(n) = n + \sum_{k=1}^{n-1} [T(n-k) + T(k)], T(1) = 1$ What is the order of T?
I know that the time complexity of quick sort in the worst case is $\Theta(n^2)$ and in the average case is $\Theta(n \log n)$. Can it be $\Theta(n\sqrt n)$ for certain inputs?
type checking I was preparing examples of type checking in simply typed $\lambda$-calculus. I wanted to explain it to my audience in the way of implementation. And I found a bit tricky point in the typing rule of application, which is as follows. $$ \frac {\Gamma \vdash t_1:T_{11}\rightarrow T_{12} \quad \Gamma \vd...
I am wondering what the time complexity of finding the most appropriate exception handler for dispatching zero-cost exceptions is. For zero-cost (this refers to execution under the assumption that no exceptoins occur) exception dispatching, the compiler stores a big table of all possible exceptions. An entry consists o...
How to find a recurrence relation for $F(n)$ the number of ways to make n cents change using only pennies (4 cents), nickels(5cents), and dimes(10cents) and ordering matters. There are three exclusive case here Start with pennies then new subproblem is $F(n-4)$ Start with nickels then new subproblem is $F(n-5)$ Star...
I am aware that $MA \subseteq ZPP^{NP} \subseteq \Sigma_2^{P}\cap \Pi_{2}^{P}$ and also $NP^{BPP} \subseteq MA \subseteq AM \subseteq \Pi_{2}^{P}$. My question is: In this whole thing, where does $P^{NP}$ lie? (Obviously, $P^{NP} \subseteq ZPP^{NP}$) But, what about the relationship between $MA$ and $P^{NP}$? Which is ...
I am trying to determine which functions are not learnable without a bias when building a perceptron. The set of functions I need to evaluate is {NOT, OR, AND}. Could someone help interpret these results? AND FUNCTION https://i.stack.imgur.com/5sbuj.jpg OR FUNCTION I get a divide by 0 error in my script. NOT FUNCTION...
Working on an optimization problem formulated using the well known assignment problem. My decision variable is defined as follows : $$\alpha _{x}^{r,u} = 1\begin{cases} & \text{ 1 if } \mathbf{VM}\: \mathbf{u}\; of\; request \: \boldsymbol{r}\; is\; assigned\; to\; server\; \mathbf{x}\\ & \text{ 0 } otherwise \end{...
I'm struggling to analyze the runtime of this algorithm mainly because it depends on two parameters - the length of the input n, and also the bit size of individual n (bitnum). Most documentation I can find solve recursion based on n solely. The algorithm is: def sortB(seq,bitnum): # length of seq n = len(seq) ...
In the exercise I have a 32 bit processor with a 2-way set associative cache. I have 32 bit addresses: 31-14 tag, 13-5 index, 4-0 offset. Calculate: 1) Cache line size in number of words (1 word = 4 bytes) 2) Total cache size in bits In the presence of the following sequence of accesses in memory, considering the initi...
The cost of computing a trivial hash function is effectively zero, so the time complexity is $\mathcal{O}(1)$; however, if I assign $n$ variables using the hash function, is the complexity $\mathcal{O}(n)$. For example, the pseudo code would look like this: for i=1 to n var[i] = hash[data[i]]; end The only operati...
I've been given the following task and have tried a few things, but none seem to result in what is required. $L = \{ww \mid w \in \{a,b\}^*\}$ What Chomsky-Type is $L$? Provide a grammar fulfilling that Type. It can't be context-free, since that wouldn't allow us to force that we write each symbol twice at the right pl...
Given a connected graph G, what is the complexity of the problem to determine if a spanning tree with a number of leaves less or equal to k exists inside G? I don't really know how to determine it and how to reach a proper solution to this.
Do unconditional branches, such as jump/goto instructions cause control hazards? If so, why? I am wondering because if unconditional branches did cause control hazards, that is like saying if A were the jump foo instruction and another instruction B was the first one under foo:, B would have a control dependency on A. ...
Let $S \subset \mathbf{R}^3$ be a set of points in 3D and let $O=(x_0,y_0,z_0)$ be the origin/point of reference. We consider a convex polytope $P$ good / interior if: $P$ is wholly contained within the interior of the convex hull of $S$: $P \subsetneq \text{convexhull}(S)$. $O$ is contained within the interior of $...
I am trying to think of how to optimize the following problem: Let $S = \{1,2,...,N\}$. How many ways can $S$ be partitioned into non-empty subsets $P_1$ and $P_2$ such that $sum(P_1) = sum(P_2)$? I have implemented an algorithm that checks all partitions of $S$ into 2 subsets $P_1$ and $P_2$, but I am wondering if th...
Give a decimal number, such as 123. Need to figure out all smaller numbers lesser than 123 made up by 1 and 0 composed of decimal numbers such as 111, 110, 101, 100, 11, 10, 1, 0. I am thinking of below recursive solution: a. If the first number is 1 then we can append 0 or 1 to it. Vice versa is true for 0 if it is th...
$FOLL$ or $FO (\log \log n)$ is a complexity class of all problems solvable by uniform poly-size circuit families of unbounded fan-in and depth $O(\log \log n)$. $AC^2$ is a complexity class of all problems recognized by boolean circuits with depth $O(\log ^{2}n)$ and polynomial number of unlimited fan in AND and OR ga...
Some background on my question: I have done some research into March Tests that are essentially access patterns for DRAM. One example of these march tests in the MATS+ algorithm shown below with (I think) O(n) complexity: MATS+: {⇕ (w0); ⇑(r0, w1); ⇓(r1)} Steps for algorithm: 1) Write a 0 in either up or down addressin...
I have heard that the quickhull algorithm can be modified if the size of the convex hull (the number of points it consists of) is known beforehand, in which case it will run in linear time. What modifications are required in order to decrease the time complexity of the convex hull algorithm?
I am studying Nested Monte Carlo Algorithm addressing the problem of guiding the search toward better states when there is no available heuristic. It uses nested levels of random games in order to guide the search. It consists in two functions : nested(position, level) and sample(position) The basic sample func...
Looking at some Generating functions of a series, I have conjectured - If $G(x) \ =\ \frac{1}{1-x^{t_1}-x^{t_2}-...-x^{t_n}}$, then the recurrence equation of the the series is - $a_n = a_{n-t_1}+a_{n-t_2}+...+a_{n-t_n}$ How can I prove or disprove this?
Suppose that $k < \sqrt n$, what is the time complexity to find the $k_{th}$ smallest number in a min-heap? I thought that we can remove the root element for k times and each time we apply heapify? So it should be $O(k \log n)$ but the answer is $O (k \log k)$. What did I do wrong?
There is a powerful simulation of Turing machine. At the input it takes problems of class P. At the output it gives solution for the problem. So, is it easier (in complexity theory) to test the correctness solution of the given problem than to solve this problem? If checking the solution is really easier than solving t...
I know that monotone 3SAT is NPComplete. Also, 1 in 3SAT is NPComplete. I think both conditions together also leave the problem NP Complete (need confirmation). If possible can someone please help with the smallest non trivial problem of this form that is unsatisfiable. Would be grateful.
I read everywhere that $N$ qubits correspond to $2^N$ bits. Let's start with 1 qubit, which is commonly represented by $\alpha |0\rangle + \beta |1\rangle$ where alpha and beta are complex numbers. This looks to me like infinite bits. How do they choose alpha and beta so that it becomes 2 bits? Edit: Why is it commonly...
Given a 2d array of pixel values, is it possible to iterate over just the pixels in a circle in a way that is less costly than simply iterating over a square and checking if a value is within the circle? I need to get the values of pixels within a circle given center coordinates and the radius. Ideally I would ONLY ite...
I want to determine the complexity of these two problems (with a given k): 1) Determine if the graph G has a cycle of length less or equal than k; 2) Determine if the graph G has a cycle of length equal or more than k. For the first problem, I think it is NP-complete because it is NP (but why?) and because we can reduc...
I have a question regarding DFA: Design a DFA M with alphabet $\sum = \ {\{0,1,2,R}\}$ where the states remember actual sums of the number, except that the sum is reset to 0 whenever the symbol $R$ appears. Show diagrammatically how this DFA can be constructed. What is the problem with this DFA? One thing I do understa...
I work part time at UPS. Part of my job consists of taking boxes from in front of me, determining if the correct cage (1 of 6 moving cages) is behind me (true about 50% of the time), and then putting the box down either in the cage or back in front of me. There can be 6-20 boxes in front of me at any given time dependi...
The title puzzle has a setup of. Www_bbb where there are always 3 w's And 3 b's and 1_ . The rules of the puzzle are to get all w's on the right side of all b's where location of _ does not matter, to do the puzzle you have 6 possible moves. The move are 1, take the closest w or b to the left and move it to the rig...
There is a great divide in Haskell between pure and monadic algorithms. While the latter are indistinguishable from their usual imperative counterparts, the former can get much more magical. What this means is that some pure higher order functions do not admit translation from pure to monadic arguments, or from monadic...
I want to create a program that makes problems that people can solve but computers would struggle with. I've read that human language is very difficult and CAPTCHA looks pretty promising. Basically I want to make puzzles, riddles, and codes that a person could figure out with some effort but that cannot be automated. A...
Show a counter-example to disprove the following statement: If $R1$ and $R2$ are two regular expressions, then $L((R1 \cup R2)^*) = L(R1^* \cup R2^*)$.
I have just been reading through a SO post which proves that the Halting Problem is NP-Hard. Whilst this is an easily followed proof, one slight slight aspect of it has left me scratching my head: it says that "This pairing can be done in polynomial time, because the Turing machine has only constant size." So their j...
Question : What is the definition of $\mathcal{Mod} P$ counting complexity class? I am not getting anything relevant about this complexity class on Google search. If it is available on Wikipedia, please share a link. $\mathcal{Mod} P$: A set $L$ is in the class $\mathcal{Mod} P$ if there exist functions $f \in \#\math...
In the bin packing problem, we are given a set of items I={a1,...,an}, each item with weight w_a1,...,w_an, and a set of n bins with B={b1,..., bn} all bins with capacity C. I want to restrict the weights of the items to be polynomial in n. Is the problem still being NP-hard (restricting the weight of the items)? Any i...
Consider the highlighted columns in the following table: Starting with 100,000 newborns, $l_{x+2}$ denotes the number of individuals in the sample still alive at age $x+2$. If we consider Makeham's law of mortality, defined by the function $$ S_0(x) = \exp \left( -Ax - \frac{Bc^x - 1}{\log (c)} \right) $$ we find that...
I am trying to solve a real-world problem that I was able to reduce to the problem described below. I would like to know the following things: Is there literature about this problem? Is the corresponding decision problem NP-complete? Do you know an efficient algorithm to solve the problem? If not, what would be a good...
I have two lattice (grid) end points of the line, how can I generate intermediate points of the line segment between them? One way is iterate through all the x points or y points and check (solve line equation) if the coordinates we get each time are integral solution or not.
We want to show one schedule of jobs consumes less energy than another one. For example, there are two schedules A and B. Both the schedules A and B schedule two jobs $j_1$ and $j_2$ with execution time $C_1$ and $C_2$. Schedule A schedules the two jobs with frequencies $f_1$ and $f_2$ while schedule B schedules the tw...
Given a 3SAT problem where each clause is a Monotone Clause (i.e. each clause with all positive or negative literals). Moreover, we are promised that each solution for the above SAT problem (if any exists at all) will be of the form 1 in 3 SAT. Monotone 1 in 3 SAT is NP Complete, but with the additional promise above,...
I've written a function. I believe the function runs in complexity: $$ T(m, n) = \begin{cases} T(m-1, n) + T(m, n-1) + T(m-1, n-1) + 1 &\text{if $m,n>0$}\\ 0 &\text{otherwise} \end{cases} $$ I have no idea how to simplify this. Can anyone help? (No, this is not a homework assi...
I want to assign people to cover shifts considering a set of constraints and preferences. Here's the problem definition: Daily shifts must be covered by workers, who are divided in three groups: Trainees (Nt = 2) Regulars (Nr = 3) Experts (Ne = 7) The organization constraints are: All shifts must be covered A Traine...
Let $Ham$ be the $[7,4,3]_2$ Hamming code. It is known that $\{w(c):c\in Ham\}\subseteq\{0,3,4,7\}$, where $w(c)$ is the Hamming weight of the word $c$. A code $C$ of length $n$ is called cyclic if $\forall c=(c_0,\dots,c_{n-1})\in C:(c_{n-1},c_0,\dots,c_{n-2})\in C$. A straight forward extension for $Ham$ to an $[8,...
I'm looking for an algorithm or framework for thinking about how to determine affinities between nodes. Perhaps affinity is poor choice of wording, but basically I want to use utilities between nodes to determine how alike or unalike they are from each other. I've attached an example diagram to illustrate what I mean: ...
Here is my exercise. FINDLARGEST(k): return the elements in the heap with key >=k" ... "expand the priority queue (max-heap) so that it supports FINDLARGEST(k) in O(m) time, where m is the number of elements with key>=k. Can anyone elaborate on this maybe? I stumbled upon this on the wikipedia entry on min-max heap: ...
I am trying to understand the assumption of Simple Uniform Hashing (SUHA) as e.g., in CLRS textbook; or other courses about hashing. The usual description given to SUHA is (cf. CLRS): "we shall assume that any given element [i.e., key] is equally likely to hash into any of the m slots, independently of where any ot...
I have this problem of obtaining a subset of maximum weight from a given array of size n (the i-th element is the weigth of the item i) - lets call it P. The only restriction is defined by an array R of size n: for each j in R[i] we have that the subset can not contain both P[i] and P[j]. How do I build a DP bottom-up...
This is the Lisp code (from wikipedia) that implements the $s^1_1$ form of the $s^m_n$ theorem (defun s11 (f x) (let ((y (gensym))) (list 'lambda (list y) (list f x y)))) since I don't know Lisp, can someone explain me what this code does and/or translate this code into other languages
One simple question I've never been able to answer is, "why use 'for', 'while', and 'if' as control statements?" Could someone please elucidate the rationale behind using the above mentioned control statements, that have been embraced by most, if not all, high-level languages. I believe this has something to do with au...
I understand how the outcome of each is supposed to be different, but in matrix form are these gates not the same? The CNOT matrix negates the second bit regardless of the input of the first.
What is the difference between Simulated Annealing and Monte-Carlo Simulations? Is Simulated Annealing a specific type of Monte-Carlo simulation, or are they completely separate techniques?
What is the diffrence between a carry bit and overflow
This is a question asked in Adobe interview: Given heights of n towers and a value k. We need to either increase or decrease height of every tower by k (only once) where k > 0. The task is to minimize the difference between the heights of the longest and the shortest tower after modifications, and output this di...
For the Pushdown Automata episilon transition $\epsilon$ which is shorthand for $\epsilon; \epsilon / \epsilon$, does this mean that at any point, regargless of if there is input or not, you can transition to the next state? Or does it only transition to the next state when there is no more input?
I've been given a solution, included below and I do not see how it would reject a string where i=j. The example given should reject an input string such as aabbcc where there are an equal number of a's an b's, so i=j, however I don't see how it would reject it. Wouldn't it just push 2 a's, transition to state 2, pop 2 ...
If we take a look at Gödel's paper “On formally undecidable propositions”, the first self referential proof given in the paper, with the following formula: $$n \in K \equiv \overline{\textit{Bew}}[R(n); n]$$ Which look like this in more modern mathematics: $$K = \{n \in \mathbb N : \lnot\text{provable}(R_n(n))\}$$ Göde...
Is it possible to implement extractMin on a Max-Heap in O(log(n)) time, and if so how? Or do you need a more elaborate structure like a max-min heap?
I am trying to make sure my intuition for the following question from an assignment is correct Prove or disrove: if $G = (V, E)$ is a graph and $I_1$ and $I_2$ are independent sets in $G$, then $I_1 \cap I_2$ is an independent set in $G$. Answer: This statement is true. Consider arbitrary nodes $x, y \in I_1$ and $u, ...
I have to find number of ways (combination) to create graph that for each 3 vertices there are minimum 2 vertices connected. There is n vertices. For example when n=3, there are 7 possible combinations. How can I make this with maybe dynamic programming?
I am self-teaching myself Hindley-Milner type inference by writing my own implementation, separating tree traversal and constraint solving. The tutorials that I've been following only allow patterns that are variables, but I decided to implement pattern matching, and I've hit a wall concerning the separation of travers...
The idea I'm thinking of is about a top-down approach for AI. I would like to know if there can be a model for computers so that they can perform causal reasoning. It seems that causal relation can be simplified to be a mathematical structure, as an acyclic directed graph. If using type theory, one builds some "time t...
Given is a list of numbers. Now you build different permutations of that list while there must not be two permutations where the sum of the numbers from any point of the row to the end/beginning is equal to the sum of numbers from any point of another row to the end/beginning. E.g. $1,2,3,4$ $2,3,4,1$ $4,3,1,2$ ...
So I think this falls under case 1...but I am not sure how to formally prove that $n^{lg_{10} 6}$ is asymptotically greater than $\lg^2 n$. I tried using L'hopitals but kinda reached a dead end. Here's what i have so far $$\lim_{n \rightarrow \infty} \frac{d(\lg^2 n)}{d(n^{\lg_{10}6})} = \frac{2 \lg n (\frac{1}{n})}{(\...
I read the paper Certification-Cognizant Time-Triggered Scheduling of Mixed-Criticality Systems (Baruah and Fohler, in Proceedings of 32nd IEEE Real Time Systems Symposium, 2011; see Section 6) which proves a particular problem to be NP-hard in strong sense and in PSPACE. Then they proposed a polynomial algorithm for t...
Due to the linear nature of computer memory, row-major and column-major matrices have different performance for row- vs. column access. The obvious solution would be to keep two copies of the same data sorted accordingly. Is there a DS with better space complexity?
I have to ask for forgiveness in advance if the whole question doesn't make a lot of sense, but unfortunately, I have no better intuition as of right now and this seems like the best starting point I could come up with. I'm reading Tarski's book "Introduction to Logic: and to the Methodology of Deductive Sciences", I'm...
Is it possible to find the nodes larger than $ k $ in a min-max heap in $ O(m) $ time, where $ m $ is the number of nodes larger than $ k $? If it is possible, then how do I implement the rest of the standard heap procedures in standard time (insert and delete, extract min and extract max is easy obviously)? If needed...
I want to find the all primes between 2 and $k-1$. We can come up with an $O(k\log k)$ running time algorithm. I want to compute this set in $O(k)$ running time. For this algorithm is : we are maintaing a one pointer from node $i$ of the list $L$ to index $i$ of array $N$ and one pointer from index $i$ of $N$ to $i$th...
I'm having trouble constructing a regular expression to meet the following criteria: $$\sum = \{0,1\}$$ $$\epsilon \in L$$ $$0 \in L$$ $$1 \in L$$ $$\forall x \in L, 110x \in L \land x01 \in L$$ What I have so far is: $$((1^*0)^*(0+1)^*(01)^*)^* \text{ or } (1^*(0+1)^*)$$ However I dont believe this to be fully correc...
Prove $f(n) = O(g(n))$ and $g(n) = O(h(n))$, then $f(n) = O(h(n))$. The question is Prove that Big-O is transitive by relation. What does it mean by by relation??
So I am trying to figure out the recurrence relation for the median of medians algorithm using groups of 3 instead of groups of 5. Per CLRS's method, my recurrence relation looks like $$ T(n) = T(\lceil \frac{n}{3} \rceil) + T(\frac{2n}{3} + 4) + c_1n $$ And I want to show $T(n) = O(n \lg n)$ Via substition, I assume ...
This is the definition of $EXT = \{x\ | \varphi_x\ can\ be\ extended\ to\ a\ total\ computable\ function \}$. I'm trying to proof that $\overline{K} \le_{rec} EXP$ and I can't think of an example of a function that can't be extended
I have two operations: $Sum(i,j)$ : Calculate $A[i]+A[i+1]+....+A[j]$ $Change(i,x)$: Set $A[i]=x$ I need to implement these operations in an appropriate data structure using $O(n)$ space ($n$ is the length of the input array $A$). The $Sum(i,j)$ procedure needs to have a runtime complexity of $O(\log(n))$ and the $Chan...
What are some examples of problems whose deterministic versions are easy, but become hard when injecting some uncertainty (or randomness of some kind)? What are some examples in which the problems remain feasible? Can one tell in advance? I am particularly interested in scheduling problems and what to know as to how th...
Suppose we have 3 sets $A, B, C$ which can can hold a maximum of two elements, each. So the total number of elements that the sets can hold together i.e. total capacity (TC) is $ 3*2 = 6$. Now, elements arrive serially (one-by-one) with some properties that impose the following constraints: E1 : Can be placed in either...
If you apply standard Bellman-Ford algorithm to a graph containing negative loop it can only report its existence. Are there approaches to modify it to find shortest path containing any vertex not more than once so effectively avoiding loops? I would appreciate if an answer will contain a link to a paper.