instruction
stringlengths
35
29.1k
From Cook & Levin's theorem we know that all Problems in NP are polynomially reducible to SAT: $ \forall_{L\in NP}: L \leq_{p}SAT$. Is the opposite also true? That is if we know that a language L is reducible to SAT in polynomial time, can it be also stated that it must be in NP? $L \leq_{p}SAT \Rightarrow L \in NP$ I ...
Similar to the classic 2D strip packing problem, we want to put N blocks into a 2d strip and minimize the height of the strip. Each block has to be put at the fixed x-coordinate. The width and height of all blocks are integer. Below is an example of 4 blocks: you can only move every block up and down to reduce the ove...
Following this blog post about the Arc Consistency algorithms. Namely, the explanation on AC4. Consider the following example: If I understand AC problems correctly. Then: We have two known variables {X,Y}. domain(X) = {1,2,3} and domain(Y) = {2,3,4,5} The constraint table can be defined as (X,Y)=[(1,2),(1,3),(1,5),(...
I am currently reading 'Designing Data Intensive Applications' by Kleppman. In the SSTables and LSM Trees section, it is mentioned that one of the advantage of SSTables is: "Since read requests need to scan over several key-value pairs in the requested range anyway, it is possible to group those records into a block an...
Given an Oracle Turing machine ($OTM$) that solves Problem π in max. 2n space, so $O(n)$ space and $O(n^2)$ time. Is there a DTM that can solve $π$ in $O(n)$ space if time doesn't matter? (The length of an instance $I$ of $π$ is n) I would say the answer is yes. Construction: We already have a DTM M', which can verify ...
Suppose we have a finite set of programs, say, something like every Turing machine with 2 states and 7 symbols. After running all of them for a very long time, we've narrowed it down to a small subset thereof. Of those remaining, let's suppose that at least one will run forever and at least one will eventually halt, an...
In other words: If $A \leq_{p} B$ and $A \in NP \Rightarrow B \in NP$ From my deduction this is has to be false. We know that if $A$ is NP Complete $\Rightarrow A$ NP-Hard and $A \in NP$, then $B$ is NP-Hard but we can't say for sure that $B \in NP$. I struggle to understand why though.
I believe I learned (and later forgot) a term for two (or more) objects/dictionaries, with the same property schema. Googling has not helped. For example, these objects are TERMs because they have all the same properties.
Is the time complexity of for(int i=0;i<n;i++){i*=k;} $O(\log_k n)$? The problem is number 8 from GeeksForGeeks: https://www.geeksforgeeks.org/practice-questions-time-complexity-analysis/ I trace the program by hand and got stuck. I could not prove that the answer is $O(\log_k n)$. I made a mistake somewhere. Assume $...
From Natual Proofs Specifically, natural proofs prove lower bounds on the circuit complexity of boolean functions. A natural proof shows, either directly or indirectly, that a boolean function has a certain natural combinatorial property. I haven't read the mentioned paper. Can somebody explain what is meant by "natu...
I am asking this in the context of the following question: Let N be a non-deterministic Turing Machine. We say that N faces a dilemma if at some point in its working, it encounters a situation where the finite control is in the state p, the head scans the tape a, and $\delta (p, a)$ offers multiple (two or more) possi...
Consider our alphabet set is $\Sigma$. Suppose $L\subseteq\Sigma^*$. I want to show $L \cap L\Sigma^+=\emptyset$ as one of the bellow options: $x,xy\in L\implies y=\lambda$ $x,xy^2\in L\implies y=\lambda$ I think the first is true but I have no idea to show that the second is false.
i'm trying to write an algorithm to reconstruct the original array from the sorted one. considering input value is a string of 1s and 2s which 1 means in merging part of merge sort, element from left subarray is chosen and 2 means element from right subarray is chosen. how can i do it? specially i have problem on that ...
This is a self-study inspired by the trivial https://leetcode.com/problems/buy-two-chocolates/. Basically the question is as follows: if you have a value of money m and a list of prices, imagine you are a hungry child who wants to spend all of their money on two chocolates. Return the two prices that leave the least am...
The algorithm developed by Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy is widely used in industry for building dominator tree, but I cannot follow the proof in the “Engineering the data structure” section. Specifically, the claim of with this order, if $\operatorname{Dom}(a) ∩ \operatorname{Dom}(b) \neq ∅$, th...
Linear Search has O(n) T.C and Binary Search have O(logn) T.C. But how come Linear Search generates fewer page faults? Is there another searching technique that causes a lesser number of page faults than linear search?
Suppose $L$ is a regular language. Let $R\subseteq L$ be a language with maximal size such that for each $x,y\in R$ neither $x$ be a substring of $y$ after removing a substring from $y$ nor $y$ become a substring of $x$ after removing a substring from $x$. Could we conclude that $R$ is finite? My thoughts are as follo...
The original paper of Bully algorithm [1] does not make any assumption of a synchronous processing. But I see few lectures explicitly call it suitable for synchronous processing. I am not sure why do we need to make an assumption of lock-step global iteration (aka synchronous processing)! First, I see that each ELECTIO...
To begin with, if I understand correctly, in a simply typed lambda calculus, typing, type checking and type inference are always decidable. In the "full-fledged" polymorphic (terms depend on types) lambda calculus, type inference is undecidable. The same is true for types depending on terms. Now I have 3 questions: Wh...
While the shortest path can be calculated with $O(V+E)$ time over a weighted directed acyclic graph using topological sort, I wonder about the running time of the following BFS type algorithm I thought of. BFS_requeue(v): Initialization() push(s) //push the source node while the queue contains at least one vertex: ...
I've been exploring the Least Recently Used (LRU) page replacement strategy, and I've come across a point of confusion that I would appreciate some clarification on. As I understand it, in LRU, the page with the lowest (oldest) last access time is considered the least recently used and is a candidate for replacement. H...
Consider the following problem: For $k \le n$, what is the smallest number of edges in the graph with $n$ vertices so that the maximum independent set has size at most $k$? I.e., given an empty graph on $n$ vertices, I want to add the smallest number of edges so that the maximum independent set has size $k$. Let's de...
I'm reading Hopcroft's book about computation theory and wondering about how fast can u find all nullable symbols in CFG.
Given an $n \times n$ grid of integers, I would like to compute the circular area which gives the maximum sum of integers within the area. For example: In this picture, the integers 1, 0, 1, 2, 3, 1, 2, 1, -3, -2, 2, -3, 1, 3, -2, 0, 2, -1 etc are all within the circular area. If we restrict the circular area to be ce...
While reading CLRS (4th ed.) regarding the analysis of the expected time for QuickSort, I encountered an alternative approach. The analysis involves the following steps: Given an array of size $n$, the probability of choosing any particular element as a pivot is $1/n$. To formalize this, an indicator random variable $...
How would you build a fully connected neural network that learns eigenvalue decomposition efficiently? I wanted to build NNs that can predict certain properties about matrices which are NP-hard to compute but might require eigenvalue decomposition. However, I am not sure if hardcode-calculating eigenvalues at any speci...
Suppose we are given a $n\times n$ matrix that is sorted row-wise and column-wise. We want to find the median in $\mathcal{O}(n\log{n})$. This is my approach: We know median is such element that is greater than exactly $\lfloor\frac{n^2-1}{2}\rfloor$ elements. In such matrix, we always know that minimum value is the fi...
I've read the stable matching chapter in Kleinberg and Tardos's Algorithm Design and was wondering how one can show whether a stable matching under a given set of constraints exists. K&T introduce a modified algorithm that generalizes Gale-Shapely with forbidden pairs. They write We will show that there is always a st...
Suppose we are given a $n$-vector $A$ of real numbers. We need to find the longest sequence of symmetrical numbers. The numbers $a_i$ and $a_j$ are symmetrical if they are located at the same distance from element $a_k$ and $|a_i-a_j|< \epsilon$, $\forall i < j$. Question Can it be done in less than $O(n^2)$ comparison...
Considering Deutsch–Jozsa algorithm problem statement, of not being able to recognize "constant functions" from "balanced functions" on single call conventionally is clear to me... Now quantum part, slightly modifies the "problem" function, from being a function (due to how quantum circuits work on gate based quantum c...
So I was doing this problem, but it led me to a different solution. The actual solution is this: Problem - Farmer John has N hills on his farm (1 <= N <= 1,000), each with an integer elevation in the range 0 .. 100. In the winter, since there is abundant snow on these hills, FJ routinely operates a ski training camp. U...
I am reading some notes on parameterized complexity located here. Under the topic of "Kernalization" (section 3, page 4) they state: When faced with the task of solving an NP-Hard problem, almost every practical computer implementation performs preprocessing steps or data reduction steps. The goal of such a subroutine...
I'm struggling to grasp the intuition behind the concept of an index set. By definition, a set $I$ is called an index set if $\forall i,j: i \in I$, $\phi_i = \phi_j \implies j \in I$. This implies that if we have a program with indices $i \in I$ and a different program $j$, both computing the same function, then $j$ i...
I don't know if the title of the question is accurated or not, but I was thinking of the following problem: I have a set of numbers, let's call them identifiers. Each identifier is stored on a 64-bit long integer; but in practice I only have, let's say, never more than 4 million different identifiers at any time. I wa...
An in-order traversal of a binary search tree (BST) produces a sorted sequence. I wonder, if we perform an in-order traversal of a binary tree and obtain a sorted sequence, does that imply that the tree was a BST? (Is it a necessary and sufficient condition?) I was looking for an algorithm to check if a given binary tr...
Consider the following problem in 2-party communication complexity, where Alice sends a single message to Bob who must compute the output. Alice gets as input a bit vector $X=(x_1,...,x_N)$, for some integer N. Bob gets as input an index $i \in [N]$ and gets $x_1,\dots,x_{i-1},x_{i+1},\dots,x_N$. Goal: Bob must outpu...
I currently study well known dependency testing for automatic loop parallization from parallel compilers (ZIV, SIV, MIV, Single Variable Constraint, Multiple Variable Constraint, Acyclic Test, Fourier - Motzkin variable elimination, Delta test, Lambda test, Range test, Omega test, power test and Constraint Matrix Test)...
Assuming that the input $n$ is given as a decimal number. I was asked to prove whether the function $f: \mathbb{N} \rightarrow \mathbb{N}$ where $f(n) = 2^n$ is computable in polynomial time using TM or not. My guess is that the function cannot be computed in polynomial time but I can't figure out how I can prove it. S...
I'm just getting started with lambda calculus and I see that the fixed-point $Y$ combinator is defined as: $Y = \lambda f . (\lambda x . f(x x))(\lambda x . f(x x))$ (*) I read here that something like $t s$ (where $t, s$ are both terms) represents an application of a function $t$ to the input $s$, so in (*) I suppose ...
The following picture is a block diagram of an arithmetic unit dedicated to IEEE 754 floating-point addition from Computer Organization and Design RISC-V Edition: The Hardware Software Interface 2nd Edition book. My questions are: Why are in the sketch, the sign of the numbers ignored, while the final result has a sig...
This is my dynamic programming solution in Python to the problem of finding the cost of the optimal binary search tree: def optBST(freqs): """C(i,j) = min(C(i,k) + C(k+1, j)) + sum(freqs[i:j])""" # i references the rows in the 2D array, representing the starting element. # j references the columns in the 2D...
I find the Russian Elbrus CPU fascinating. It seems that it is fairly decent at performing calculations, and security. This is likely as it is heavily specific for military and financial industries, within Russia. Less focus was put on end user desktop computers. However, I am confused about the decision to use the VLI...
I work with big integers that I need to convert to and from strings, and to and from different bases. In JavaScript, BigInt allows to convert an integer to a string in a chosen base by doing: 12345n.toString(9) Unfortunately, when parsing a string to convert it to an integer, BigInt only accepts bases 2, 8, 10, and 16...
The Ackermann function is the textbook example of a function which is total recursive but not primitive recursive. If we want to implement it in some programming language we will need to use a priori unbounded loops (generally using while or goto). I am looking for an algorithm used in real situations (e.g. in computat...
I was thinking about an efficient binary search for unsorted arrays with $n$ entirely unique elements, and came up with something that probably already exists. Here's how it works: At each level of recursion (starting with $k=1$), you have $2^{k-1}$ pairs of searchers, taking up some $O(1)$ memory each. In each pair, t...
Section 1.9 Binary Strings of the textbook Introduction to Lattices and Order, second edition, by Davey and Priestley, says the following: Let $\Sigma^\ast$ be the set of all finite binary strings, that is, all finite sequences of zeros and ones; the empty string is included. Adding the infinite sequences, we get the ...
$L_1$ and $L_2$ are two languages that have a finite deterministic automaton. $Σ = \{0,1\}$ for the two languages. Let $L=\{x∈L_1\mid \text{there exists } y∈L_2,\text{such that } \#_0(x)=\#_0(y)\}$, here $\#_0(x)$ means the number of times $0$ appears in $x$. This means we keep every word in $L_1$ if there is a word in...
Consider the figure in Exercise 2. If the current machine code that executes is 0x214bfffd and the values of the registers in the processor are as shown below, what is then the value of the input WD3 ? Answer as a 32-bit hexadecimal value. at = 0x00011021 v0 = 0x5234f1a0 v1 = 0x1114f111 a0 = 0xff001231 a1 = 0xffffffff ...
Could someone help me understand why in the below proof, if $k > log_{2}n$, then $P(N_i=1)< \frac{1}{n}$?
Let's say a Language L is NON-semi decidable and undecidable. Let's also take the Halting problem H, which is a semi decidable and undecidable language. Is it possible to reduce L to H in a many-one reduction? I know that both are undecidable languages, and we can reduce an undecidable language to another undecidable ...
I've been working on the following challenge on LeetCode: Problem: Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. During my exploration, I stumbled upon an interesting solution: def repeatedSubstringPattern(s: str) -> bool: ret...
Compared to "vectors addition" which can naturally work independently for the summation of each of its corresponding elements, it allows parallel work by processors. Example: [1 2 3] + [4 5 6] = [5 7 9] Which only requires 1 iteration. How to make the "cumulative sum" operation algorithm work in parallel on a vector? ...
I read the wikipedia article: https://en.m.wikipedia.org/wiki/Peterson%27s_algorithm What I don't understand is how the algorithm is guaranteed to work when the processor or processors are switching between threads. What stops simultaneous advancement?
The following is from lecture notes for Concepts in Mathematics from CMU (William Gunther): I am confused about the bolded sentence in the last line quoted here: Theorem 4 (Ramsey's Theorem). For any k, l, there is some N such that for any edge two coloring of $K_N$ with colors 0 and 1 there is either a monochromatic k...
Suppose we are given an arbitrary rooted tree. We want to find two nodes that have the maximum distance among all pairs of nodes. I am looking for an algorithm with time complexity $\mathcal{O}(n)$, where $n$ is the number of nodes in the tree. Note that there may be more than one pair of nodes that satisfy this condit...
How does this data structure work and what is its application? class X: def __init__(self): self.x = 0 def plus_one(self): self.x = self.x + flip(self.x) def get(self): return 2**self.x #2 raised to the power of x The flip() function is a random function that returns $1$ with prob...
The square-root sum problem is: given positive integers $a_1,\ldots,a_k$ and $b_1,\ldots,b_k$, decide if $\sum_i \sqrt{a_i} > \sum_i \sqrt{b_i}$. The exact run-time complexity of this problem is an open problem, as far as I know. Can this problem be solved approximately using convex programming? I thought of the follow...
Is lock conversion (upgradation) from $Shared$ to $Exclusive$ allowed in Basic Conservative Strict Rigorous types of 2PL techniques. Following is an example of disallowed attempt of lock conversion for a non serial order of transactions $T1$ and $T2$:
I spent the last couple of days trying to understand the different asymptotic notations but it seems I'm hitting some conflicting information. For context, I believe I've understood the formal definition of different notations, as they are fairly similar to the definition of limit I've learned before. It also seems to ...
I don't know complexity class theory well so I might make some categorical errors, but I will try to ask this question anyways. Suppose you have written a function in some programming language which solves an NP-complete problem. There must exist an algorithm which can verify the correctness of an (input, output) pair ...
In the text of my book it says that this language is context-free so I tried to prove that the conditions of the Pumping Lemma are fulfilled. If, for example, I take the word $aaabbbc$ I can divide it like this: $u = ε, v = a, x = a, y = ab, z = bbc$ So the conditions: $|vy| > 0$ $|vxy| <= p$ (if I consider p = 3) are ...
I've tried quite a large amount of examples, starting from 1 bit all the way up to 5 bits yet I couldn't put my finger on any recurring pattern of words that are accepted. the DFA is as such: The only language I could come up with that sort of covers this, is: $L=\{w: \#_1(w)\geq 1 \; \& \; ends\;with\;even\;no.\;of\;...
Finite automaton is a well-known topic which finds applications in software engineering (e.g. pattern matching or regular expressions in general). ω-automaton are another kind of automaton, defined similarly to finite automaton except that they are designed to be run on infinite words (which can be thought of as stream...
Id say this is the first case of Master Theorem, but when I try to prove that the limit of f(n)/ n ^ (1-E) is 0, I cannot do it. Does anyone have a solution?
I was looking at the proof of if $NP \subseteq BPP$ then $NP = RP$ here. At the end of the proof the author states: "Note that if $M$ always gives correct answers on calls to $M$, then when $\phi$ is satisfiable, $N$ (the newly constructed TM) constructs a satisfying assignment to $\phi$ and hence accepts. The probabil...
Using the CGAL library, I am working on a 2D layout graph which contains an array of 2D polygons with holes. The aim is to generate random points (based on some conditions) and only keep the points inside the area of 2D polygons but not in their holes. The function I use for this is CGAL::bounded_side_2. Please see the...
as the title says, I am wondering why this exercise doesn't show a data forwarding from the "ex" stage of 2nd instruction to "ex" stage of 3rd instruction. P.S. the architecture is MIPS (with simplified 5 stage cycle). Thank you in advance
I am studying the approximation algorithm. I have a question as follows. For an approximation algorithm for maximization problem, if I have $sol \ge \alpha opt - c$, where $c$ is a positive constant and $0 < \alpha < 1$, can i say that this algorithm is $\alpha$-apx? Why?
I am trying to solve the following problem. I've tried to find the name of this problem, but could not really find what I was looking for. I assume there should be some graph-theory that covers it, but it's been a while since my last algorithms class. I do not need the global best solution, a "pretty good" solution sho...
I have a colored image 1024x1024 whose rows and columns were randomly shifted, how would I unscramble it without having any information about the original image?
The following is a real world problem, for which I adjusted the explanation, such that it is easier to understand. In a very abstract form, the challenge is to find a group-sorting algorithm, that is only allowed to use queues. Instance of the problem Let’s assume we have people arriving in cars at the entrance of some...
Let $G$ be the CF grammar that has the production rules: $S \to aS | aSbS | c$. Show that $G$ is ambiguous. I thought of proving it by representing the string $aacbc$ but I don't know if it is correct as a solution: $aS \to aaSbS \to aacbS \to aacbc$ $aSbS \to aaSbS \to aacbS \to aacbc$
Most optimization textbooks do not cover the concept of NP-hardness. Some examples include: "Convex optimization" by Boyd and Vandenberghe "Numerical Optimization" by Nocedal and Wright "An Introduction to Optimization" by Chong and Zak and half a dozen more well-known optimization textbooks. Yet, in discussion on...
Given $n$ points in a 2d metric space, the $k$-center problem asks us to find a subset of size $k$ of the points which we will call centers. The task is to pick these centers to minimize the maximum distance from any point to its closest center. A classic greedy algorithm repeatedly picks points which are furthest fr...
Question Prove that the number of comparisons between elements in binary heap build is at most $2n-2$. $n$ is the total number of the nodes. Pseudocode BUILD-MAX-HEAP (A) 1 heap-size [A] < - length[A] 2 for i <- Length[A]/2| downto 1 3 do MAX-HEAPIFY (A, i) MAX-HEAPIFY (A, i) 1 l <- LEFT (i) 2 r <- RIGHT (i) 3 if l <...
I am attending a course about algorithm design, and I have found an old test which has once been submitted. However, I don't have the solutions to it, and I am having some trouble with one specific excersise. This is the text: Matt is planning a road trip from City A to City B, and he wants to minimize the number of br...
In parallel programming the iteration scheduling is defined as the determination of the logical execution time for each loop iteration, while in operating systems, the processor scheduling (FCFS etc) is defined as the ordering in which the processes get the CPU to execute. Since the execution of a loop is a process its...
To sort 64 elements Time required is $n*log_2{n}$ units The equivalent posteriori time is 30 sec. In 6 minutes I get 768 elements sorted. But the answer is not 768 and is instead 512, I wonder why?
Consider a circular graph $G_1$ with $n$ vertices and a complete graph $G_2$ with $m$ vertices. What is the maximum attainable ratio when determining the Minimum Spanning Tree (MST) using Boruvka, Kruskal, or Prim algorithms? I think about it in the following way: A complete graph with $v$ vertices has $\dfrac{(v-1)*v}...
Rice's theorem asserts that as soon as $f$ is non-trivial (i.e., non-constant), and extensional (i.e., $f(M) = f(M')$ as soon as $M$ and $M'$ are codes of Turing machines with the same behavior, in the sense that both halt and return the same output or both don't halt), $f$ is uncomputable. One classic way to prove thi...
Consider the following problem stated formally: You are given $n$ objects $o_1$, $o_2$, ..., $o_n$ and $k$ classes $c_1$, $c_2$, ..., $c_k$, each class containing some objects; an object is chosen. Construct queries asking about the class of the object, such that it can find the chosen object respective to the respons...
In the pumping lemma conditions for context-free grammar we have that the string can be divided into $uv^{i}xy^{i}z$, but in the case of $i = 0$, why does it still belong to the language?, is it possible to have an example with a string? Should it be $i = 1$ is one repetition and for $i = 0$? In the case $i = 0$ the wo...
Consider the simply read-write lock algorithm that allows many readers and a single writer. Why is this algorithm flawed? I was thinking about the implementation of a well-known read-write lock library and wondering why it didn't do this simpler approach. To read: atomically add 1. if the old value was less than N, pr...
Let $\cal M$ be a deterministic stack automaton ${\cal M } = (Q, \Sigma, \Gamma, \delta, q_0, F, Z_0 )$. Let $\gamma \in \Gamma^* $ a word on the stack alphabet. Is it true that the language $$L = \{ w \in \Sigma^* \mid (q_0,w,Z_0) \vdash^* (q,\epsilon, \gamma),\ q \in F \}$$ is a deterministic context free language?...
I've a set $N$ of $n$ distinct numbers of $d$-bits each; call them words ($1\leq n\leq 2^d$, with $d\geq 1$). I want to store $N$ using as least space as possible, by partitioning $N$ and factoring out the common bits within each group. The problem is finding the optimal partition, taking into account group payloads. F...
So I have a bunch of strings that represent routes in a HTTP web framework. Each string has a leading /, some /-separated path segments which can either be a string, a single-segment wildcard ?, or a trailing multi-segment wildcard *. (For this problem, we can assume that * can only be in a trailing position, but there...
A couple of years ago, I read a story about a professor of computer science, who showed his first semester students a few lines of code with a simple questions. I think it was something along the lines of this: a = 5 b = a a = b + 5 c = a + b What is c? And this professor argued, that this simple test is in some sen...
Let $L_1 = \{ a^{n}b^{m} \mid n > m > 0 \} $. Describe a non-regular language $L_2$ such that $L_3 = L_1 \cup L_2$ is regular and $L_3 ≠ A^{*}$ (where $A = \{ a, b \} $) From the trace, I cannot prove this with the simple language of $L= \{ a^{n}b^{m} \mid n,m > 0 \} $ since it must be different from $A^{*}$. I had tho...
In traditional processors one move operation can at most move one word between memory locations and optionally increment or decrement the registers which point to those memory locations. In x86 architecture it is realized with movs operation, in PDP-11 as mov with auto-increment or auto-decrement addressing. But I wond...
Is it known whether the language $L_π = \{w\in\{0,1\}^* : w\text{ appears in the binary expansion of }π\}$ is decidable? $L_π$ is easily recognizable (a.k.a. computably enumerable). A trivially decidable very classical variant of the language is $\{n:0^n\text{ appears in the binary expansion of }π\}$. There is a conje...
I'm looking at using something like Crockford Base-32 encoding in a situation where people have to manually write IDs in a very compact space. Crockford Base-32 describes a simple checksum algorithm using modulo 37 that will catch a single substitution or transposition, which helps a lot when dealing with poor handwrit...
There are simple algorithms to construct sorting networks from 2-sorters, e.g. Batcher's bitonic sorters and Pairwise sorting networks. How can one construct general sorters with a low number of $k$-sorters, $k\gt 2$? Is there a similar result for select / partial sorting, say, the $\sqrt n$th element or the top $\sqrt...
I teach a fairly advanced algorithms class to high schoolers and I accidentally presented them with a bunk reduction from Hamiltonian path to the Tripartite graph decision problem. My attempt involved creating three vertices in the transformed input $G'$ for every one vertex in the original undirected graph $G$ and con...
I read the Amazon Aurora paper and in the performance result section (i.e. 6.1.1), it says The results are shown in Figure 7 and Figure 6, and measure the performance in terms of write and read statements per second respectively. Aurora’s performance doubles for each higher instance size and for the r3.8xlarge achieve...
I'm exploring the decidability characteristics of a particular language formed by the intersection of two languages, specifically in the context of the Halting Problem. The languages are defined as follows: $\text{Special Halting Problem Language} K: K := \{ w \in \{0, 1\}^* \mid w\#w \in H \}$, where $H$ is the...
I'm trying to solve a problem from one of the older exams. Question: There's an infinite, one-dimensional board, with fields numbered consecutively $\ldots, -2, -1, 0, 1, 2, \ldots$ A move in the game consists of selecting a field and placing a token on it. If after placing the token it turns out that on two adjacent ...
Given a multiset $S$ of positive integers and a fixed positive integer $k$, can $S$ be partitioned into $k$ parts with equal sum? For $k = 2$, this is the well-known Partition problem. For general $k$, this is described on Wikipedia as the "multiway number partitioning" problem, and it's claimed there that this problem...
How many symmetric boolean functions exist that are linear? Let $f$ be a $n$-variable boolean function. $f$ is said to be symmetric if it is unchanged by any permutation of its variables, i.e. for 2-variable boolean functions $f$ is symmetric if $f(a,b) = f(b,a)$. In addition $f$ is called a linear function if it does...
I initially brought this up on the Swift Forums, and it was suggested that this might be a thing better suited for CS SE. So here goes: I had this thought that the compiler already has enough information to be able to infer an appropriate data structure to use given the rest of the usage patterns that follow. This soun...
Show how to check if n-bit number is divisible by 7 in logarithmic circuit depth. How can I construct the circuit to be able to check the divisibility?