instruction
stringlengths
35
29.1k
I don't mean compiler flags for pipelining. I would like to program in a way that helps the compiler do optimizations using pipelining. I mean I want to order instructions in C in such a way that GCC (or other compiler) can easily pipeline my instructions. For example, if I have: a+=b c=a/b d+=b f+=b Here, the last tw...
This question asks for an informal explanation of why all polymorphic functions between functors are natural transformations (This is a claim made by Bartosz Milewski). One answer to that question refers to the Theorems for free! paper. However, after reading it I'm not seeing how it implies the result. The parametrici...
I have read this paper https://arxiv.org/pdf/1803.03674v1.pdf for outlier detection problem with real data (online training) In this paper, the authors used Incremental Decision Tree to build subspaces (nodes in tree) by 2-mean method. The problem is in the algorithm 2 (build tree in paper), the condition (line 22): if...
Let's suppose there are two banks, Bank A and Bank B. A transaction needs to happen that transfers money from an account in Bank A to an account in Bank B. Bank A and Bank B have separate banking systems which makes this transaction a distributed one. From what I understand following is what happens, I refer the system...
I have a scheduling problem with the following specifications: A single machine is used. $n$ jobs $\mathbb{J} = \{J_1,...,J_n\}$ are available from the start $t = 0$. Each job can be executed several times. There is a cycle length $t = T_{max}$ and the scheduled jobs have to fit in $[0,T_{max}[$. There are two types ...
Let $X$ a maximal prefix code on an alphabet $A$, $m(X)$ its maximal length, $F = X \cap A^{m(X)}$ and $F’ \subseteq A^{m(X)}$. Let $X’ = X \setminus F \cup F’$ a maximal prefix code. Why is it true that $X’ = X$? In other words, why is it true that one cannot obtain a maximal prefix code from another maximal prefix co...
I'm looking for a resource (online or printed) that explains in a self-contained way the classic tableau for first-order logic with equality. All I can find are expositions of tableaux for first-order logic without equality, or resources which explains the tableau without equality and then treat equality with the same ...
How to prove this language is context-free but not regular? I can't figure out it. A string is contractible if there is a sequence of contractions which result in the empty string, where a contraction is the removal of a sequence of length 2 or more consecutive identical symbols. When a contraction is applied it must ...
IF SAT(satisfiability problem) belongs to P, then is it possible for a certificate of an arbitrary instance of SAT to be found efficiently?
I had this question on a problem set recently, but I wasn't sure how to solve it. Given a complete weighted undirected graph $G$, here are two "algorithms" to find a Hamiltonian path: greedy: start at one vertex at random, and greedily choose the edge that leads to an unvisited vertex with smallest weight anti-greedy:...
Problem: Describe (English is enough) a linear algorithm that, given a set $S$ of $n$ distinct numbers and a positive integer $k \leq n$, returns the $k$ numbers in $S$ that are closest to the median of $S$. Answer: I interpret the term linear algorithm to mean one that runs in $O(n)$ time. It is not clear to me if tha...
Given two statement: A:if inputs of a problem is online, then there is faster or equal algorithm in view of time complexity for that problem when input is offline. B:if inputs of a problem is offline, then there is faster or equal algorithm in view of time complexity for that problem when input is online. Which of the...
I know that the 3-cycle cover decision problem for directed graphs (3-DCC), defined as finding whether a directed graph has a disjoint vertex cycle cover in which every cycle has at least 3 edges, is NP-complete. Does anyone know what is the actual scaling of the best known algorithm to solve that problem? And, most im...
I have a requirement where I need to group similar elements together within an original list. For example: I/P array: [1, 2, 3, A1, B1, 4, B2, 5, 6, C1, B3, B4, 7, 8, 9, 10, A2, A3, 11, 12, A4, C2, D1] Now I would like to group the elements starting with an alphabet such that all the elements belonging to a specific al...
I am a CS major trying to decipher quantum computing. I have done some elementary study on qubits and I always seem to get lost at the "infinitely many" states that the qubit can have. And I really want to understand what it actually means. My understanding is as follows and please correct me if I am wrong, A classical...
This is a problem that I have been struggling to understand in a theoretical computer science book I've been reading: We call a sequence of $n$ integers $x_1, \dots, x_n$ valid if each $x_i$ is in $\{1, \dots, m\}$. How would you design a dynamic programming-based algorithm that takes in $n$, $m$ and “target” $T$ as i...
In the definition of in-place algorithm, from Wiki, " However, this form is very limited as simply having an index to a length n array requires O(log n) bits." How does an array index requires log n bits? For example, A[0], 0 here just take O(1) bits, right? It is just 1 number. I guess my question is about how an arra...
Given a language $L$ and a set of strings $\Sigma^* = \{0, 1\}^*$, how can I find a regular set that expresses $L = \{ w \in \Sigma^* \mid w$ ends with $00$ and does not contain $11\}$? Well, the part that states that w must end with 00 is easy and I (think I) managed to find the regular set for it. But I can't modify ...
I am in an intro to OS class and we are learning about mutual exclusion and semaphores. One classical problem we learned about was the dining philosophers problem. My professor touched on the different cases using simple semaphores (i.e asking the last philosopher to grab the right fork before the left while the others...
At least intuitively, I understand the following terms to be rigorously associated: Field Separator (FS) as a delimiter which delimits text segments such as words, sentences or lines/fields and an example would be an Input Field Separator / Internal Field Separator (IFS) Indentation character: Whitespace character Ta...
I'm stuck on how to progress with this proof, despite I have tried, I cannot see the next move. Given this proof without predicate: So far what I've accomplished: My idea is, as I can't see any other option using (-(Sv(P->Q)) as the first assumption in order to introduce a conditional, so the assumption must end in P...
Re-usability of code is one of the main benefits of the bottom-up approach (Wikipedia) I can't quite figure out how bottom-up approach enables code re-usability. I am aware that Object Oriented Programming is bottom-up approach and it has features such as inheritance that enable code re-usability. But I cannot connec...
I am given a connected graph $G$ with some embedding. I want to find a non-deterministic algorithm running in $O(n)$ time to decide whether $G$ with that embedding is a plane graph (i.e, can be drawn without intersecting edges). I know there exist algorithms that decide whether a graph is planar or not in time $O(n)$, ...
Not sure which OS is best to invest in for my computer science degree. Have had varying opinions - from your experience in education or working in the sector, what is the operating system that will treat me the best for the next three years of my degree?
How does LZW decompress data with dictionary clearing/flushing? I understand that a space is reserved in the dictionary that represents a clear code (usually 256), but how is this code actually used when compressing and decompressing data? My thoughts for compression are that it checks the table size, and if the table ...
There are 10 teams, Team A through Team J, playing in a triple round robin pool (each team plays thrice against each other team, for a total of a 27 games per team). After the round robin pool, the top 4 teams (with the highest number of wins) make playoffs (with some tie-breaking procedure that can be done in polynomi...
How to prove that $L$, where $$L = \{\langle M\rangle: L(M)\text{ is recognizable}\}$$ is decidable? What about $\bar{L}$?
I need to use it to prove $L^*=L^*L^*$. So I know that $L^*=L^1 \cup L^2 \cup L^3\cup\ldots$ But how do you describe $L^* L^*$?
Define Σ = {a, b, c, . . . , z} be the set of letters in the English alphabet. Prove that the following language is undecidable: Cats-VS-Dogs = {(M) | Either “cats” ∈ L(M) or “dogs” ∈ L(M), but not both.}.
Given a circle with $n$ equal segments. On each segment there is an integer. We want select segments at equal distance, maximizing the sum of integers on selected segments. I have an algorithm with runtime $O(n^2)$ as follows: First calculate maximum sum of segments at distance one. Second calculate maximum sum of se...
Given a regular language $L$ and a string $x$ give an efficient algorithm to count the occurrences of substrings $x[i,j] \in L$. More in particular, I am looking for a linear time algorithm in the length of the string $|x|$, for a given deterministic automaton $M$ accepting the language $L$. This question is meant to g...
I was going through the text : Compilers: Principles, Techniques and Tools by Ullman et. al where I came across the following algorithm to convert an $\epsilon\text{-NFA}$ to $\text{DFA}$ 1. initially, ϵ-closure(s0) is the only state in Dstates and it is unmarked; 2. while there is an unmarked state T in Dstates do b...
How practical are logic engines for proof paths combined with knowledge graphs in Providing reasonable explainability for ML models trained using GNNs? Adding more context. there is a history of logical reasoning (found in academic articles and in filed/granted patents) as a partial mechanism to building solutions to p...
I am not able to solve the following recurrence relation: $$ T(n) = \begin{cases} T(n-1) + n^2 & \text{if } n \ge 2, \\ 1 & \text{otherwise.}\\ \end{cases} $$ How do I start?
This is a question from a practice quiz at my university. Is the question asking for the cardinality of Σ1 = {a,b} to the power of four? if that's the case, then the set would still have a cardinality of 2 since elements in a set are unique. It wouldn't be {a,b,a,b,a,b,a,b} right?
I've been working on undecidability proofs and I found this question in the practice problems for the textbook "An Introduction to Automata Theory." I know that we start by contradicting the statement, and assuming that Language1 is decidable, so that there is a decider D which decides Language1. Then we construct a Tu...
I've been working on decidability practice problems and I came across this one in a practice problem set from the textbook An Introduction to Computational Techniques. I know the steps for how to prove a language is undecidable by constructing a Turing Machine which shows that the language is not recursive. However, I'...
A Burrows-Wheeler Transform (BWT) can be used to find the suffix array intervals for a pattern $P$ by issuing $p=|P|$ paired $rank$ queries \begin{align} s^\prime &= C[P[i]] + rank(s-1, P[i]) + 1 \\ e^\prime &= C[P[i]] + rank(e, P[i]) \end{align} where $s$ denotes the start of the search range and $e$ is the end of th...
In this question, I asked about how to prove naturality from parametric polymorphism, using parametricity. The current answer to that question simply assumes that the functors in question satisfy the functoriality conditions. Is there a "free theorem" result for functoriality? i.e. is it sometimes possible to see from ...
I am trying to teach myself Automata theory. I have hard time with the Pumping Lemma, so I am trying to work through examples. I stumbled upon this example, but it doesn't have steps how to solve it. I would appreciate a clear explanation of how I would use the Pumping Lemma to prove that this language S is not regular...
What is the complexity of the BFS algorithm for the shortest path on the unweighted grid? The grid is a classical maze with a starting point and exit, need to find an exit. Can move only vertically and horizontally. Found the answer here: https://stackoverflow.com/questions/50901203/dfs-and-bfs-time-and-space-complexi...
My understanding is the following: Time = With the initial not state is just to check if there are no elements in the list a. This is done in O(1) time. The first loop enumerates the second list b with the operation append() which is done in O(1) time therefore the first loop is O(n). The second loop I am confused if t...
Whenever there is a back edge, a cycle is detected. Then, do a pair of parallel edges form a cycle in a graph? If no, why it is not a back edge?
Let $X = X_1 \cup X_2$ a code on an alphabet $A$, with $X_1$ a biprefix code and $X_2$ a uniform code, with $m(X_1) < m(X_2)$, i.e. the maximal length of the first is strictly lower than the second. Now, if $v \in X_2$ we define a sequence such that $v_0 = v$ and $v_{i+1} = 1$ if $v_i \notin X_1A^*$ and $v_{i+1} = y_ix...
consider we have n bags of random amounts of coins. given k extra coins, the question is to find the largest gcd that can be obtained by adding these coins to any bag( all the k coins may not go in one bag and not all the coins are necessarily added) input consists of the number of bags followed by k( number of extra c...
For example, assuming I am using the set of natural numbers $\mathbb{N}^* = \mathbb{N} \cup 0$ as my domain. I want to create an algorithm such that at each index value $i$, I output a set. For example, $0$ maps to $\{1,2,3,4\}$ $1$ maps to $\{5,6,7,8\}$ $2$ maps to $\{9,10,11,12\}$ How might I go about deriving the ...
$T(n) = T(n/3) + T(2n/3) + n$ How can I solve this recurrence formula?
As the title said, prove $T(n) = T(\left\lceil{\frac{n}{2}}\right\rceil) + 1 = O(\log(n))$ My approach is to find $c, n_0 \in \mathbb{R}_+$ such that: $$\forall n \geq n_0, T(n) \leq c\log(n) -d \text{, where d is a constant}$$ Assume the statement is true for every $m < n$, especially $m = \left\lceil{\frac{n}{2}}\rig...
I was going through the text Compilers: Principles, Techniques and Tools by Ullman et. al first edition where I came across the following table. The authors justify the table as follows: Given a regular expression $r$ and an input string $x$, we now have two methods for determining whether $x$ is in $L(r)$. One appr...
I want to prove that $T(n) \neq O(n)$ for the Karatsuba algorithm, which has the following recurrence: $$ T(n) = \begin{cases} k_1, & \text{if $n$ = 1} \\ 3T(n/2) + k_2n, & \text{if $n \gt$ 1} \end{cases} $$ where, $k_1$ and $k_2$ are constants, such that $k_1 \gt 0$ and $k_2 \in \mathbb R$. So, to prove that $T(n) \ne...
If you use min() or max() on a constant sized list, even in a loop, is the time complexity O(1)?
I'm reading the Digital Design and Computer Architecture by David Harris, Sarah Harris. The authors give the following definition of combinational logic: A combinational circuit’s outputs depend only on the current values of the inputs; in other words, it combines the current input values to compute the output... A co...
I got stumped by this question during a coding challenge and I haven't come up with promising ideas for how to solve it. I am looking for hints or approaches to solve the problem, not necessarily the code. Given a string s find the lexicographically smallest palindrome of the same length that is lexicographically grea...
Consider $n\times n$ matrix $T$ which represents transitive closure of a directed graph. That means $T_{uv}=1$ if and only if there exist a directed path between vertices $u$ and $v$. Initially, $T$ is a identity matrix (every vertex has a self-loop). Now consider following function: function insertEdge(u, v): for x ...
I don't even know if this is the right place to ask this this...but how will Big O be with quantum computers? More specifically, will the worst case always be constant? If yes, how will this change our understanding of current algorithms? For example, will this mean that the difference between an algorithm running at B...
Recall floating-point representation: Suppose $f$ is a floating-point number then we can express f as, If $f$ is normal: $$(-1)^{s}\cdot2^{e-127}(1 + \sum\limits_{k=1}^{23} b_{23-k}\cdot 2^{-k})$$ If $f$ is denormal/subnormal: $(e = 0)$ $$(-1)^{s}\cdot2^{-126}(0 + \sum\limits_{k=1}^{23} b_{23-k}\cdot 2^{-k})$$ where $...
Given a set of points $x_1, \dots, x_n \in \mathbb{R}^2$, suppose one wants to find: $\text{argmin}_i \sum\limits_{j=1}^{n} \lVert x_i - x_j\rVert_\infty$ i.e. the point which minimizes the sum of the $L_\infty$ distances to the other points. One can apply the matrix $R =\left(\begin{smallmatrix}\frac{1}{2} & \frac{1}{...
As part of data science course I would like to solve particular problem with reinforcement learning algorithm. I believe I understand general concept, however the problems I had read about up till now had no random factor included. I would like to ask if it's valid to assume that reinforcement learning algorithm will b...
I learned that expressions are left associative while abstraction are right associative, however, while solving some examples i faced this problem. Succ 3 Succ 2 when i applied left associativety i got (Succ 3) Succ) 2 which was extremely long to solve. However, i saw this guy on the internet, he said that we should pa...
I have an edge coloring problem as follows: Suppose we have a DAG which has a source vertex s and an end vertex e, in addition, all the paths from s to e are of the same length say L. We define L colors from 1 to L. Is there an efficient edge coloring algorithm to color all the edges, such that every path from s to e u...
Let us have a weighted graph $G$. We are interested in a subgraph, $H$ of $G$ where each vertex has a degree at least a natural number $b(v)$. I am interested in a subgraph where the sum of the edges of the subgraph is minimized. This problem is known as $b$-edge cover. The optimization formulation is as follows. \begi...
We have been given a graph $G$, we need to find a subset of nodes $S$ such that each node of the graph is in $S$ or is adjacent to a node from $S$. Additionally, the elements of the subset $S$ should not be adjacent to each other neither should they share a common neighbour node. This is an example of the given problem...
I am interested in implemented the deterministic ${O(n\log(\log(n)))}$ algorithm for the closest pair of points problem described here by Fortune and Hopcroft: https://ecommons.cornell.edu/bitstream/handle/1813/7460/78-340.pdf In particular I would like to have a solution to the two-dimensional case. They say: "The alg...
Consider a string 'ABBAA' Possible substrings with even number of characters are 4 'ABBA' : Count of 'A' is even and 'B' is even 'AA' : Count of 'A' is even and 'B' is even ($0$) Similarly 'BB' and 'BBAA'. So a total of $4$ substrings are possible. If given string is 'AABCCBBCAA' substrings possible are "AA" "BB" "AA" ...
description of the algorithms behavior I have two strings s1 and s2, with $len\_s1 <= len\_s2$. I would like to find the substring of s2, that has the biggest similarity to s1. The following alignments are possible: [s2[:i] for i in range(len_s1)] + [s2[i:i+len_s1] for i in range(len_s2))] e.g. for s1="ab" and s2="abc...
I am going through problem 13-1 in CLRS 3rd edition. I came up with the following algorithm as a solution: PERSISTENT-TREE-INSERT(T,z) y= T.nil x=T.root while x != T.nil y=x if z.key < x.key x = x.left else x = x.right if y == T.nil T'.root = z return T' else if z.key = y.key y'=copy(y) ...
Lets define function $T(n)$ as \begin{align*} T(1) &= T(2) = 1\\ T(n) &= T(\lfloor\frac{n}{2}\rfloor+1)+1 \text{, where }n\ge 3.\\ \end{align*} Does $T(n)=O(\log(n))$? I have no idea how to prove or disprove this, so I'll be glad for any help.
Show that a language is decidable iff some enumerator enumerates the language in decreasing order. I know a language is decidable iff some enumerator enumerates the language in the standard string order (increasing order), but I am not sure if this makes sense in decreasing order. I carefully think if some enumerator...
I am reading the proof of Theorem 3.21 in Sipser's textbook. Theorem 3.21 A language is a Turing Recognizable iff some enumerator enumerates it. First direction (<==). Given an Enumerator E that enumerates language B, then we want to construct a TM M s. t. M that recognize language B. In order to do that, we do the f...
Today while I'm looking at definition of Algorithm from Sipser's textbook, he defined the following language: $$D_1 = \{ p \mid\ p\text{ is polynomial over }x\text{ with integral roots}\}$$. This language is decidable since we can bound the integral roots between two values and we can try all possible values between th...
Question: Given the RE (or NFA) for the set of all strings over $\Sigma ={a,b}$ such that: a occurs the odd number of times and each pair of a are separated by exactly $2n+2,n\geq 0$ b's. Attempt: Followed the way we construct the set of strings such that $a$ occurs the odd number of times, I got the following solution...
Consider an example 2-SAT instance with the constraint (x1​ ∨ x2)​. This CNF has these two implications: ¬x1​→x2​ and ¬x2​→x1​. "They actually mean, if x1​ is false then x2​ must be true, and if x2​ is false then x1 must be true, respectively. Any other case would make the 2-sat problem unsatisfiable." My doubt is rega...
I want to find a comparison sorting algorithm that can almost sort a set of data, using the least comparisons possible. What I mean by "almost" is that if the perfectly sorted data is $[x_1, x_2, …, x_n]$ and the almost sorted data is $[x_{i_1}, x_{i_2}, …, x_{i_n}]$, then $\forall j \in [\![1, n]\!], |i_j - j| \leq C$...
I want to construct a regular grammar that generates words that contain both "ab" and "bc" as subwords with the alphabet of the terminal symbols {a,b,c} My solution so far is G=(Vn={S,X,Y},Vt={a,b,c},S,F={ S-> aS | bS | cS | abX | cbX, X-> aX | bX | cX | ε})
I recently thought of and managed to solve this algorithmic problem: On a infinite 1-dimensional number line, we have N ranges specified by two distinct integers A and B, such that all A and B are unique. Each pair of integers then represents the starting and ending points of a range on the number line. How many distin...
I am trying to solve the following problem to find big-theta. I am having a lot of trouble, if anyone can help! T(n)=8T(√n)+log^2(e^n)? The logarithm is base 2 and is squared.
Given that a graph G has only positive integer weights and its diameter D which is the greatest of the shortest paths among all pairs of vertices in G. For a single-source shortest path problem and design an algorithm runs in O(V+E+D) time. As we know, in a single-source shortest path problem, we could use the Dijkst...
Consider this loop: for i = 1 to n j = i while j < n j = j + j end while end for How many times the while loop will execute? I was thinking that if we denote by $c$ number of time loop will execute then in each iteration $j$ would be equal to $2^{c-1}i < n$, then taking logarithm we get $c<log_2{n} - log_2{i} + 1...
I have this algorithm: I understand overall what's happening here, we're shrinking the blossoms (odd cycles) to end up with a bipartite matching problem, and then opening them again to get a maximum matching in this graph. But I don't understand it algorithmically, like what do the variable considered and label repres...
I want to design a context-free grammar that generates words that either both start and end with $c$, or contain the same amount of $a$-s and $b$-s. Here is what I have. The nonterminals are $S,X,Y$, the terminals are $a,b,c$, the start symbol is $S$, and the productions are \begin{align} &S \to aYS \mid cXc \mid bXS \...
Let $n,m$ be a positive integer with $m\ge 2n$. In the set $M=\{1,2,\dots,m\}$, some elements are black and others are white. Given $2n$ nonempty subsets of $M$, the task is to determine whether there exists a subset $T\subseteq M$ consisting of $n$ black and $n$ white elements such that each of the $2n$ subsets has a ...
I want to calculate complexity for binary exponentiation of matrix of size $k$. Let's say that I'm using the simplest approach to multiply matrices (so with three for loops). The complexity of this operation would be $O(n^3)$. Now, the powering of matrix. Pseudo code (n is the power, A matrix): power(n, A) if n == 0 ...
I read a few "function >> imperative/OOP" articles because I heard there was a move in imperative OOP languages toward a functional style of coding, especially encouraging pure functions when possible. One recurring argument is that by not mutating state, you don't have to worry about race conditions and locking. I do ...
I would like to find out the Expected height of a binary tree where the insertions are based on a random function. I.e. for each node I visit, there is a $\frac{1}{2}$ probability of choosing right or left. I know that the following property holds for height $h$, but it's difficult to add the probability:$$h_{tree}= 1+...
We have $n$ sets of $k$ points in $\mathbb R^d$ and we are trying to partition them to $k$ clusters of $n$ points such that from each set every point is mapped to a different cluster and the sum of variances of each cluster is minimized, i.e., we are trying to solve the $k$-means problem but with the constraint that po...
After reading the question and answers on Time complexity of min() and max()? I would like to clear up some confusion on the relation between time complexity and size of input. First, I've noticed most of the time people omit what exactly n represents in big O notation. Usually it's related to the input, but it may be ...
I would like to create an algorithm that advises a student when they should work on certain assignments given the expected time each assignment will take, and the due date of each assignment. Say that for a students' weekly schedule, there are class times and events that must be attended. With the remaining time slots ...
Let $G(V,E)$ be a graph (not necessarily bipartite), where edge $e \in E$ has weight $w_e$ (non-negative real). Then one can write the LP relaxation for maximum weight perfect matching as follows $$ \text{maximize}~~\sum_{e\in E} w_e x_e \\ \text{subject to}~~\sum_{e\in E: v\in e}x_e=1\text{ for all }v\in V \\ 0\le x_{...
I was wondering is it possible to create a simple circuit that detects if an input (a binary string) is a palindrome? So my approach is to feed the input to a circuit that reverses the input, ie if the input is 0111010, I need the output to be 0101110. Is this possible to achieve with only, and/or/xor/not and these sim...
How do I prove that $d(x,y)$, defined as the weight of the lowest common ancestor of $x,y$, satisfies the strong triangle inequality: $$ d(x,y) \le \max(d(x,z), d(y,z)) $$ How do I even start such a proof?
Let $L$ be a regular language on an alphabet $\Sigma$. and let $L^{ab} = \{\sigma_1a\sigma_2b...\sigma_n \mid \sigma_1...\sigma_n \in L\}$ be the language obtained by add between any two letters of any word of $L$ the letters $a$ and $b$, except before the first and after the last. Prove that $L^{ab}$ is regular. I t...
I was going through the text Compilers: Principles, Techniques and Tools by Ullman et. al. where I came across the following excerpt. Example 4.11. Consider the abstract language $L_1 = \text{ { $wcw$ | $w$ is in $(a|b)^*$}}$. $L_1$ consists of all words composed of a repeated string of $a$'s and $b$'s separated by a ...
I am reading about consistent hashing for system design and I understand the application of consistent hashing and the use of virtual nodes. I want to understand how to calculate the optimum number of virtual nodes and how to place them on the unit circle. https://youtu.be/zaRkONvyGr8?t=433 in the above video the autho...
Are $O(n+m)$ and $O(n+2m)$ the same? If $m>n$, then both complexities are $O(m)$. Likewise, if $n>m$, then they are $O(n)$. Is this correct?
A Von Neumann Architecture bottleneck is a limit on the amount of data a computer can process due to limited bandwidth between the CPU and RAM. Possible mitigations to the problem according to Wikipedia are... Providing a cache between the CPU and the main memory Providing separate caches or separate access paths for...
In the context of P/poly complexity class, an advice function is mentioned. How is the advice function different than an oracle(/certificate)? https://en.wikipedia.org/wiki/Advice_(complexity) https://en.wikipedia.org/wiki/P/poly
When working with recursion it is often useful to find the least or greatest fixed points of a morphism, often using a fixed-point combinator. When working with recursion schemes, the inverse operation — finding a morphism for which a value is a fixed point — is also very useful, in which case the operation is sometime...
Consider the recurrence $$T(n)=T(\tfrac{n}{a}) + T(\tfrac{n}{b})+O(n^c).$$ What is the condition on $a,b$ that guarantees $T(n)=O(n^c)$? With substitution I get $$T(n)=T(\tfrac{n}{a}) + T(\tfrac{n}{b})+O(n^c)\le (\tfrac{n}{a})^c + (\tfrac{n}{b})^c + n^c = n^c ((\tfrac{1}{a})^c + (\tfrac{1}{b})^c + 1)$$ I need $(\fra...
The running time of the original non-weighted algorithm is $\mathcal{O}(M(n, n + m)\,log(n))$, where $M(n, m)$ is the execution time for finding a min-cut in a network with $n$ nodes and $m$ edges and $log(n)$ is the number of times the while loop must be executed. The changes he makes to the original solution are: t...
Given the following recurrence relation: \begin{gather*} h(A) = \begin{cases} 0,\qquad \qquad \text{ }\text{ }\text{ }A=0\\ 1+h(A-1),\text{ }\text{ }A\text{ is odd} \\ 1+h(\frac{A}{2}),\qquad \text{otherwise} \end{cases} \end{gather*} which of the following choices best describes its complexity? A) $h(A)\in\t...