instruction
stringlengths
35
29.1k
To try to test whether an algorithm for some problem is correct, the usual starting point is to try running the algorithm by hand on a number of simple test cases -- try it on a few example problem instances, including a few simple "corner cases". This is a great heuristic: it's a great way to quickly weed out many in...
Is the problem of determining whether or not a given Boolean expression is satisfiable computationally distinct from actually finding a solution to the expression? In other words, is there another way of finding that a given expression is satisfiable without explicitly determining the 'right settings' for the Boolean v...
Assuming l1 and l2 cache requests result in a miss, does the processor stall until main memory has been accessed? I heard about the idea of switching to another thread, if so what is used to wake up the stalled thread?
I have an alternative algorithm for the problem of finding a convex hull for a collection of points. It is somewhat similar but not the exact of Graham scan. Find a point that is guaranteed to be inside the convex hull, this can be done by finding the line connecting the left most and right most points. And then pick ...
One of the most used simple examples of application of Communication Complexity is the $\Omega(n^2)$ lower bound for recognizing palindromes of length $2n$ on a single tape Turing machine. Is there a similarly simple example that proves a lower bound of $\Omega(n^3)$ for another problem that can be decided in time $O...
I'm working on a problem and would like to do some research on similar problems to help refine my approach. Can anyone help me identify what kind of problem this is or, at least, what kind of problems it relates to? The basic model is a set of different job types, handled by a set of machines. There is also a dispatc...
Writing a survey, I am confronted to a very difficult and -- I dare say -- deep issue: I have many sentences mentioning or stating results of the form "a $\Omega(\sqrt{n})$ lower bound", or "a $O(\sqrt{n}/\varepsilon^2)$ algorithm". And I am struggling to decide whether I should use "a" or "an" in front of these: is th...
Supposing I have some algorithm that is able to provide me with a confidence value for some event occurring. Let's say on day 1 it tells me that there is a 80% chance it will rain, on day 2 it tells me there is a 20% chance that the mail will be late, and on day 3 it tells me that there's a 90% chance my milk will go o...
For a complete graph, the size of minimum vertex cover is $n-1$. I was wondering whether there exist an upper bound (or an expected value or upper bound) for the size of minimum vertex cover for scale-free graphs, i.e. such whose degree distribution follows a power law. I searched and didn't find anything, is anybody a...
I'm studying binomial heaps. A book tells me that insertion of a node to a binomial heap take $\Theta(\log n)$ time. So given an array of $n$ elements it would take $\Theta(n \log n)$ time to convert it to a binomial heap. Does anyone know a method that can convert an array of numbers to a binomial heap in $\Theta(n)$...
In "Conceptual Wavelets" (2009) by D. Lee Fugal, on pg 47 he writes Conv ([-1, 1], [1, 1]) = [-1, 2,-1] When I do it I get 0 -1 1 0 1 1 > -1 1. 1. > 0 1 1. > 1 So I get [-1, 0, 1]. What am I not understanding? The definitio...
This is a homework. It looks easy, but not really. A list of integers $a_n$, for every $i<j$, if $a_i>2a_j$, then it is an inversion. Count the inversions in the list, and return the count and the ordered list. Note, here the order is defined by the condition, not just sort the integers. The easiest way is double loop,...
The k-means algorithm is known to be NP-hard. While the distance function computation in the algorithm loop is data parallel, the algorithm is iterative and may become exponential in the number of iterations. Is there a way to parallelize in practice k-means so as to alleviate (even in a small way) the hardness of k-me...
I'm just starting to learn about NP-completeness. While I understand that reducibility plays a key role in this, I'm astonished how few problems I've been able to find who's proof that they are NP-Complete is not based on reduction to an existing NP-Complete problem. While I understand these proofs are perfectly valid,...
I am doing some reading (and implementation) of some Clustering Algorithms. First I started with the well known K-Mean algorithm and implemented it directly from a paper. Got a kind of decent understanding of what I going on there. What I am actually interested in is Particle Swarm Optimisation based clustering. For Pa...
Take the following array of integers: [60, 45, 30, 45, 45, 5, 60, 45, 30, 30, 45, 60, 60, 45, 30, 30, 60, 30, 30] They need to be sorted into pairs of sub-arrays. The first sub-array in each pair must total at most 180, and the second must total at most 240. How would you find the right combinations of elements so that...
I'm not sure if this is the right site to ask, but I couldn't find a another one. Some time ago I found out about the join calculus. It is based on constructs called joins to support concurrency. For example: (pseudocode) int get() & void set(x) { return x to get } void main() { set(1) & set(2) & print(get...
We have a set of 24 distinct arrays, each array has 36 elements and each element can have one of 13 possible values. Then we're given an array X (this array is certainly part of our set) and we have to find to which array of our set it corresponds to. Of course, we can check all 36 elements of X against each of 36 elem...
I'm asked to design an RMQ data structure (Range Minimum Query: return index of $min$ in a range $[i,j]$) for an array that has $<=\log(n)$ local minimums (a local minimum is an index $i$ such that $A[i-1]>A[i]<A[i+1]$). There are 2 restrictions: Only $O(\sqrt{n})$ additional space (rather than $O(n)$ which is used fo...
I'd like to enumerate all undirected graphs of size $n$, but I only need one instance of each isomorphism class. In other words, I want to enumerate all non-isomorphic (undirected) graphs on $n$ vertices. How can I do this? More precisely, I want an algorithm that will generate a sequence of undirected graphs $G_1,G_...
If $r$ is a machine-representable number and $f(r)$ is the next larger machine representable number, are the following true or false? In fixed-point arithmetic, the distance between $r$ and $f(r)$ is constant. In floating-point arithmetic, the relative distance $|(f(r)-r)/r|$ is constant. I believe that (1) is true, ...
A path is simple if no vertices are repeated. How many simple paths exist between two vertices in a complete graph? One way is listing all simple paths using depth-first search. but I think it should be more simple to find the number of all simple paths between 2 nodes in a complete graph. Here is the same problem but ...
I'm struggling to understand some concepts related to the relationship between language and computability theories. Can we convert decision problems to the corresponding grammars describing the languages? Can every decidable decision problem be converted to a context-free or context-sensitive grammars? If it does not m...
Let $\Sigma=\{a,b,c\}$. Describe an algorithm that takes as input a deterministic finite automaton $M= (Q,\Sigma,\tau,s,A)$ and determines whether or not $M$ accepts a word containing $bb$ (i.e., a word of the form $\alpha bb \gamma$ for some $\alpha,\gamma \in\Sigma^*$). You do not have to give a formal proof that you...
A student recently asked me to check an NP-hardness proof for them. They performed a reduction along the lines of: I reduce this problem $P'$ that is known to be NP-complete to my problem $P$ (with a poly-time many-one reduction), so $P$ is NP-hard. My answer was basically: Since $P$ has instances with values from $...
I am confused between these two terminologies: recursively enumerable language, recursively enumerable set. Do they have the exactly same meaning?
I'm trying to prove that c2n = o((loglog n)n) (That's little-o) for any constant c. I understand that we can prove one function grows at a smaller rate than the other by taking the limit as n approaches infinity, and I can very easily pick some arbitrary integer value for c and show that indeed ((loglog n)n) grows at a...
Problem: You are required to sort an array with numbers from 1 to n. You can do a "move", which means choosing one element and moving it to any place you want (insert to any place, not swap). Prove the minimum number of "moves" to sort the array is n - k, where k = the length of the longest increasing subsequence. Ex: ...
I've read that some current CPUs (e.g. Intel i7 and ARM A9) have (L1) cache latencies of multiple clock cycles while also being pipelined. Some devote multiple pipeline stages to instruction fetching. How is the L1 cache implemented to support pipelining? Is it, say, $k$ actual stages for decoding the address or does ...
I'm currently preparing for an exam and recently came across the following exercise and would like to know whether my solution would be correct. Exercise: Prove that the following axiom is not correct in the Hoare Calculus: {true} u:= t {u=t} My Proof via Reductio ad absurdum: Assumption: Axiom is valid Hoare Calculus...
I have a basic question about the power of Linear Programming that has been bothering me for some time. I believe there is something simple I am missing. Linear Programming is $\mathsf{P}$-complete, which means that every problem in $\mathsf{P}$ can be reduced to it using an $\mathsf{NC}$ reduction. (See the wiki for...
Question: "Certain properties of a programming language may require that the only way to get the code written in it be executed is by interpretation. In other words, compilation to a native machine code of a traditional CPU is not possible. What are these properties?" Compilers: Principles and Practice by Parag H. Dave...
It's possible to determine whether a deterministic machine with finite memory will halt in O(n) time if the machine has n possible states. You simply run the machine until it halts or visits the same state twice, which is guaranteed to happen in no more than n steps. Can any other algorithm do this in fewer steps? Is t...
I am trying to learn(self-study, not homework) how to perform transitive reduction according to what what Prof. Leskovec explains in section 10.8.6 in Mining Massive Datasets. The book is free to access online. The section is actually talking about a way to perform transitive closure for a graph randomly choosing a nod...
We have a weighted tree of $n\leq 10^5$ nodes, and for every node $v$, value $L(v)$. The goal is to calculate, for every vertex $v$, number of vertices $u$ such that $\mathrm{dist}(v,u)\leq L(v)$. This is a task from a programming contest. Judging by the limit on $n$, and also specifics of time limits on this contest, ...
At the beginning we have a directed unweighted graph of $n \leq 10^3$ vertices, and $m \leq 10^5$ edges, with some vertex being a source, and we perform updates and queries on it. An update is adding some edge between two vertices $u$ and $v$. A query is asking, for some vertex $v$, what is $\mathrm{dist}(\mathrm{sourc...
I thought this question is better served in the CS part of Stack Exchange. Now that we have GPGPUs with languages like CUDA and OpenCL, do the multimedia SIMD extensions (SSE/AVX/NEON) still serve a purpose? I read an article recently about how SSE instructions could be used to accelerate sorting networks. I thought th...
In Bitcoin, when one node wants to tell another node about a block, it sends the block header, then all the transactions it contains. This is inefficient, because the receiving node might already have some or all of those transactions. The sending node needs to tell the receiving node the transactions that the receiv...
Consider a base 2 computer that stores floating point numbers using a 6 bit normalized mantissa (x.xxxxx), a 4 digit exponent and a sign for each. a) For this machine, what is machine epsilon? b) What is the smallest positive number that can be represented exactly in this machine? c) What mantissa and exponent are stor...
could you help me in clarifying a doubt regarding how to find square of a graph g from graph g.the doubt occurs on 15th page of the document which I have shown you by the link given.the doubt is that I could see all edges and vertices were correct for square of the graph.But I couldn't see an vertex for sugar,sugar and...
I initially considered this problem trivial, but then looked with more attention, I could not find an easy solution. Let's say we have two ordered lists of symbols (strings): A = "foobarquuz123" B = "foobar456quuz" my goal is to have a way to merge the two incomplete lists into the following, completed with parts from...
Describe (in English phrases) the languages associated with the following regular expression. it says to be as simple as possible #1 (x (yyy + x)*)* #2 (c (cc)*d(dd)*)* for number 1 I got all words in which when y is in the word it can only appear in blocks that are divisible by 3(0,3,6,9, etc.) the second question I ...
The k-means algorithm reduces to computing the objective function: $ \underset{\textbf{S}}{\operatorname{argmax}} \sum_{i=1}^k \sum_{\textbf{x}_j\in\textbf{S}_i} \lVert \textbf{x}_j - \mathbf{\mu}_i \rVert $ for some observations $\textbf{x}_1,\ldots\textbf{x}_n$ to be partitioned into sets $\textbf{S}_i$. How can thi...
Can you always decide if a specific Turing machine accepts a specific string? I started thinking about this after reading an answer to this question, Rice's theorem vs Turing completeness, which seams to you can. If this is true, intuitively, it seams it would be implied that HALT could be decided, which is obviously ...
One way to interpret the (simply typed) lambda calculus is via coherence spaces (Proofs and Types, chapter 8). For example, we can consider the space containing token element ($\mathbf{1}$) and the space containing two incoherent tokens ($\mathbf{Bool}$). These are given as follows: $$ \mathbf{1} = \{\emptyset, \{0...
I was reading dynamic programming chapter from famous book Introduction To Algorithm In rod cutting problem it gives simple algorithm as follows: cutRod(p,n) { if (n == 0) { return 0 } q = -∞ for (i=1 to n) { q = max(q,p[i]+cutRod(p,n-i)) } ...
My question is the following: If we have a problem divided into two versions, weighted and unweighted. Can we prove that the unweighted problem is NP-hard from the fact that the weighted problem is NP-hard ? For example let say I have the knapsack problem (the weighted version): $$\max \sum_{i}^n w_i x_i$$ $$\text{s.t....
How is video playback done on a computer? It's obviously not relying purely on the CPU, since video playback continues when a user performs another activity, such as typing into a YouTube comment field. This task seems further complicated in the case of streaming video, where data presumably needs to be transferred f...
In Recent Contributions to The Mathematical Theory of Communication (Weaver 1949), aka The Mathematics of Communication (Weaver 1949) (various copies exist online), and also published as Part I of The Mathematical Theory of Communication (Shannon and Weaver 1949), Weaver says: We are now in a position to state the fun...
Background: The pool ball weighing problem is a classic CS question thrown at students, typically to demonstrate a binary search (alternative to ripping phonebooks in half). Pool Ball Problem: Given $n$ pool balls where exactly 1 weighs more than the rest, find that pool ball using a scale. The common approach is to sp...
Describe (in English phrases) the languages associated with the following regular expression. it says to be as simple as possible #1 (x (yyy + x)*)* #2 (c (cc)*d(dd)*)* for number 1 I got all words in which when y is in the word it can only appear in blocks that are divisible by 3(0,3,6,9, etc.) the second question I...
Is there any way to combine multiple Hidden Markov Models trained from different sets of data? For example, I want to detect the phases of a sequential activity. I collect two sets of data by using two types of sensors: accelerometer, and video stream. I create two HMM models from the accelerometer and video stream, re...
So sometimes in combinatorics, you are computing the count $a_n$ of something that depends on a natural number parameter $n$. Either by hand or using a computer, you can often compute some initial terms in the sequence $(a_n)_n$. Now, you can enter those initial terms into the Online Encyclopedia of Integer Sequences, ...
Some of the MIPS processors like 5kc, 5kf have "limited dual issue". Searching online it seems that this means that the processor allows for a dual issue in only some selected cases, but it is not clear which ones these precisely are. Can someone elaborate on what "limited dual issue" exactly means ? Further, came acro...
could you please help me for finding an unambiguous CFG for the following expression: $a^ib^j$ where $i \le j \le 2i$
I was reading about the busy beaver problem the other day and I'm confused as to why we can't keep an array of Turing machine states that the machine has been through and simply iterate through it at each new machine state to see if it exactly matches a state we've previously seen. That ought to tell us there's an infi...
Relation of Entropy and SNR : Based on this question and answer, I had another question that struck me and I am curious to know, if somebody can shed some light, on the following situation: $y= desired_{signal} + noise$ is transmitted where $noise$ is an Additive White Gaussian Noise. $y(t)$ is received by the receiver...
From my textbook, I am studying the time-complexity of the insertion sort algorithm (shown below). INSERTION-SORT(A) cost times 1 for j <- 2 to length[A] c1 n 2 DO key <- A[j] c2 n - 1 3 ▷ Insert A[j] into the sorted ▷ ...
I would be grateful if anyone could help me with the tricky exerciese *7.52 from Sipser's Introduction to the Theory of Computation 3rd ed. I got stuck in proving that, if P is closed under nonerasing homomorphism (replacing all characters with nonempty string), then P = NP. With nonerasing homomorphism I cannot delete...
I recently had a test in introduction to computability and I got the following question wrong. The question Input: A classical Turing machine $M$ with a 2-dimensional tape. output: Does there exists a Turing machine $H$ that runs in polynomial time such that for any input $x$, if $M$ halts then $M(x)=H(x)$ Which of th...
I am confused with end carry and overflow. When will an end carry be the overflow? How to identify whether the end carry is overflow or not? Are they both same? Sometimes end carries obtained are simply discarded and sometimes the end carries are considered as overflows. What is the exact method to find an overflow? In...
I saw this maze, and tried to apply pledge algorithms to it. But I am not able to solve this maze using this algorithm. What am I missing/doing incorrectly? PLEDGE ALGORITHM: in both cases we don't get to exit. you can read about these algorithms at: http://en.wikipedia.org/wiki/Maze_solving_algorithm http://www.astr...
I'm searching for an algorithm to distribute values from a list so that the resulting list is as "balanced" or "evenly distributed" as possible (in quotes because I'm not sure these are the best ways to describe it... later I'll provide a way to measure if a result is better than other). So, for the list: [1, 1, 2, 2, ...
What is meant by lazily computing online? For example, in context of synthesis, that uses model checking. http://www.cs.colostate.edu/~france/CS614/Readings/Readings2011/Model-checking-Survey-a21-jhala.pdf The above paper also mentions the concept in page 21:29. Thanks in advance
How can one prove that every nontrivial property of pairs of semi-decidable sets is undecidable? (This is an extension of Rice's theorem that "Every nontrivial property of the r.e. sets is undecidable")
I'm almost sure I understand $o(1)$ (a class of functions that converge to zero in their limit), but the way I understand it, that would seem to imply that functions in $n^{o(1)}$ converge to 1 (after all, $n^0=1$ ) Certainly the limit of $n^{1/n}$ is 1. But it can't mean that, because the next question (and yes, this...
Our current computers use bits, so they use the binary numeral system. But I heard that the future quantum computers will use qubits instead of simple bits. Since in the word "qubit" there is the word "bi" I first thought that this meant that quantum computers would use binary (base 2). But then I heard that qubits had...
Suppose that a search for a key in a binary search tree ends up in a leaf. Consider three sets : A,the keys to the left of the search path B,the keys on the search path C, the keys to the right of the search path. Any 3 keys a,b,c belonging to A,B,C respectively must satisfy a<=b<=c. How can I disapprove it? I am tryi...
How efficiently can a doubly linked list be sorted? The minimum I could get is $O(n^2)$. Can anyone suggest something better?
I cannot find a to-the-point reference for my question. Am I correct in assuming that if you have an L1 and an L2 cache, typically the L2 cache linesize is larger? For the following, let's assume a word size of 1 byte, an array 'a'of one byte words, an L2 cache with blocksize of 8 bytes, and an L1 cache of 4 bytes. ...
I would like to write an analysis of go positions. Part of it requires me to determine the "groups" on the board and count their "liberties". Any Go "position" is a collection of black x white o and empty . on the board. So I using an 2D array. o.x.xxx..x xoo.xoxxoo ....x...ox .ox.o.o.o. xox..xx... .xox.x.xx. o..ox...
Are interrupts needed for a computer system to work? Could you have a computer system (hardware and software, including the OS) that worked without an interrupt mechanism?
Given an undirected unweighted graph $G=(V,E)$ and a node $s \in V$, we are looking for a vector $\operatorname{diff}[]$, such that, $$\operatorname{diff}[v] = \sum_{u \in V \setminus \{v\}}{(d^{G \setminus \{v\}}_{su}-d^G_{su})}$$ In other words, we are looking for the difference in distances from $s$ to every other ...
Searching an array of $N$ elements using binary search takes, in the worst case $\log_2 N$ iterations because, at each step we trim half of our search space. If, instead, we used 'ternary search', we'd cut away two-thirds of our search space at each iteration, so the worst case should take $\log_3 N < \log_2 N$ iterat...
Let's say I've got a function $f$ that takes a single number and returns a number. And I have another function $\mathrm{verify}f$ which takes the input I gave to $f$ and the number returned by $f$ which returns true if the output is the same as $f$ would have returned given the input. If you know the input and output t...
According to one of my CS lectures, there is an fully polynomial time approximation scheme for the 0/1 Knapsack problem. A first version was developed by Ibarra and Kim, but there are several improved versions. Also according to my lecture, an approximation scheme is called "fully polynomial time approximation scheme (...
Also asking for float, character, ect.
There is this question in Kozen, that states if a language is regular then the first half would also be regular. Also I found a material on the internet that extends the thinking saying a language that is two-thirds of already known regular language is regular. I'm tempted to think that it should also hold true for any...
Why is the machine error/epsilon higher between a pair of two lower numbers than a pair of two high numbers? For example, between the two smallest numbers possible in 5 bit mantissa and the two largest numbers possible in a 5 bit mantissa. The error for the smallest pair is nearly twice as much as the largest pair? Ano...
(Please note, this is not a duplicate to Shortest path with exactly $k$ edges OR Shortest path with a fixed number of edges. What I want is a better algorithm) The problem under consideration is to find single-source-shortest-path of at most $k$-edges (simple paths only). What we have is very special case: a Directed...
Below is the diagram of SR latch The following is the functional table as per my scrutiny . Sl.no S | R Q(t) | Q'(t) Q(t+1) | Q'(t+1) Q(t+2) | Q'(t+2) Q(t+3) | Q'(t+3) Remark ===== ===|=== ======|====== =======|======= ========|======== ========|========= ======== 1 0 | 0 0 | 0...
Consider an $n$ by $n$ grid graph. For example, the following. You can of course reach the top left corner from the bottom right. Now consider the graph dynamically with an arbitrary number of edges deleted at each step. What is the time complexity of determining whether you can still reach the top left corner f...
Is there a way to get canonical representation of an integer by algorithm? I can get primes, but I don't know how to represent, for example, 1000 as 2^3×5^3. How can I compute the power of each prime number?
In the book Purely Functional Data Structures by Okasaki, exercise 9.1 asks: Write a function drop of type int x a' RList -> a' RList that deletes the first k elements of a binary random-access list. Your function should run in O(log n) time. Using the features the author is using so far, i.e. a complete binary leaf...
I have an array with a hundred thousand entries representing the x and y values of a function. Since I frequently need to integrate this function (in a product with other functions) I am looking for an algorithm that allows me to reduce the number of function points without changing the value of the integral. I am look...
I'm working with a pattern matching algorithm that generates an acyclic finite state automaton that accepts a given text string and all its substrings. The FSA algorithm is being run on a symbolic representation of a music stream (e.g., MIDI data). The music stream has been preprocessed to divide each song into unlabel...
I am working on a reinforcement learning strategy for parameter control of a local search heuristic. The complete state for this RL problem can be defined as $S = \{s, p\}$, where $s$ and $p$ are respectively the current solution and the vector of current parameter values. An action correponds to raplacing or maintain...
This is my first time with reductions and I can't figure out how to do them. I have read the few standard examples that are given in the standard books. For example, given $n$ numbers $\{ 0 < s_i <1 , \text{ for }i = 1,..,n \}$ one wants to minimize the number of number of bins required to pack them if each bin can ...
Let isAncestor be a relation on binary tree nodes such that isAncestor x y means y can be reached from x in n steps from parent to child, where n may be zero. It is clear from this definition that isAncestor is a partial order. (Two nodes are mutual ancestors if and only if they are identical, and ancestors of ancestor...
The Situation I am an electronics engineer and on a volunteer team that have built a prototype eye that has 200*200 sensors that are mapped to the optic nerve, the connection to the optic nerve is random (organic connection is grown) so I need to have the patient draw what they see, I am trying to limit the number of ...
I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnt that Hexadecimal uses symbols like A, B, C, D, E, F to represent 10,11,12,13,14,15 -- and that's what i want to do to my own numbering system but in a bigger scale...
If I have a static set of $n$ items in a database that are all queried with uniform probability it makes sense to put them in a binary search tree. This way any given search will take, on average, $O(\ln n)$. What happens now, if the items are not queried uniformly? As a silly example, say that one item is queried 1000...
I implemented a queue using two stacks which gives me $O(1)$ en-queue time, $O(1)$ amortised time. Now suppose I want to find top $10\%$ elements in the queue at any time. How am I suppose to implement it. For example: queue takes the element in this order $$ \{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 \}.$$...
Once we've computed the max flow in a flow network with integral capacities, we can change one of its edges' capacity by a unit and recompute a maxflow in linear time using BFS. Is there something similar for rational networks where we might change a capacity by an arbitrary amount, or delete edges (which amounts to se...
Are there any existing efficient algorithms for lazily computing a random permutation of the positive integers in a given range (e.g. the range offered by an unsigned integer type in a CPU)? What I mean is this: An algorithm that, given a source of randomness and a positive integer range (for simplicity it could be res...
Using an infinite supply of integers of a set S, how many ways are there to reach a sum of n? Clarification: The Integers are arbitrary, positive, and may not include 1. At first I thought it was the coin changing problem without pennies, but it's not because the order is important so coin changing will always be less....
What is the best way to detect repeating sequences of random numbers? For example, say I got two random number generators (RNG). One of them has been tampered with and is repeating the sequence of random numbers after every N iterations. The other RNG has not been tampered with and is producing random numbers like it s...
Given two relations $R(A, B)$ and $S(A, C)$. I can understand the early part is the projection of attribute $A$ from $S$, which could be written as $π_a(S)$, but later part is confusing and not understandable to me. $$ \{a| (\exists c) (S(ac)) \land (\exists b_1) (\exists b_2) ( R(ab_1) \land R(cb_2) \land b_1 > b_2 )...
In some places in the world, people don't usually have access to (and hence little knowledge of) computers, and even if they have, hard- and software are outdated and usage plagued by power outages and such. Access to (good) books also tends to be lacking. How can I teach computer science under such circumstances? I'm...
I have three functions with values given as $$\begin{align*} P(0) &= 0 \quad & P(i+1) &= 5M(i)\\ M(0) &= 1 \quad & M(i+1) &= R(i) + 2P(i)\\ R(0) &= 3 \quad & R(i+1) &= R(i) + 3P(i)\,. \end{align*}$$ If it was a linear recurrence with one function I could solve it using matrices. But here I ca...