instruction
stringlengths
35
29.1k
I'm trying to solve an exercise from "Algorithmics for hard problems" but I have no idea how to solve it. First the definition of one-sided-error Monte Carlo algorithm is a little different than usual. We say A is a one-sided error monte carlo algorithm recognizing L if for every $x \in L, Prob(A(x)=1) \geq1/2$ for ev...
On the proof assistants StackExchange site, someone gave this example of a dependent product: $$\prod_{i\in I}\sum_{j\in J_i}x_{ij}=\sum_{f\in\prod_iJ_i}\prod_{i\in I}x_{if(i)}$$ The dependent product is the $\prod_iJ_i$ bit, and just what role it plays in this case is mysterious to me. It's a very short answer, and th...
That's what I'm formally asking: Let the algorithm $A$ have the worst-case time complexity $\Theta(f(n))$, such that for any algorithm $B$ with the worst-case time complexity $\Theta(g(n))$ doing the same job as $A$, $g(n) \in \Omega(f(n))$. Let $\Theta(s(n))$ be the worst-case space complexity for the algorithm $A$, s...
I am looking for an unranking (and ranking) algorithm for permtuations that is consistent with the order that Heap's Algorithm generates permutations. I have been researching a bit on ranking and unranking of permutation algorithms. A ranking function for the permutations on n symbols assigns a unique integer in the ra...
In my university class, I received this homework assignment on computer architecture, but I don't know how to solve it. I already know that the correct answer is 0, but I don't understand why. Could someone help me? Problem: The byte-addressable memory has a 16-bit address. The directly addressed cache has 7-bit tags a...
People I know said that converting a Regex to DFA is just a "matter of judgement" (I do not believe them, there has to be a more systematic approach). Is there a simple/intuitive, yet concise way to convert a Regex like this a*b+a(b+a|aa+b)*ab(a?|bb?a)+ into a DFA?
Neither could I find any counterexamples, nor could I show that if indeed the complement of NP-hard problems was NP-hard, one could deduce some unknown results from it, which would imply that it is indeed probably unknown. If someone knows the answer or a paper where this question is discussed or any other reason why t...
Given an undirected graph, two vertices $s$ and $t$, and two integers $k$ and $r$, then a $k$-set of internally disjoint $s$-$t$-paths is defined to be a set of exactly $k$ $s$-$t$-paths that share no vertex except for $s$ and $t$. What is the complexity of deciding whether there are $r$ pairwise edge-disjoint $k$-sets...
Suppose you have a Knapsack (optimisation) problem with integer values and weights, and you know the optimal value $OPT$. Can you compute an optimal solution in polynomial time by using a PTAS or FPTAS and setting $\epsilon < 1/OPT$, since this would mean it computes a solution in polynomial time which is of value $\ge...
A is an array of size n of different numbers (not necessarily integers). Indexes start from $1$ to $n$. S is an array with the property: $$S[i] = |\left\{A[j] \ : 1\le j<i \ \text{and} \ A[j] \le A[i]\right\}| $$ For example, for $A=[2,7, 4,5,15,9,12]$ , $S=[0,1,1,2,4,4,5]$. I want to sort $A$ with time complexity...
The 2-coloring problem is in P. How can I prove that it is in NL or L? I see that I should create a deterministic/nondeterministic algorithm with logarithmic space, but I have no idea how to store the coloring in logarithmic space.
I have a 12-dimensional state-space and would like to use a kd-tree to partition my data, so that nearest neighbour operations can be performed quickly. Unfortunately I have the issue that three of the states are angular values which wrap-around (360 degrees and 0 degrees are the same), which will mislead the nearest n...
Suppose we've to pick $K (\le N)$ random integers in the range $[0, N - 1]$ for very large $N$ such that there is no repetition, while also deterministically minimizing the number of calls made to the $rand()$ function. How would we do it? Assume $rand(X)$ produces a random integer in the range $[0,X - 1]$; calling it ...
I know what P-hard means. Let's denote the P-hard problem as H. For any problem A in P, there exists a polynomial-time reduction from A to H. I think the answer is yes (I suppose that every "easy" problem can be reduced to a "harder" problem (in this case problems in P to an NP-complete problem), but I am not sure.
I`m currently doing my homework that solving TSP using DP algorithm or branch and bound algorithm or backtracking algorithm only to solve up to 40 vertices and I can solve up to 30 vertices when I try 35, it get bad_alloc at memory location 0x00000059F29EEB30. I try to figure out the algorithm but it doesn't get any be...
If yes, could you say an example? P=NP would result in NP problems being solvable in polynomial time, but there would still be problems in the EXPTIME class.
Imagine two vectors $V=[v_1, v_2, \ldots, v_n]$, $S=[s_1, s_2, \ldots, s_n]$ where $S$ is a rearrangement of $V$ based on some relation $\leq$. Imagine that, instead of computing $S$ using as input $V$ and $\leq$, and want to returns an index map $Idx$. There are two possibilities, where: $Idx[i] = j$ means that $v_i$...
I am practicing paging in virtual memory and came across a question with the following details 44-bit address space 16KB page size 16 Bytes Page table entry (PTE) If I understand paging correctly then there would be 2^30 pages, and the page table size if 2^44 bytes My questions is, do I use a single-level page table ...
If I start with $n$ different points $P_1,\ldots,P_n \in \mathbb{R}^2$ and want to select a set $X$ of cardinality $m \leqslant n$ from them subject to the condition that the value $$d_\text{min}(X) = \min_{P, Q \in X, P \neq Q} d_\text{eucl}(P,Q)$$ is maximized by my choice of $X$, then I understand, that this an inst...
Given an array of size $n$ that has the item of the heap. To remove an arbitrary element from the heap we would need $O(n)$ to find the element and then $O(logn)$ to reheapify if I am commrect, which means total time complexity is $O(n + logn)=O(n)$. In study notes, I saw it's written $O(nlogn)$, which does not make se...
For an NFA with language: {w ∈ {0, 1}*: the length of w is odd but not a multiple of three}. How many states are required? This is the work I have come up with so far: q0: non-accepting state - because of even length q1: accepting state - because odd length and not multiple of 3 q2: non-accepting state - because even l...
We are given an undirected graph $G(V, E)$, and let $n = |V|$. The task is to find a bijective function $\psi: V \rightarrow \lbrace{1, 2, \dotsc, n \rbrace}$ such that the following objective is minimized: $\sum_{(u, v) \in E} \max(\psi(u), \psi(v))$. I am interested in the complexity of this problem. Note that this p...
The Bucheim-Walker algorithm is used for drawing trees. However, there are many real-world examples where Directed Cyclic Graphs would benefit from such an algorithm (e.g. family trees with intermarriage or incestual relationships, dependency graphs, etc.). Can the algorithm be modified to support DCGs? If so, how? Spe...
Consider a graph $G$ with $N$ nodes, with the distance of each node initially set to infinity (there is no start node). If there are no negative cycles in the graph, then after $N - 1$ iterations of Bellman-Ford, any additional iterations will not modify the distances (the distances are stable). On the other hand, if t...
I am trying to find complexity for following algorithm. It is from "The Algorithm Design Manual" book. for k = 1 to n: x = k while (x < n): print ’*’ x = 2x I simulated algorithm for some values. Each time inner loop operates on n-k value. k=1 x=1 x=2 x=4 x=8 ... k=2 x=2 x=4 x...
Given an array with the size of $n$ of integer numbers. Our goal will be to analyze the expected running time of an algorithm that uses a hash table to find (if exists) a pair $(a,b)$ subject to $2<|a-b|<5$. The answer is $O(n)$ but I have no idea to convince myself. Some thoughts that come to my mind are as follows: c...
Solving $N$-player general sum matrix games is known to be PPAD-complete, and even for two players algorithms such as Lemke-Howson can take exponential time in the worst case. On the other hand, verifying that a solution is indeed a Nash equilibrium can be done in polynomial time. Are there standard examples/benchmarks...
In an answer to this question: For instance, modern Intel TLBs have a process context ID (PCID); each TLB entry is tagged with the PCID of the process that the page mapping is for, and the processor will only use that TLB entry if its PCID matches the ID of the currently running process. The processor fills the PCID w...
I am trying to find the Big O notation of this code below, really its the big theta, but whatever I believe its the same in this case. for (i=2; i < n^2; i++){ for (j=3; j < 4i^3; j = 2*j){ x = i+n } } One, I believe that the constant in 4i^3 can be dropped. And so, the inner loop is maybe, O(i^3) => (2^k)...
Given a set $S$ of N-element sets, I want to generate all (N+1)-element sets (call this set $T$) such that for each element of $T$ each N-element subset is in $S$. My current naive algorithm performs quite badly. Set $S$ ~ 100-10000 elements and $N$ ~ 5 or so. More concretely (although perhaps more confusingly). Let $N...
Context: I was reading a research paper related to polyhedral representation(citation given in last). Got confused while trying to understand the notation by implementing them with example code. Paper Citation: Bastoul, Cédric & Cohen, Albert & Girbal, Sylvain & Sharma, Saurabh & Temam, Olivier. (2003). Putting Polyhe...
Lets say I have a SAT problem with variables $x_1,...,x_n$. For a given subset of the variables I want to create a clause which forces an even number of the variables in $S$ to be true. Of course there is the brute force solution, but I would like a more efficient solution with as few clauses/variables as possible.
I suppose that this statement is true if NP equals with coNP, otherwise not, but I don't know how can I prove that.
I know the double tree algorithm and Christofides algorithm with 1.5 approximation ratio. We got this question from the teacher.
One version of the minimum sum vertex cover [1] is the following problem: We are given an undirected graph $G(V, E)$, and let $n = |V|$. The task is to find a bijective function $\psi: V \rightarrow \lbrace{1, 2, \dotsc, n \rbrace}$ such that the following objective is minimized: $\sum_{(u, v) \in E} \min(\psi(u), \psi...
Suppose a generalized version of k-SAT where the usual clauses (disjunctions of literals) are generalized to arbitrary Boolean functions of k variables. (For example, $(x \oplus (y \land z)), ((x \land z) \lor (y \land z))$ and $(x \implies z)$ could be generalized clauses for k = 3.)(Just a note: there are $2^{2^k}$ B...
I know that when I compile a program and then I inspect with objdump, I have addresses. These are relative addresses. But if it's a C program and I printf with %p a pointer, that is a virtual/logical address. Who generates this? Is that the loader? If yes, why do I need that a loader does this? Isn't it sufficient a re...
I know that exists problems that surely cannot be decided in polynomial time because P class doesn't equal with EXPTIME (for example Go, generalized chess etc.). But I assume that there may be problems for which we currently only have an algorithm with exponential time complexity and yet can be solved in polynomial tim...
I have proved that $\overline{A}\le\overline{B}$ is true, but I have no idea how to prove or disprove the opposite direction.
Proove or Disproove $ \exists L_1 , L_2 \in RE \setminus R $ such that $ L_1 \cup L_2 \in R $ and $ L_1 \cap L_2 \in R $ I tried to use the languages the union is $ \sigma^* $ and the intersection is empty language but I am really not sure if that really answer the question
proof or disproof if $ L_1 \subseteq L_2 $ then $ L_1 \leq L_2 $ I tried to think with HP and the empty language because HP is in RE and the empty language is in R but how do I prove this does not always happen? I don't understand whats the formal way to write it down
Is $L =$ { $\langle M \rangle$ | $M$ moves left on at least one input } decidable? What would the proof look like? Intuitively, I would say it's undecidable: We cannot predict if a given TM ever reaches an accepting transition on a specific input, let alone predicting if it would reach some transition $\delta(q,a) = (...
I am very interested in the following questions, which sprang out from the topological study of loops in surfaces and their intersection numbers. Consider, over a finite set of boolean variables $X$, a Boolean formula in CNF (conjunctive normal form) whose clauses only contain non-negated literals. Assume the following...
Problem Description I have two sets of 2D points with flavours: Noisy points $$p_i = (x_i, y_i, f_i) : p_i \in N : |N|\approx 10^8 $$ and true points $$p_{t_i} = (x_{t_i}, y_{t_i}, f_{t_i}) : p_{t_i} \in T : 10^6 \lt |T| \lt 10^7.$$ Each noisy point $p_i$ has been generated by adding errors $p_{e_i} = (x_{e_i}, y_{e_i...
There is a directed acyclic graph with M edges. There is only one component (If they were undirected edges all nodes will be reachable will from one to another). An edge from a to b means value of node a is strictly greater than value of node b. What is the total number of combinations of assigning natural numbers as n...
For cases where recursion is used as well as memoization (so that a number of subtrees of what would otherwise be the overall recursive call tree are each replaced to be O(1)), I am wondering what the resulting runtime is (such as whether it is the same as the corresponding dynamic programming approach), or really, how...
Proof or Disproof if $ L $ is a Regular language then it has to be that $ L\leq HP $ $ HP=\{<M,x> | M \ halts \ on \ x \} $ Regular language is a language that can be expressed with a regular expression or a deterministic or non-deterministic finite automata I know that HP is in RE\R and I know the regular language...
I considered the Euler circle problem to decide this. The polynomial reduction is: I add a new vertex in the graph: If the degree of each vertex is even, then I connect all the vertices with this new vertex Otherwise, I only connect the vertices with an odd number of degrees to the new vertex Is this a correct reducti...
$L_1$ = {$a^nb^mc^xd^y$|$n=m$ or $x=y$} $L_2$ = {$a^nb^xc^md^y$|$n=m$ or $x=y$} For $L_1$: Push a's Now pop the same number of b's , Given n=m If Stack is empty and x=y=0 accept the Langauge else push c's and pop d's If Stack is empty accept the Langauge It's DCFL and also CFL. For the $L_2$: It's Not CFL. But the an...
In stack languages (e.g. PostScript, Forth), return values are passed on the stack - zero, one, even a variable number. Python supports tuples of values there, frequently used "without tuple syntax", but creating a tuple regardless (garbage if not kept but unpacked immediately). Is there any non-stack language handling...
The SAT is in NP, I suppose that the complement of the halting problem is in coNP-hard. I suppose the answer is no because SAT is not in coNP, but I am not sure.
I am trying to implement a BTree. As far as I understand the lower the height of the Tree the faster the search (This could be wrong, please correct me if it is). Is pre-emptive split with non-pre-emptive merge the best or non-pre-emptive split with pre-emptive merge or the other 2 combinations left? Which offers bette...
I consider a deterministic pushdown automaton. Given that there are some differences between definitions, here is mine: the syntax is given $A = (Q, \Sigma, \Gamma, \Delta, q_0, Z_0, F)$, with $q_0\in Q$ is the initial state, $Z_0\in \Gamma$ is the starting stack symbol, $F\subseteq Q$ is the set of final states, and ...
I attempted to create a language $L_1$ = {$<M>| L(M) = 1^*$} and prove using a reduction that $L_1$ ∌ RE and $L_1$ ∌ CoRE by showing that $HP ≤ L_1$ and $\overline{HP}$ $≤ L_1$. But my instructor said this isn't correct.
let L be defined as $L = \{0^{2k} | k \in \mathbb{N}\} \subset \{0,1\}^*$. language L can be described by a nondeterministic pushdown automaton P such that there exists at least one input for which P accepts the input by falling into an infinite loop is this statement true or false? if it's true, then why? here is wh...
It is a very straightforward question. I know that the following holds, and I know why it holds: $DTIME(f(n)) \subset DSPACE(f(n))$ However, is there a language $L \in DSPACE(1) \setminus DTIME(1)$? The "1" is supposed to represent a constant complexity. It seems to me there is not such language but I don't know how to...
I learned the amortized analysis of Prof Demaine's 6.006 videos. The Erik's thesis was, If we reallocate memory by doubling capacity => $$1 +2+4 + 8 + 16 +..+n = \theta(2^{lgn}) = \theta(n)$$ From Amortized analysis, we can say that after an operation we get linear complexity so the overall complexity of inserting is c...
My question is about LeetCode "137.Single Number II": 137.Single Number II Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. You must implement a solution with a linear runtime complexity and use only constant extra sp...
In the book A Science of Concurrent Programs Leslie Lamport describes alternative way how to look at safety and liveness properties in distributed algorithms. A.5 Another Way to Look at Safety and Liveness This section provides a different view of safety and liveness based on viewing behavior predicates as sets of beh...
I was referring to the textbook Artificial Intelligence: A modern approach 3rd by Stuart Russell and Peter Norvig. what to prove about the general "graph search": (Here I assume "within a factor of b" means multiplier $b$ instead of addition $\pm b$ based on the complexity context. So if time complexity is $O(b^d)$, th...
Let $G = (V, E)$ be a flow network with a source $s$ and sink $t$. However, the constraints are a bit different: Conservation constraint is as usual. For each edge $e \in E$, we have that the flow $f$ maintains that $f(e) \geq c(e)$ when $c(e)$ is the capacity of $e$. The question asks to write an algorithm that finds ...
Let $\alpha \in (0, 1),\space l \geq 2$ and $T: \mathbb{N}\rightarrow\mathbb{R}^+$ such that, $T(n) = \begin{cases} n^l + T(\alpha n) + T((1-\alpha)n) & : n > 1 \\1 : n=1 \end{cases}$ Bound $T$ asymptotically tight. So I understand that I need to split into cases, the first one is where $\alpha < \frac{1}{2}$ and ...
Prove that there isn't a complete language over a given alphabet $\Sigma$. That is, there is no $C \subseteq \Sigma^*$ such that every $L \subseteq \Sigma^*$ is Turing-reducible to $C$. Attempt: Let $L$ be a language and let $\overline{L}$ be its complement. And let's say there is a reduction between $L$ and $\overline...
I have a bunch of values, some that are given by an end user input and some that are calculated based on that input. The way that the values are calculated are input by a different group of users of the software. My goal is to give the second group of users feedback that their input can always be solved. Now to the act...
I'm new to the complexity theory and have a basic question about the big-O notation that I encountered. I came across a complexity of $O\big(\frac{n}{m-n}\big)$, where both $n$ and $m$ are independent variables in my algorithm (assuming $m \geq n$). Since I haven't encountered the subtraction of two variables in the de...
Are languages generated from a statically typed language statically typed? So say, generating Python from C++. to generate a language from another language: You write a transpiler in a static language $L_s$ so that it can produce the equivalent program in language $L_{sORd}$. Issues: The statically typed language mus...
Pattern matching in programming languages as for example in Racket is some kind of parsing. Which level in the Chomsky hierarchy does this parsing technique have? Is it type-3 like regular expressions or type-2 or even lower?
I'm seeking information about a specific sorting algorithm. This algorithm performs pairwise comparisons and distinguishes between three states: a > b: In this case, standard sorting logic proceeds (b precedes a). a < b: As usual, a precedes b. a = b: when elements are considered equal, both a and b are "fused" through...
Suppose we have an approximation algorithm to some maximization problem, that returns a solution with value $(1-\epsilon)*OPT$. If the runtime of the algorithm is polynomial in the input size and $1/\epsilon$, then it is called an FPTAS. If the runtime is polynomial in the input size and $\log(1/\epsilon)$, then the a...
The hierarchy $$\text{regular languages $\subset$ deterministic context-free languages $\subset$ context-free languages $\subset$ context-sensitive languages $\subset$ recursively enumerable languages}$$ has an 'extra level' with respect to the Chomsky Hierarchy. Why is the Chomsky hierarchy taught, as opposed to s...
The first example of a (nondeterministic) pushdown automata given in Linz' An Introduction to Formal Languages and Automata is the following: Example 7.2: consider $Q = \{q_0,q_1,q_2,q_3\}$, $\Sigma = \{a,b\}$, $\Gamma = \{0,1\}$, $z = 0$, $F = \{q_3\}$, with $q_0$ the initial state and $\delta (q_0,a,0) = \{(q_1,10...
thanks for your help. This is my first question, so I am very sorry for the bad presentation of the question. I am studying computer science and this is the question I have been asked for the course of Theory of computation and complexity Edited question 1.For every two languages $A,B∈PSPACE$, there is a language $C∈PS...
I've invented an abstract structure to represent a comparison-based sorting algorithm, which I will call a comparison tree (similar to the decision tree of a comparative sorting algorithm). Specifically, a comparison tree is a full binary tree rooted at $s$ where each non-leaf node is labeled with an ordered pair $(x,...
For the algorithm provided in answer to this question, how would I go about proving the correctness of the algorithm? The referenced question is: “You are given an array $A$ of length $n$. Each value is $1$. However, you do not know what the value of $n$ is. You are allowed to access an element $i$ of the array by call...
I have two groups (GROUP1 and GROUP2) of undirected weighted graphs - one having properties more similar to small world network and other relatively random. These are represented as adjacency matrices with 32 nodes and weights 0 to 1 representing connectivity strength among nodes. I am taking help of small world networ...
Please tell me what is the correct formula for calculating the cost of an algorithm? I used this: number of calculated functions + 4 * number of calculated function gradients + 8 * number of calculated Hessian matrices of the function. I use this formula to calculate the cost of Newton's method of finding the minimum o...
There are $n$ sticks of lengths $1$ to $n$ in a row. Upon permuting them randomly, we may calculate the average number of peaks viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are: 123 3 132 2 213 ...
Our problem is similar to this, but it details various approaches we can make. The problem also was formulated operation research, but got hit with numeric limitations. Here we seeking to find reference algorithms per each complexity added, its pratical limitations (limited numbers N, formulas for constant C factors to...
A process can receive two kinds of signals classified based on the source and reason. Synchronous are the one that are generated by illegal memory access or division by zero. Asynchronous are the one that are generated by another process like SIGKILL and etc. Quoting from the 9e OSC Book by Prof. Galvin, topic Signal...
Mitchell specifies a set data type: ie, an algebraic specification for set. He then asks to prove that the equation union s s' = union s' s [s, s': set] does not hold in the initial algebra. He suggests that we use the following result: two terms are provably equal iff they reduce to a common term. Here are the relevan...
I'm wondering where (how? why?) my reasoning (by imagining the recursion tree) deviates from the application of the Master Theorem (Case 1) to this recurrence. The Master Theorem gives $\Theta(n^{\log_{5}4})$, whereas reasoning from the recursion tree gives me $\Omega({\log n})$ and $O(\log^{2}n)$. My rationale: Each ...
$ Fin = \{ L \in \Sigma^* : |L| $ is finite and greater than 0 $ \} $ Proof or disproof Fin = Fin-Complete Where Fin-Complete means that for every $ L_1,L_2 \in Fin $ there exist a valid reduction $ L_1 \leq L_2 $ my trial: Consider two languages $ L_1 $ and $ L_2 $ where $ L_1 $ contains a single string s $ L_1 = \{ ...
How can I estimate the probability that the sum $S_n$ of $n$ uniform random 48-bit signed integers overflows a 64-bit signed integer? Edit: the overflow can occur at any step, not only on the final result. Since this is a normal distribution, I guess that the cumulative sums more or less oscillate around zero, and that...
I have a directed graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: Each vertex can only belong to one cluster The total number of original-gra...
I would like to prove or disporove: there exists infinitely many languagess that are RE-Complete. Here is my attempt of the proof. Let $L$ be any RE-complete language. Define a padded version of $L$, denoted $L'$ as follows, where $k \in \mathbb{N}$ is a fixed number: $$L' = \{x@^k \mid x \in L\}.$$ where $@$ is a new ...
While reading the example given in [1]., I couldn't understand how the authors set up the logic to compute the weakest preconditions (wp) in their car example in section 4.2. The dynamics of the problem are given by - $x' = x + 0.1v$ $v' = v + 0.1a + \epsilon$ I don't see the authors working on the former equation, onl...
I'm trying to prove the correctness of an interpreter for a simple extension of untyped lambda-calculus with De Bruijn indices. The interpreter is bounded, i.e. in order to ensure its finiteness it has an additional parameter $n \in \mathbb N$ that decreases with each recursive call. The function returns $\bot$ when $n...
I have exam next week about automata theory, languages and computation. I struggle with reductions (Undecidability). For example for this two problems, and need to check first if the language is recursive, RE but no recursive or NOT-RE. After that to prove with reduction, okay for proving is easy I think, but to check ...
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[m]; A[m] = temp; } ...
The Green500 is a biannual ranking of the world's most energy-efficient supercomputers. It was first measured in millions of floating-point operations per second per watt of power consumed, and is now measured in billions of FLOPs/watt instead due to advances in distributed computing. For instance, the Simons Foundatio...
I'm reading about page tables in Patterson & Hennessy's Computer Organization and Design RISC-V Edition. The excessive memory usage of a single-level page table is noted w/: with a single level page table for a 48-bit address with 4 KiB pages, we need 64 billion table entries. As each page table entry is 8 bytes for R...
I am trying to design best solution for a chat application based on LLM model which has set of functions and based on user input can retrieve the information. I would like to ask you for some proposals regarding this because I am running of ideas. I've implemented PoC application where I am storing in mongo db collecti...
Problem Statement: We want to update(only decrease allowed) elements of array to obtain a new array which is in same ratio as ratio array. Example lets say you have quantity vector as [20, 50, 20] and ratio vector as [1, 2, 1]. Now you update quantity array to [20,40,20], so you have quantity elements in same ratio as ...
I am working on a project and came across the following problem I have to solve. Imagine we have a time series data Ts which is an array of pair, say each element is (Xi, Yi). The length of this array is constant N but is updated regularly. Each update consists of two steps, We remove Ts[0] Add a new pair (X, Y) to th...
Suppose an absolute beginner (in the field of data analysis/data science), which is indeed my case, has decided to create a project for his/her resume. These are the skills he has learnt: Python(Pandas, NumPy, Seaborn/Matplotlib) - 2 years of experience (intermediate level) SQL - 1 month of experience have knowledge ...
With Lamport clocks, each node keeps its own counter. Before sending a message, a node increments its counter by one: LC(A)=LC(A)+1, and sends {1,msg} to B. Upon receiving a message, B updates its counter using the following formula: LC(B)=max(LC(B),LC(msg))+1=max(0,1)+1=2. This works as expected when A and B take turn...
Given an alphabet $\Sigma$ of $n$ elements, whenever there is some order $\leq$ over the elements of $\Sigma$, we define $s^{\leq} : \Sigma^{*} \mapsto \Sigma^{*}$ as \begin{align*} s^{\leq} \left( (a_n)^m \right) &= (a_1)^{m + 1} & m \geq 0\\ s^{\leq} \left( \alpha a_i (a_n)^{m} \right) &= \alpha a_{i+1} (a_...
I am trying to convert the below context-free grammar into Chomsky Normal Form, specifically, removing rules that have three or more variables or terminators. $$S \to A a B \;\vert\; B b C$$ $$A \to A a B \;\vert\; B b C$$ $$B \to B b C$$ $$C \to x$$ I am trying to understand if the right converstion would result in th...
I was reading this post, and in it I learned how to make difficult instances of the SubSet Sum Problem. There the guy who responded to the post says that it is necessary to have density 1.0 and all elements of the difficult instance must have a size in bits equivalent to the number of elements in the vector $S$ of inte...
We know that Linear context-free languages are not closed under complement, so I encountered a challenge in finding an example to show the above theorem. I think the complement of $L={a^nb^n}$ is not linear, but I can't prove it.