instruction
stringlengths
35
29.1k
I am trying to show the existence of a polynomial size, bounded depth monotone circuit on the inputs $(x_1,\ldots, x_n)$ that gives $1$ if $\sum x_i \geq n/2 + n/\log n$ and $0$ if $\sum x_i \leq n/2 - n/\log n$. This is a modified form of the MAJORITY problem. I want to use the probabilistic method but I cant seem to ...
The minmax algorithm is a popular strategy used to design chess engines. Usually, since the state-space of chess is huge, we choose a fixed depth and evaluate the game tree down to that level, and pick the best sequence of moves so far. Let's suppose we remove this limit, and we search for the whole tree. Would this te...
Consider this example, I did my pseudocode in python findCycle(G): for each edge e in E(G): if isThereCycle(G-e): G = G - e return G assume isthereCycle returns whether the graph $G$ has a cycle. Input is a graph $G$ that contains a cycle, and the function should return a path of that cyc...
Given a directed graph $G = (V, E)$ and a starting vertex $v_1$. The graphs edges is this $\{(v_1, v_2), (v_2, v_3), (v_3, v_4)\}$ basically below $(v_1) \to (v_2) \to (v_3) \to (v_4)$ Can we traverse this graph and record the path starting at $v_1$ in $O(|V|)$ time? For example Making a list like $[(v_1, v_2), (v_2, ...
Suppose we have a list $L$ consisting of $N$ numbers (may include repetitions). I am curious which is more computationally intensive to calculate, the mean or the median? Naively, I would suppose calculating the mean involves summing up the $N$ numbers and then dividing by $N$, hence it has linear $O(N)$ complexity. Co...
According to this source, If A is reduced to B and A ∈ class X, then B cannot be easier than X. This reduction is used to show if a problem belongs to NPH – just reduce some known NPH problem to the given problem. This reduction thus gives a lower bound for the complexity of B. Now consider the following scenario: ...
FIND WORDS is the following decision problem: Given a list of words L and a Matrix M, are all words in L also in M? The words in M can be written up to down, down to up, left to right, right to left, diagonal-left-up, diagonal-left-down, diagonal-right-up and diagonal-righ-down. To be specific this is the classic game...
I remember seeing this problem somewhere before, but don't remember what it's called and can't find it again. It was presented as two guys having $n$ phones each that don't ring when called. Each phone from one person is connected to one phone of the other person, in some random permutation. They can each test one pho...
Let say I have time series of disk usage of last 30 days.. Given this information and with the assumption that the disk usage 'pattern' isn't changing dramatically over time, what would be a naive/simple algorithm to predict when is disk going to be full?
Please excuse my language, I am new to the topic. I am trying to classify/find a class of game that describes games such as chess, tic-tac-toe as a finite state machine. For those games, final states are easy to determine and can be efficiently checked. My question is: is there a name for such class of games/programs...
I was wondering if there's any initial configuration which generates a pure periodic behavior for Langton's Ant?
Some time ago I invented an algorithm for in-place matrix transposition using rotations. A matrix of size N×M is represented as a one-dimensional array of size N*M, which is also the future storage for the corresponding transposed M×N matrix. The algorithm moves an element to its proper position in the representation f...
Given a positive n-digit integer, such as 1214532 (n=7), remove k digits (for example k=4) such that the resulting integer is the smallest one. A greedy algorithm for this would keep removing digits such that the resulting integer is the smallest. For the above example: Step 1: Remove 2 => 114532 Step 2: Remove 5 => 11...
I have a certain algorithm which I can run, but I do not have access to its code. Thus, it works as a black box. I would like to now the order of complexity of this algorithm on a certain set of instances, which grow in size as a function of $n$. Now, I have collected running times from $n = 1$ up to $n = 5000$, which ...
If we assume we have n triangles in a given graph. How can we find the n triangles in O(n) time? And we also have to add and remove edges in O(log k) when k=|v|
I'm a physics and math student working through Nielsen & Chuang's text on quantum computation and information. I don't have much experience in CS theory, so some of these exercises are confusing to me: Suppose we number the probabilistic Turing machines and define the probabilistic halting function $h_p(x)$ to be 1 if ...
Imagine we have a program which does an infinite loop: while(true){loop} We run the program on a linux machine(assume the compilation is ok), then this linux machine becomes an universal turing machine which run the program. Questions are : 1.Does the linux machine recognize the infinite program? Why? 2.Does the linu...
I have some basic questions about complexity theory that came up when I tried to understand the result by Raz and Tal that BQP$^O\nsubseteq$ PH$^O$. Aaronsons paper was helpful, but I still have some questions left. Raz and Tal derive Corollary 1.5 from 1.4 "by the relation between black-box separations and oracle sep...
Why is the recurrence formula for insertion sort is T(n-1) + n? I understand the T(n-1) part but the why does the cost for merging results is n or linear. Do we have to merge in insertion sort?
In Karatsuba algorithm for multiplying two numbers, we divide each number into two. For example: x= 1234 y= 2456 Then a = 12, b = 34, c = 24 , d = 56 What if the digits in each number are not even, or the same? What is the rule in dividing it into two parts? Example: x = 12345 y = 2478 or x = 12456778 y = 241 Pl...
I have been trying to solve this problem. Convert the DFA to a regular expression. I extracted these following equation. $q_1 = q_2a$ $q_2 = q_1a + (a+b)q_3$ $q_3 = q_1b + q_2a $ Also,the solution is $a(aa)^*+a^*b((a+b)a^*b)^*+a^*b((a+b)a^*b)^*(a+b)(aa)^*$ Can somebody tell me how to get to this answer??
This is a real-world application, not a student assignment. Suppose a list of events of that have startTime and endTime, and some overlap information. In pseudocode: class Event { Time startTime; Time endTime; bool overlapsStart; bool overlapsEnd; } Events are considered overlaping if and only if their...
I am new to asymptotic analysis, on solving the array rotation problem on geeksforgeeks the first solution provided was using a temporary array, I tried implementing this logic and found that the space complexity is O(m) where m is the number of times the array needs to be rotated. But the time complexity is given as O...
I have to find a root of polynomial of degree $n\ge2$. I need to write code to calculate the root for different values of $n$. Only 1 real positive solution is needed. I can use general Newton's method for all degrees, or only for 5th+, and for 2,3 and 4 I can use algebraic formulas that solve quadratic, cubic and qua...
I need to develop a minimum bounding sphere. It'll only ever be in 3 dimensions, and the numbers of points are relatively small (500-5000 total). Performance is important however. I was looking for some help finding/understanding an algorithm to do this. Getting an exact answer would be preferred, but I think if the r...
I've always seen code execution speed measured either in units of time (e.g. t milliseconds), or using asymptotic analysis (e.g. O(n log n)). Execution speed will vary depending on hardware performance, and asymptotic analysis can tell us how code will perform relative to the size of the input, but they're not absolute...
Let us consider a byzantine generals problem assuming: less than 1/3 of generals are traitors Oral messages No Crypto One solution is the Oral Message algorithm OM(m), m being the maximum number of traitors we tolerate. For n Generals and m = 0, the number of messages sent is in O(n) For n Genrals and m = 1, we ha...
I am trying to calculate the time complexity of an algorithm using n in the code below. I have a working solution to a coding challenge to sort a stack using only another stack, and I've added a counter variable n that is incremented anywhere an element in the stack is pushed, popped, or held. The following code is wri...
I have a recurrence relation of the form given below (taken from Analysis of Algorithms - An Active Learning Approach by Jeffrey J. McConnell): $T(n) = 2T(n - 2) - 15 $ $T(2) = T(1) = 40 $ I am asked to find a closed-form for the recurrence relation i.e. to remove the recursive nature of the equations. Working: My prof...
so the question is in the title basically but I am now studying for a Complexity Theory Exam and encountered this problem in the exercises. I understand how to make a poly-reduction but I am not able to wrap my head around how to do it in logarithmic space. The question itself is as follows Show that $Clique \leq_L Hal...
I am studying Quantum error correction that is based on some aspects on classical error correction. I am reading some very basics around linear error correcting codes. I consider a linear code [n,k]: thus it encodes k bits of information into n bits. My question: I don't understand why the parity check matrix has $n-k$...
We were shown a proof of $NPSPACE\subseteq PSPACE$ in class. In short, the proof says: Let $L\in NPSPACE$. Then there exists a non-deterministic polynomial space bounded Turing machine $M$ that accepts $L$. For every input word $w$, the number of vertices in the configuration graph of $M$ is exponential in $|w|$. Neve...
I was reading deadlock topic from Operating Systems book by Stallings. It states four pre requisites for deadlock: Mutual exclusion No preemption Hold and wait Circular wait It then have following sentences scattered in the topic at difference places: the four conditions, taken together, constitute necessary and ...
I cannot understand how the union of two languages which are context-free but not regular, can result in a regular language: If $L_1$ and $L_2$ are 'context-free but not regular' languages, defined over the same alphabet $Σ$ then, the union $L_1∪L_2$ can be a regular language. I can't find an example to prove that th...
I wanted to know if we are given the f.f.g. Hoare triple: {x = 43}x := x + 1{x = 44} How do we show that this is a valid Hoare triple? My attempt was: Using the assignment axiom: {x + 1 = 43} x := x + 1 {x = 44} But this doesn'the make sense. I also want to know what went wrong in my attempt?
Let us say that I have a computation model $A$. Let us also say that I have shown that $A$ can be simulated by a Turing machine. I have not been able to prove that $A$ can simulate a Turing machine. In fact in trying to do so I have shown that doing so would require proving a notable unproven conjecture in mathematics...
I'm working on a small query language in JSON. A query consists of a JSON array of JSON elements, such as strings, numbers, booleans, etc. Strings starting with a '$' or '@' represent postfix unary or binary operators, respectively. I want to include some functional aspects to my query language (e.g. a map operator tha...
Question: I want to determine a boolean vector $b \in \{0,1\}^n$ consisting of zeros and ones, but cannot access it directly. I can only call a black-box computer code which will take the dot product of $b$ with a real-valued vector $v \in \mathbb{R}^n$ of my choosing. I.e., access to $b$ is available through evaluatio...
Determining whether or not an array has duplicate entries has two straightforward solutions: Build a hashset of entries, then search for elements in this hashset. This takes $\mathcal O(n)$ time and $\mathcal O(n)$ extra space. Sort the array, then search for consecutive elements that are the same. This takes $\mathca...
First, let's see the pseudocode proof of halting problem: P(x) = run H(x, x) if H(x, x) answers "yes" loop forever else halt Then we have a problem: When param x is the encoding string of P itself, the code line run H(x, x) will go to an infinite loop. Because: How does H know whether x halts on x?...
The Byzantine Generals Problem says a set of generals who are greater than 2/3rds loyal is required to guarantee that securely issuing an order is possible the loyal generals. Because of this, I am curious why so many physical systems opt for 2-person systems, like the two-man rule for launching nukes in the US (two au...
I am doing a project where circle fitting is needed and I came across an algorithm and code found on the website (https://people.cas.uab.edu/~mosya/cl/CPPcircle.html) which works very well. My question is, can I fix the radius of the circle that is going to be estimated? That means, I have some data that is acquired f...
I'm trying to write some code to match numbers below certain bounds. I would much appreciate nay help somebody could give, I'm pretty lost with this one... NB. I've checked the forums and can find similar questions to this but they are not really helping. Regex is fairly tricky! $0 < x < 500$ $500 \leq...
I am learning about quantum error correction which is for a part based on classical linear error correcting code. There is a very basic answer on an exercice I do not understand. Here is the problem (From Nielsen & Chuang, page 450, exercice 10.25) Let $C$ be a linear code. Show that if $x \in C^{\perp} $, then: $\...
Hi i'm struggling with what i think may be simple maths. I need to place circles of a small size around the edge of larger circle.. is there an algorithm to calculate the angle for each small circle from the x-axis, counter clockwise? then using this angle i can find the Cartesian coordinates (x,y) of the enter of each...
for (i=1; i<=n ;i=i*2){ for (j=1; j<=i ;j++){ basic_step; } } Regarding the above nested loops, I can't seem to understand why is the following runtime analysis is correct (specifically the first equality), when $k$ is defined as $\log i$, meaning $i=2^k$. What is the process that one should come up with, in...
I have a basic question about Hamming distances, something confuse me in the book I'm reading about it. Let's assume we have a codeword $y$ that received an error $e$. Thus we had the following event: $$ y_0 \rightarrow y'=y_0+e $$ In Nielsen & Chuang, page 449, he says: Provided the probability of a bit flip is less...
In the Stellar Consensus Protocol SCP, the voting procedure follows a 3 phase commit i.e. vote, accept and confirm i.e. see section 5. Is this a novel introduction or has this been previously been introduced, and if so, where? More specifically, I refer to definitions of these given in section 5.
Consider the class of problems that can be computed when you have access to exponentially many processors working in parallel. How does one capture that in a proper formalism? Is there some literature on it already? Would it be true that such a class would be a superset of BQP?
I want to make some Hamiltonian paths with obstacles in a grid that are hard to find It's for a game that I want to create, which consists of passing from all the cases of the grid without passing from the same one twice, and there is a start and an ending case, and the map "Grid" may have some obstacles. The cases w...
Here is the easy algorithm we are taught for adding two numbers in base-10 notation. We are taught this algorithm in first or second grade. sub infix:<+>(@x, @y) { #x, y are lists of digits #returns a list of digits my @greater = (@y.elems > @x.elems) ?? @y !! @x; my @lesser_ = (@y.elems > @x.elems) ?? @x...
Given any complete directed weighted graph $G$ with $n$ vertices and matrix of non-unique weights $W$, find a weak ordering $T(G, W)$ on the vertices of the graph satisfying the following conditions: $T(G, W)$ is invariant under permuting the vertices For any two vertices $u$ and $v$, $u = v$ in $T$ if and only if the...
8-puzzle problem: The puzzle consists of an area divided into a grid, 3 by 3. On each grid square is a tile, except for one square which remains empty. A tile that is next to the empty grid square can be moved into the empty space, leaving its previous position empty in turn. Given any initial state of the puzzle, ther...
I am confused why we can't simply use a normal queue instead of a priority queue for Dijkstra's. I agree that you can find the shortest path in fewer iterations of the while loop using a priority queue. However, the runtime will still be O((E + V) log V). However, with a queue, that runtime will be O(E + V). Can anybod...
You are given an infinite chessboard, a knight, a source and a destination.(Normal chess rules apply) we are required to get move knight from source to destination in minimum moves possible. I can only think of a bfs solution. Is there a better solution possible? The question is further extended by adding obstacles to ...
If PH=PSPACE, does this imply that the PH collapses to one of its levels? (somehow I get an error message when posting "question doesn't meet quality standard" so I add this sentence in order to workaround it)
(Sipser's Chapter 7: Time COmplexity, Pgs 294-295) If we have to prove the forward direction, then we must have the certificate along with the verifier. I don't get why we are "guessing the certificate"--essentially constructing the verifier-- if we already know one exists. On the other hand, if you don't have the ...
Assume a 1-indexed array A[1...n], containing integers, where A[1] ≤ A[n]. The contents of the array have the following property : for 1 ≤ i < n, |A[i] − A[i + 1]| ≤ 1. Develop an efficient recursive algorithm to find j such that A[j] = z, where A[1] ≤ z ≤ A[n]. The algorithm must be more efficient that O(n). Binary se...
Recently, I am reading Engineering a Compiler 2nd Edition. But I am struggling to understand the following pseudocode. Can anyone help me to explain the pseudocode in a simple and plain English? Why NextChar does take a char input? Why lexeme is the result 0f lexeme + char? What is the result of Delta[state, cat];?
I have this problem, not sure there is a name for it, wherein a Directed Acyclic Graph has different colored nodes. The idea is to partition it into minimum number of subgraphs with the following 2 constraints:- A sub-graph should have nodes of similar color A sub-graph cannot directly or indirectly depend on it's o...
I was working through some coding challenges at hackerrank.com and got to this one. I understand the problem and how to solve it, but after solving it I searched for more solutions to improve mine. So I found this. After explaining the naive method, which is the one that I used, then there is the efficient solution. Bu...
Is there a standard name for the operator that takes a function $f:X\rightarrow(Y\rightarrow Z)$ and returns the function $f':Y\rightarrow(X\rightarrow Z)$ that satisfies, for every $y \in Y$ and $x \in X$, $f'(y)(x) = f(x)(y)$?
In one of my exams I needed to find a CFG for $L=\{a^ib^{2i}c^{2i} | i>1\}$. however, it really seemed to me that it is not a CFG. I tried to show it is not using the pumping lemma, and think I managed, but I don't really know if I did something wrong there. So was I wrong or the question is wrong? Thank you.
I apologize if this is not the right board to post this question but I'm cross-posting from the mathematics board. I am dealing with a computational question that extends the question posed in https://math.stackexchange.com/questions/104700/minimum-number-of-moves-to-reach-a-cell-in-a-chessboard-by-a-knight to the vari...
According to wikipedia, Kraft's inequality holds with equality when a code is complete. Huffman encoding produces a complete code that is optimal. Are all complete codes optimal and vice versa?
There exist a vast array of prominent bitcode formats, each suited for their specific task: LLVM IR: This format is build around a XML like binary streams model, designed to be used as a common compiler target across a multitude of Architectures and languages. JVM bytecode: Java compile target, mainly; increasingly re...
Given a set of cities where you need a certain amount of fuel to travel from one city to another, each city has a different fuel price and you can only load K amount of fuel to the vehicle. The path is fixed (ie) you have to go from C1 to Cn through C2, C3,.. and so on. The objective is to fill fuel in these cities in ...
I am trying to solve a particular problem, where I have been given an array of integers and an integer X and I need to choose a subsequence of the array whose pairwise gcd is maximum given that the size of the subsequence must not exceed 2*X. So for example, my array is [5, 7, 10, 8, 3, 4] and X is 2: the answer would...
I have been studying DBMS ans I have a question that I got conflicting answers to: Is prime attribute that is dependant on another prime attribute allowed under BCNF? Meaning P->P. I know that NP->P is not allowed. and also NP->NP (as it is not 3NF - transitive relation) Thanks.
The universe size $u$ in vEB trees is square rooted at each level until $u = 2$. So, unlike search trees, the branching factor is different at each level. The height of the tree is $h = \lg \lg(u)$ and $u$ is an even power of 2, $u = 2^{2^k}$. I tried to calculate the count using the sum: $$\sum_{i=1}^{h-1} 2^i\,2^{i ...
Let A be a set which contains all non-regular languages. Then set B which is finite subset of A. Then will it be regular ? I know that A is not recursive enumerable set (undecidable). So I wonder that if finite subset of undecidable set is a regular language or not.
So this is a question pertaining to the proof for $PSPACE-COMPLETE$ (for TQBF for example). The idea is to first prove the $L$ $is$ $PSPACE$(easy part) and next is to prove $PSPACE-COMPLETE$. The latter requires demonstrating an algorithm which computes the L in polynomial space. This is usually achieved by having recu...
I have seen numerous ways to reduce CNF-SAT to SS, but is there any way to reduce SS to SAT (or one of its variations)? I have tried researching it, but all it brings up is the (apparently) much more common opposite reduction.
I know this would be an O(k log n) operation on a traditional heap, and I know there are ways to maintain Kth-smallest over a stream of inserts/deletes for constant-time access... My question though is, when we have an implicit array representation of a min-heap, e.g.: min_heap = [1, 2, 4, 3, 6, 5, 54, 12, 12, 34] In ...
Wikipedia states that the Sieve of Eratosthenes runs in time $O(n\log\log n)$. Why is that so?
I have to prove that there is no comparison based algorithem that can sort a randomly given array in less than log(n!) steps. Lets say the array has 5 elements, it is impossible to sort it (using comparison based algorithem) in just 6 steps. Can you guys help me out with this?
I am trying to find an algorithm for this. You can imagine each set $(S_1, S_2, \ldots, S_n)$ as points with different colour. Also it isn't necessarily $|S_1|=|S_2|=\cdots=|S_n|$. For $n=1$ we trivially have a single (random) point. For $n=2$ we have two sets of points $S, Q$ and we seek to find the (distance of the) ...
I'm well aware of ways to efficiently calculate the lowest common ancestor in a tree of nodes which converge to a single root (ie, each node has only one parent). Just iterate back to root for each person, then walk back from root tossing off anything common. In a matriarchal society, for example, this could be used t...
I am reading Algorithms 4ed by Sedgewick and Wayne. I came across this algorithm design question that asks the following: Write a program that given an array of N integers, finds a closest pair: two values whose difference is no greater than the difference of any other pair (in absolute value). The running time of the ...
I was looking at my teacher's notes and came about the following recurrence equation : $$ T(n) = \begin{cases} 1 &\quad\text{if } n\leq 1\\ 4T\left(\frac{n}{2}\right) + n^3 &\quad\text{if } n\gt1 \\ \end{cases} $$ In order to solve it I proceeded as follows : $$ T(n) = n^3 + 4T\left(\frac{n}...
So there's this adage that says "Objects are a poor man's closures", which can equally well be reversed, which I understand to mean that they are equivalently expressive. What strikes me about the semantics of JavaScript, is that this adage seems to come way closer to home, due to these two facts: Function execution f...
I have implemented my own matrix library in Java to solve fluid simulations. So I have also implemented the conjugate gradient method and I got a little bit confused. What I have done to test my CG-method is the following: Generate M, a $n\times n$ matrix, initialized with values between 0 and 1 (exclusive) Calculate ...
Motivation Consider the following languages, are they context-free? $\{x \# y: x \neq y\}$ $\{x y: |x|=|y|, x \neq y\}$ $\{x \# y: |x|=|y|, x \neq y\}$ $\{x y: |x|=|y|,d(x,y)>1\}$ $\{x x\}$ The first three are explained here, the fourth one is this question, the last one is well-known. I'm wondering whether there is ...
Apologies for the strange title, this is one of those questions I can't find through a Google search just because I don't even know what I'm supposed to be searching for. As I understand it, programs are ultimately compiled into binary which is then run by a computer. So say, for example, you have a simple program whic...
Combinatorics equips one with methods to find the number of solutions to discrete problems. While this is obviously an important tool for accurate gauges on the average running of an algorithm, I'm interested in whether, and if, how, one can use the knowledge of the number of solutions to improve an algorithm. More spe...
I am a hobbyist interested in single word recognition. What is the state of research? Where I can get papers or/and software tools regarding that? Thanks in advance for any advice!
I was trying to prove by induction that $$ T(n) = \begin{cases} 1 &\quad\text{if } n\leq 1\\ T\left(\lfloor\frac{n}{2}\rfloor\right) + n &\quad\text{if } n\gt1 \\ \end{cases} $$ is $\Omega(n)$ implying that $\exists c>0, \exists m\geq 0\,\,|\,\,T(n) \geq cn \,\,\forall n\geq m$ Base case : $T(1...
My training set is made up of 2d images with one imperfect but broadly circular shape in them (plus plenty of noise). I wish to train a model to predict the "radius" (obviously it's a somewhat subjective concept here) of the shape. Let's say that I know the approximate center of the shape. What approach would you use?...
I'm trying to optimize the permutations generated from a set of n elements. Here is the pitch: I have a set of 6 elements $\{1,2,3,4,5,6\}$ and I want to create 10 permutations. I could use Heap algorithm to keep 10 among 6! possible combinations. But I'd like to add specific constraint : I want to select the 10 permut...
A past exam question: (1) Consider the language, $L$, of strings over the alphabet $\{x, y\}$ of length at least 2 with the second symbol being $x$. For example, $yx$, $xxyy$, and $yxy$ are members of $L$ while $xy$, $yyy$, and $yyxx$ are not in $L$. (a) Write a regular expression to describe the language $L$. I thoug...
The capacity of a discrete memoryless channel is given by the maximum of the mutual information over all possible input probability distributions. That is \begin{align} C &= \max_{p_X} I(X:Y) \\ &= \max_{p_X} H(Y) - H(Y|X) \end{align} $H(Y|X)$ is specified by the channel only and has nothing to do with $p_X$. Hence, it...
It was asked here and closed although it is a very specific question witch was exactly answered in several papers. The complexity of 3-SAT problems has a phase transition which reaches the critical point if the ratio of clauses to variables is 4.25.
Let $G=(V,E)$ be an undirected graph without self-loops or parallel edges. Is the following statement true? If $|V|=n, |E|\ge n-1$ and every node has at least one adjacent edge, then $G$ is connected. I've proved it for $|E|=n-1$: Per induction: Start: For $\left|V\right|=1$ the graph is trivially connected. Induction ...
I had a question regarding the Pumping lemma for regular languages, I have been studying for an exam and came across the question {a^2k w | w ∈ {a, b}*, |w| = k}. In the website it lists the answer and I'm having a little bit of trouble trying to figure out what a specific part of this answer means. It states: Assume ...
Given a set of intervals on the real line, compute the largest subset of pairwise intersecting intervals (an interval in the subset must intersect with every other interval in the subset). Design a greedy algorithm that computes an optimal solution.
The question is: I give the computer a sum, such as $\sum_{n=1}^\infty\frac{1}{n^3}$, the computer is expected to return an elegant closed-form solution, because the answer may be irrational. Has this problem been solved using a computer? Or, has it been proved to be undecidable? Or is it open?
I'm thinking about a type system that has some special kind of some certain types that are subtypes of the universe kind type. Imagine the typing relation, where $A$ and $B$ are both types, $\textbf{Type}$ is the universe kind, like * in Haskell or Type in Idris or Set in Agda; while <: denotes subtyping: $$ A:a \\ B:b...
if $x=1.0e38=1.0 * 10^{38}$ and $y=3.0$ i want to find $ (x-x)+y $ and $(x+y)-x$ i think the value of (x-x)+y will be just substract $x-x=0 + y=3.0 = 3.0$ but how can i perfom addition of different base? $(x+y)-x$ i think the idea is addition $(x+y)$ then substract $-x$ using floating point, i tried to convert $y=3...
I'm currently reading the paper "The Power of Simple Tabulation Hashing" by Mihai Patrascu and Mikkel Thorup [1] because I want to adapt the proof of the constant time complexity of linear probing for modified tabulation hashing. I would like to ask a question about Corollary 11 (page 17). In this corollary is shown th...
Can you provide me a real world example of contraction and weakening in the type system of a popular language like Java, Kotlin, etc.? I heard that Rust has got explicit contraction but I don´t understand how this influences how we use such a language.