instruction
stringlengths
35
29.1k
Given any singly linked-list L storing n real keys, that is, each key in L belongs to R, design an algorithm (either in words or in pseudocode) that computes the sum of the negative keys in L. What is the running time of your algorithm, in the worst-case, using O notation?
About a Universal Computer, this wiki says: A universal computer in a cellular automaton is a system that can compute anything that a Turing machine can compute (another term for this is Turing-complete). A cellular automaton in which such a system exists is called universal. A universal computer may be either infinit...
My book(digital design and computer architecture ARM edition) explains loads and stores like this: To perform a load or store, the processor must first translate the virtual adress to a physical adress and then access the data at that physical adress. The processor extracts the virtual page number from the virtual adr...
A naïve solution would be to first sort all sets, taking time $O(N n \log n)$. Then, for every possible pair of sets, check if one is a subset of the other, and if applicable remove the subset. This checking and removing can all be done in time $O(N^2 n)$. The total time complexity would thus be $O(N n \log n + N^2 n)$...
As part of a hobby project I stubmled into the following question which has me stumped: Given an undirected graph $G = (V, E)$ and an integer $k$, what is that smallest number of edges that need to be added to $E$ such that the new graph $G' = (V, E')$ has a complete induced subgraph of size $k$, and what vertices woul...
What is the proof that STCON (returns 1 if there is a path in the directed graph $G = (V,E)$ from $ s \in V$ to $t \in V$ and else, 0. is indeed in NL? (Non-deterministic turing machines with logarithmic memory)
I have the following problem to solve: Given a non-empty array A consisting of N integers, the task is to find the first unique number in the array. A unique number is defined as a number that occurs exactly once in the array. The desired output is the unique number with the lowest position in the array. For example, c...
Let $\varphi = \bigwedge C_k$, in which $C_k$ is a clause in X3SAT (exactly-one 3SAT or one-in-three 3SAT). That is, $C_k = (l_i \odot l_j \odot l_u)$ such that $l_i \in \{x_i, \overline{x}_i\}$ for any $i$. Then, $C_k$ is true iff exactly one of $\{l_i, l_j, l_u\}$ is true. Hence, if $C_k$ is true, then $[l_i \Rightar...
General description I have an optimization problem in which I need to schedule events and each of the events needs to be scheduled exactly once. The "cost" of scheduling one event depends on all of the events that have been scheduled before. So given a list of events $[e_1, e_2, ... e_n]$, the goal is to find an optima...
I feel that choice should work great for proving non - regularity of the mentioned language. If $L=\{ww|w \in \{0,1\}^*\}$ and we choose $s=0^p0^p$, meaning s is atleast as long as 'p'. Then we can decompose s as follows $x=empty \ string,\ y = 0^p, \ z = 0^p$ Then we can pump 'y' according to the rules of pumping lem...
I want to be an OS developer. I can say I am a bit comfortable after i read few tutorial on x86 assembly. But I see a lot detailed in intel manual, does an OS developer really need to study whole manual for its architecture. Is there any alternative ? Will I miss something important if only reading short tutorial rat...
Suppose I have the following CFG that I would like to bring to CNF S -> TA | bA | Ab | b A -> Aa|a T -> Ab Then I have two options to get rid of the nonsolitary terminal a in Aa 1 - Make a new nonterminal K and introduce the rule The grammar in this case becomes K->a S -> TA | bA | Ab | b A -> AK|a T -> Ab 2 - O...
I'm trying to figure out a more efficient solution to the following problem. Dataset: A set of arrays of key-value pairs (K, V). The arrays have varying lengths, and the keys are non-zero 16-bit unsigned integers. Examples: [(3, 100)] [(1, 200), (1, 100), (2, 300)] [(2, 200), (2, 300)] Input: A fixed-length array of ke...
I have the following regex that I'm trying to convert to a CFG: e|a(,a)* (e representing the empty state). Basically I want to match a comma-separated list (without a leading or trailing comma) or nothing at all. Here are some of my attempts: S = A A = e | a | a , A This doesn't work, it matches ,a (leading comma). S ...
I have the following hash table with hashcodes being quadratic numbers. Why do 0, 16, and 64 have different number of collisions when they map to the same number (line %16). Also how is it possible for 64 to have 6 collisions?
I am trying to address the following claim- "running prim algorithm on a disconnected undirected graph returns minimum spanning forest". I thing that the claim may be false (i.e there might be an example of a disconnected undirected graph so that the prim algorithm doesn't return MSF) but I cannot think of such example...
Given an undirected graph $G=(V,E)$, and vertex $v\in V$ and a number $k\in \mathbb{N}$, find an algorithm to find whether there exists a spanning tree of $G$ in which $v$ satisfies $d(v)=k$ I've narrowed the solution to 3 situations, in $G$: $d(v)<k , \\d(v)=k\\d(v)>k$ When $d(v)<k$, it is clear that there cannot exis...
I need to prove that $coNP \neq NTIME(n^2)$ using time hierarchy theorem. as we know $DTIME(n^4)\subseteq P\subseteq coNP$ from time hierarchy theorem we can derive that $DTIME(n^4) \not \subseteq DTIME(n^2)$ therefore $DTIME(n^2) \neq coNP$ Also as we know $NTIME(n^4)\subseteq NP$ from time hierarchy theorem we ca...
Prove $PSPACE$-completeness of the language $READALLEXACT$ = $\{$$(M, x, 1^ s , t)$ | $A$ deterministic Turing machine $M$ on input $x$ reads all bits of the input in exactly $t$ steps and using no more than $s$ memory cells (consider that a bit is read if the machine head has ever been over it; after reading the inpu...
I'm currently stuck showing $NP$-hardness of a problem of mine. An instance of my problem (I call it (simple) pairwise $2$-Partitioning) is given by the following: Given a set of tupels $B=\{(b_1,1),\ldots,(b_n,1)\}$, with $b_i\in\mathbb{N}_{>0}$. Goal: A partition of $B$ into two subsets $S_1, S_2$ such that each ele...
Is there a 2SAT instance of variables $(a,b,c,d,e,f,g)$ that has exactly the solution set $S=\{ (1,0,0,0,0,0,0),(0,1,0,0,0,0,0),(0,0,1,0,0,0,0),(1,1,0,1,0,0,0),(1,0,1,0,1,0,0),(0,1,1,0,0,1,0),(1,1,1,1,1,1,1) \}$? It sounds plausible, but other than enumeration, I can't seem to find a way to prove/disprove that it exist...
Federal Information Processing Standard 186-4 appendix C.4 gives (without reference) an algorithm intended to test if a positive integer $C$ (which can be thousands bits) is a square: Set $n$, such that $2^n>C\ge2^{(n-1)}$. $m=\lceil n/2\rceil$. $i=0$. Select $X_0$, such that $2^m>X_0\ge2^{(m-1)}$. Repeat   5.1   $i=i...
I need to describe (even in words) an algorithm that gets a connected, undirected, weighted graph so that the weight of each edge is either 1,2 or 3; and returns MST of that graph is time complexity O(|V|+|E|). I thought to take kruskal algorithm and change the sorting algorithm to be counting sort (O(|E|) instead of c...
According to the theorem, if $L \in NP$, then $L$ can be determined by a deterministic Turing machine in exponential time. So, are all languages determined in exponential time NP languages?
When i iterate $v$ and $x$ factorizations to see if a word is still in a language $L$, do i have to assume that $|v| = |x|$ always or could happen theirs lengths are different?. I'm asking because i found a grammar for this language: $L$ = { $a^nb^m, |n-m|$ is even } , so it should be context-free. But if i try to app...
Suppose that you had two trees. Our goal is to convert the two trees into two integers such that two trees are the same if and only if the two integers are the same. Suppose that we have a function named leaf_hash() which converts the leaves of the trees into integers such that for any two leaves x1 and x2, we have x1 ...
Consider the notion of optimal implementation as follows. Suppose we have some algorithm $A$ whose execution for some problem of size $N$ requires $T(N)$ operations (e.g. arithmetic operations). A library optimally implements this algorithm when it executes a routine for implementing the algorithm for a problem of size...
My algorithm takes a Java program as an input, modifies it to eliminate static attributes, and returns a new modified Java program without such attributes. What would be the soundness and completeness of this algorithm? Let's assume, the input program has $S$ static attributes and $N$ non-static ones. Let's also assume...
Use the five-stage pipeline with forwarding unit. add $t1, $t2, $t3 sw $t1, 0($t4) In the above code, is the data hazard of t1 fixed by forwarding the correct t1 value from MEM stage to EXE stage? Also, are there totally four forwarding paths, which are MEMtoEXE, WBtoEXE, MEMtoID, WBtoMEM, in pipeline? It would be gra...
In Strassen's algorithm, we calculate the time complexity based on n being the number of rows of the square matrix. Why don't we take n to be the total number of entries in the matrices (so if we were multiplying two 2x2 matrices, we would have n = 8 for the four entries in each matrix)? Then, using the naïve method of...
In the substitution method, if we find that, for instance, T(n) < dnlg(n) but only for some d that depends on n, then can we say that T(n) = o(nlg(n)) (little-oh) in some cases? For example, in this case: we may find that the condition T(n) <= dnlg(n) is only satisfied if d <= n or, conversely, n>=d. That would mean th...
Is there a hashing function $f$ that for each input $x$ if $f(x) = y$, then $f(x \, || \, y) = y$? In other words, if we concatenate its output with the input, the result will not change. Furthermore, is there a simple construction for such functions? Example Let $x =$ "hello" and $f(x) =$ "123". Then $f($"hello123"$) ...
Is there a well-known algorithm for modular multiplication of floating-point numbers? I would like to multiply some large angle in single precision (6-7 significant digits) and wrap it back to 360 degrees, without losing too many significant digits. float r = fmodf(a * b, 360); My current approach is to split the numb...
Given a bipartite simple graph $G=(V,E)$, where $V=A\cup B$ and $A\cap B=\emptyset$, any edge in $E$ connects two vertices in $A$ and $B$, respectively. The maximum bipartite matching problem is to find the largest subset $E'\subseteq E$ such that no two edges in $E'$ share common vertices. We know that this can be add...
On the internet, I am unable to find concrete definitions of these three types of file-systems. Can someone clearly explain the difference between these?
I have sequence of integers $a_1, a_2, .., a_n$, let $S_a = \sum_{i=1}^{N}{a_i}$, for any $k \in (0; 1)$ I need an algorthim to that maps every $a_i$ into another integer $b_i$ with 2 requirements: $S_b = \sum_{i=1}^{N}{b_i}$ is as close as possible to $k \cdot S_a$, ideally $S_b = Round(k \cdot S_a)$ $b_i$ is as clos...
$P$ is the set of all words of even length on {0,1}. Hi, i tried using pumping lemma to see why $L$ isn't a context-free language, but there's a decomposition where none of all three properties is violated ($|v|$ and $|x|$ iterating factors on $c^n$.). I know this doesn't mean it's context-free, but to be sure it is no...
I was reading about the longest path problem and it is NP Complete. What about the problem where we need to find a path of some exact length $K$. All edges are directed. We are also allowed to repeat edges and vertices and all weights are positive. The reason is where ever I look they in the definition emphasize: Simp...
any reference on what kind of problem it is and what algorithm can solve this in $n^2\log n$? for 5 as d, the numbers 4 and 3 and 0 would work. so i think there should be zero in the array. maybe use naive approach($O(n^4)$) and memoize the raising to power 2 and adding up the results to decrease the running time?
Question Background A finite-state machine can be defined as a 5-tuple as follows (Sipser, pg. 35): The image below (taken from the Wikipedia article on combinational logic) seems to suggest that combinational logics can be used to define formal grammars that describe formal languages just the same as regular expressi...
I came across this question when studying for an exam: given a min-heap that has no prime numbers in it, is there an algorithm that can get and delete the minimum of that heap in O(log* n) ? The answer simply said no because in this case we can sort an array in o(n log n) which we’ve learned isn’t possible without addi...
I am a research scholar, and I currently work in parameterized algorithms. My current work involves proving that a problem is FPT for the parameter distance to clique. Although it is known that computing a distance to clique of size $k$ can be done in FPT time using a simple branching algorithm, I couldn't figure out h...
I'm reading Nielsen and Chuang. On page 142 the integer factoring decision problem is introduced: The integer factorization problem can be reduced to a decision problem: Given a composite integer m and l < m, does m have a non-trivial factor less than l? For a given witness x < l this problem can be checked in polynomi...
We have a weighted and undirected graph. I want to find the shortest path between two vertices with Dijkstra algorithm. But in the path, the weight of the edges should be increased and decreased one by one. For example, in the below graph, the answer is the third path: My idea: Remove the paths that do not meet the co...
I'm trying to solve this time complexity: $T(n) = 2T(n-2) + n$, but having some challenges addressing the $(-2)$ component. Any insights on this complexity? Ended up with a section $[2^2\cdot1 + 2^3\cdot2 + 2^4\cdot3 + \ldots + 2^{k+1}\cdot k$. Does it follow any existing number series?
so this is the question , I have to minimize this DFA this is How I did it but when I checked for answers , this is what it was, can someone please explain to me what mistake I made? I have been wondering about this for past 2 days
As the title states, we are given a bipartite undirected graph $G=(X\cup Y,E)$ such that every vertex $v\in V$ satisfies $d(v)=k$ for a constant $k$. The general goal of the proof is to show that under these terms, the graph has a perfect matching (a subset of edges where all edges are disjoint in vertices, and the edg...
Consider the Kadane's algorithm for finding maximum subarray within an array: def max_subarray(numbers): """Find the largest sum of any contiguous subarray.""" best_sum = 0 current_sum = 0 for x in numbers: current_sum = max(0, current_sum + x) best_sum = max(best_sum, current_sum) ...
I am a research scholar currently working in parameterized algorithms. I am studying the complexity of a problem (say $P$) for $\Delta_{10}$ graphs and was able to provide a reduction from a known NP-complete problem. Hence, i have that $P$ is NP-complete on $\Delta_{10}$ graphs. It is obvious that there is no FPT (fix...
Suppose I would like to generate n clauses, in 3-CNF form, that would give a unique solution for m variables (m<n). Example: for m=6, I've got {a,b,c,d,e,f} = 111010 How to generate these n 3-CNF clauses while minimizing this number of clauses (to avoid redundancies)? What would be the minimum number of clauses to gene...
I can’t understand How can dfa have more than one sink state? Isn’t it the same state? Maybe there is some examples
I have an array (of hundreds of numbers) and I need to sort them. In this case, I used Bubble Sort because of the better time complexity compared to other algorithms, $\Theta(n^2)$. procedure bubbleSort(arr)         for i=0 to n-i-1             for j=0 to n-i-2                 if arr[j] > arr[j+1]                     S...
My book(link) says that if the computer tries to access a virtual memory page that is on the hard-disc it loads that page into physical memory. But how does the computer keep track of which physical memory it should use? Does it look through the page table to find free physical memory?
I'm learning about (complexity-theoretic) pseudorandom number generators, and I have a pretty basic question about them that I couldn't find an answer to. Let's say we have a PRG for $P$ that can fool any algorithm running over $n$ bits in time $poly(n)$ with seed length $O(\log^{10}(n))$. This would already be a break...
Given a set S of numbers, min and max. Find all sebsets of numbers from S with a subset sum larger or equal to min and smaller or equal to max. The following article says that there's an algorithm called ESS that solves this but I haven't been able to find the algorithm anywhere: "Cached Iterative Weakening for Optimal...
Given n points on the plane, it is a standard interview problem to find the line with the maximum points, which can be done in O(n^2) with pivoting + hashmaps or other method. Question: Are there more efficient algorithms that runs in o(n^2) e.g. O(nlogn), solving: (1) Find the line containing maximum number of points,...
The upper bound of $n!$ is $O(n^n)$. But I am not getting a way to compute the lower bound of n!. We can write $n! = n\times(n-1)\times(n-2)\times\dots\times 1$. I can easily put all the terms as 1. The lower bound will be $\Omega(1)$. But I am not convinced with this answer.
I need to divide numbers represented as digits in byte arrays with non standard amount of bytes. It maybe 5 bytes or 1 GB or more. Division should be done with numbers represented as byte arrays, without any conversions to numbers.
I am trying to understand "On the complexity of general context-free language parsing and recognition" by Walter L. Ruzzo. One of the results from the paper is about generating a parse tree when only a (blackbox) recognizer is given. Unfortunately, I am stuck at the sentence "Given recognizers for these languages, we c...
Let's say we have the following context free grammar: $S \rightarrow a \\ S \rightarrow SS$ And we do the following two "derivations" for the same string: aaa: $S \rightarrow SS \rightarrow SSS \rightarrow aaa$ aaa: $S \rightarrow SS \rightarrow SSS \rightarrow aSS \rightarrow aaS \rightarrow aaa$ The difference betwe...
I am trying to learn how to prove the runtime of a recurrence relation, particularly through induction. I was looking at this lecture PDF, and on the first page, the author writes this: Recurrence: $T(1)=1$ and $T(n)=2 T(\lfloor n / 2\rfloor)+n$ for $n>1$. We guess that the solution is $T(n)=O(n \log n)$. So we must p...
There is a well-known Curry-Howard-Lambek correspondence between certain type systems, proof calculi and categories. Some variants of Barendregt's pure type systems have the property of strong normalization, i.e. any term can be reduced to a normal form after a finite number of reduction steps, the other of them don't ...
I am reading "Introduction to the Theory of Computation" 3rd edition ~ by Michael Sipser, page 113-114 - topic: "Context free languages, push down automata" He states that the transition from one state to another would look as follows: "$a,b\rightarrow c$". But the way he states the usage confuses me We write "$a,b \r...
I saw a post on Reddit (https://www.reddit.com/r/math/comments/ci50d3/visualizing_mathematical_subjects/) that utilizes label propagation, Fruchterman-Reingold algorithm, and edge betweenness clustering to classify mathematical subjects based on papers in 2018 on arxiv.org. In a math book, definitions and theorems are ...
In the simply typed lambda calculus we have type algebra - types can be added, multiplied and exponentiated, where addition corresponds to the sum type, multiplication to the product type, and functions to the exponential type (where A -> B corresponds to B^A). Due to the commutativity and associativity of the sum type...
Let's say, I have a set of cats $C = \{ a, b, c, ... \}$. Each cat has a tail. I can say, that the lengths of the tails of cats are denoted as $t_a$, $t_b$, etc. Otherwise, I can say that they are denoted as $t(a)$, $t(b)$, etc. Which option is preferable and when?
Is it so that for each virtual adress there exists an adress in the hard disk? But the hard disk can be larger than the virtual memory? EDIT: Or can some virtual adresses always map to physical, and some map to hard drive which then is loaded to physical adresses?
Consider a truncated hexagonal grid, with some hexagons lit up, such as the one shown below: Here the red hexagons are lit up while the dark gray hexagons are not lit up. The grid has buttons (small black circles) that flip the color of adjacent hexagons. There is a button at every node where three hexagons meet, and ...
I am currently in the process of trying to understand the original proof of NP-completeness of SAT given in the seminal paper by Cook [COOK71] and have struggled with a few of the details of the proof of Theorem 1 presented in the paper. Specifically, Cook writes: If a set S of strings is accepted by some nondetermini...
Problem : Consider a random vector $v$ which is uniformly distributed over the sample space $S = \{v \in \mathbb{Z}^{n} : 1^Tv = a , v \ge 0\}$ . How to efficiently generate such random vector ? note : I'm actually interested in $n=6,a=30$ . Attempt : The size of the sample space [1] is the coefficient $c$ of $x^a$ in ...
We define the set S as $\{(s_1, f_1), (s_2, f_2), ..., (s_i, f_i)\}$, where each $f_i$ is the frequency that $s_i$ is repeated in the multiset T. How many ways can we partition the multiset T into different partitions, where each partition includes distinct part/segments? A distinct part/segment includes distinct $s_i$...
I don't know which algorithm is more efficient for sorting, but I want to use Bubble sort and how to implement this algorithm.
I'm looking for an algorithm to solve a modified version of the assignment problem. It differs from the standard assignment problem in that the modified version has groups of tasks instead of just tasks. Similarly to the standard problem, each of the n workers is assigned one task, and there are n groups of tasks; but ...
We have an array of integers of length N(even). A and B play a game where A selects a number followed by B without replacement until the array becomes empty(Both A and B select N/2 elements each). The goal is for A to have a sum (of the N/2 elements A chooses) which is (i) even, (ii) odd. In both cases, B plays against...
I am trying to analyze the algorithm Product: multiply two n-bits binary numbers x and y. function Product(x, y); 1. prod = 0; 2. while y not eq 0 3. y = y -1; 4. prod = prod + x; return prod; Assume: n = |x| = |y| Give the worst case time T(n) function for algorithm Product. Express T(n) in terms of...
A simple question, but I can't find an answer in quite the form I'm looking for: Assume $\mathsf{P} \neq \mathsf{NP}$, and thus $\mathsf{P} \subsetneq \mathsf{NP}$. If we have $L \in \mathsf{NP}$ and $L \notin \mathsf{P}$, does that imply that there is no algorithm for $L$ which runs in $O(n^k)$ steps for all inputs of...
I've been struggling with this analysis of algorithms notion for a few hours now in an introductory course. Let us define a function $N(n)$ for positive integer $n$ as the number of times performing $n=log_7(n)$ yields $\leq 1$. So $N(1)=0, N(7)=1, N(7^7)=2$, et cetera. I'm asked to find a good algorithm for computing ...
It's often said that State Machine Replication and Byzantine broadcast are equivalent (e.g., the abstract of [1]), but it seems only obvious how to reduce SMR to BB. I.e., give BB one can construct an SMR by rotating the leader. What does it even mean to reduce BB to SMR then? In SMR, there are clients and servers, but...
Let's say that we have a regular language $L_1$ that is described by a right regular grammar. Now, assume we have a left regular grammar, can we describe the same language $L_1$ or would the left regular grammar produce the reverse of all strings present in $L_1$? My understanding is that the left regular language woul...
In Meijer, Fokkinga and Patersons "Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire" the ∇ operator for sum types is introduced which removes the tags from its argument: ∇ _|_ = _|_ ∇ (i, x) = x What is the type of this operator? Something like A|B -> A U B ? As the article is recommended on the ...
I'm reading some old notes from a course on Turing Machines and I've bumped into the following question: Is the following language decidable? The language formed by the set of all Turing Machines whose languages can be accepted by a Turing Machine with at most 37 states My assumption is that the question boils to whe...
I have just started learning about CSP and NLP, for which I have to write a review paper of some research articles. The problem is that when a searched for research articles on some trusted digital libraries with the keywords CSP and NLP, there weren't many results that were related to both. Do you have any idea on whe...
The problem is whether a graph (which we represent as a flow network) has a single min-cut, or there could be multiple min cuts with the same maximum flow value, I've yet to encounter a well explained algorithm for solving this problem, let alone a complexity anaylsis or proof. I was not able to find the exact resource...
Say there was a decision problem which was solved optimally in polynomial time on a non-deterministic Turing machine, and verifiable in polynomial time on a deterministic TM, but would not halt when being solved optimally on a DTM. Would that problem be in NP, or is solution decidability on both NDTMs and DTMs a requir...
Pumping Lemma for Regular Languages Pumping Lemma for Regular Languages: If $A$ is a regular language, then there is a number $p$ ( the pumping length ) where if $s$ is any string in $A$ of length atleast $p$, then $s$ may be divided into three pieces, $s=xy$, satisfying the following conditions: $for \ each \ i>=xy^i...
This is a question in my text book that I cannot understand the solution provided for that: In each case below, give a simple descreption of the smallest set of languages that contains all the "basic" languages $\varnothing$,$\{\Lambda\}$, and $\{\sigma\}$ (for every $\sigma \in \Sigma$) and is closed under the specefi...
In the book Artificial Intelligence a Modern Approach 4th edition, the author claims that the A* algorithm is cost-optimal if the heuristic function is admissible (never overestimates the remaining true cost). Additionally, if the heuristic is consistent (obeying the triangle inequality by using a neighboring node), th...
Let's say that we have a context free grammar G, which is not in chomsky normal form, and we need to convert it to chomsky normal form. The steps involved in the conversion are as follows: Add a new start variable and point it to the old start variable Remove all of the empty rules, except for the empty rule where the...
I have x and y values to plot the curve and I need to find a tangent line of slope 1 that intersects the curve and the point at which it intersects. I was trying to do polynomial and exponential regression to model the data (>6000 data points) and fit the curve in R but cannot get it to work. It fits a majority of the ...
So in my "Advanced algorithms" course, we were taught about the "self-organizing list" data structure. The professor showed the following three heuristic algorithms: Frequency Count, Move to Front and Transpose. Looking online, I could not find any other "popular", "common" or "used" heuristic algorithms. Are there any...
Let $n$ be the number of variables in the input formula and $m$ the number of clauses. Define $s_k = \inf\{\delta : k\text{-SAT can be solved in } 2^{\delta n} \text{ time}\}$. The strong exponential time hypothesis says that $\lim \limits_{k \to \infty} s_k=1$. I have two questions here: What if the input size is ver...
Let's say we've got $n$ numbers to multiply together. But the multiplication operation, like in computer floating-point arithmetics, is not associative. Thus the order of multiplication matters. Furthermore let's say that we want to minimize the nesting of the expression tree that represents the entire multiplication, ...
Usually, in bin-packing, we have objects of sizes $a_1,...a_n$, and each bin has size 1, We need to minimize the number of bins, and for this, there are best fit/first-fit approximation algorithms. What will happen if there are more parameters than just size, say 3 parameters? Each object $i$ has say parameters $(a_i,b...
Given a fixed number of infinite-capacity containers and a list of items of varying weights, how can I best place the items into the containers preserving their original order in a way that minimises the difference between the heaviest and lightest containers? For example, given 3 containers and 10 items with weights [...
For example, 5 can be written in 2 ways: 4 + 1 3 + 2 8 can be written in 5 ways: 7+1 6+2 5+3 5+2+1 4+3+1 How could this be determined for any positive integer N?
I have a file with trillions of numbers and I want to get all numbers that have a frequency <=100. These numbers are in text format (UInt8s) so I first have to parse them. As this is slower than reading the bytes to a buffer I have one thread reading the data and 80 threads processing the bytes. I could give each threa...
What is the algorithm's computational complexity for a variant of the Travelling Salesman Problem, where every node must be visited at least once, meaning that a node can be visited more than once? (The cycle starts from a specific node and, after passing all nodes (at least once) returns to the start node). The graph ...
Suppose $K=a_1<a_2<\dots<a_n$ be a set $n$ distinct keys that inserted into an AVL tree $T$. The probability of any permutation of the order of insertion of the sequence $K$ is equal. Also we first insert $a_{40}$ into $T$, how I can find the probability, $a_4$ be ancestor of $a_9$ or $a_9$ be ancestor of $a_4$? Anyon...
Is $Union = NP\cup co-NP$ closed under polynomial-time many-one reductions? I understand that in order to be so, for $A\in Union, A \leq_P B $ there should exist a polynomial time computable function $f$ such that: $x\in A \implies f(x) \in B$. So the function computed for an input from $Union$ is also in $Union$. It l...
I came across this pair of blog posts explaining the problem with calculating variance on floating point data: https://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/#example-3-a-variance-calculation-gone-wrong https://jonisalonen.com/2013/deriving-welfords-method-for-computing-variance/ They show that a t...