instruction
stringlengths
35
29.1k
Whenever CPU needs the data, it gives the address of that word to the RAM via bus, then the RAM generated the copy of that word and sends to the registers via bus. Why can't the RAM send the original data instead of the copied data? Are there any disadvantages of storing original data or reference in registers?
I wonder if there exists language-agnostic data structure notation. Preferably a standard, allowing to describe data structures and basic data types. e.g. something like a subset of WebIDL. A motivation is to describe data structures (a model) in a way that is standardized and language-agnostic. Then have a set of mapp...
Many standard Compiler Design texts mention constructing augmented grammar as first step of LR parsing. The reason frequently is It is required in cases where start symbol comes on right hand of any production It is required when start symbol's RHS have multiple production. I figured that if in the parse table's acti...
My question is: Is there a simple construction similar to Turing's 'liar' program that shows that Turing machines plus a halting oracle cannot decide if a given Turing machine halts on all inputs. When I talk about the liar program I am referring to the standard proof that a Turing machine can't determine the halting...
I'm trying to generate a graph based off some data I have. This graph should have N nodes where the number of edges each node has is equal to a random number P(k), where k is the "index" of the node (mostly arbitrary). My question is, is there an actual way to do this? I'm thinking that I need more data that either det...
lets say Given input is n = 6 (n is as large as 100000) My task is to divide {1, 4, 9, 16, 25, 36} into two groups and PRINT these two groups Possible Solution 1: dividing groups as {1, 9, 36} and {4, 16, 25} which gives abs diff as abs(46 - 45) = 1. So the minimum difference is 1 and the two groups are {1, 9, 36} and ...
Lets say I have the following DNF: (x or y) and (z or i) / $(x\lor y)\land(z\lor i)$ How do I convert that into a polynomial form?
I am new to the complexity theory and I am trying to understand what would be the complexity of the following problem: "Is a graph AT LEAST $k$-colorable?" Whether a graph is $k$-colorable is clearly a NPC problem and is explained by reduction to 3-SAT. However, I am not sure to which complexity class belongs the modif...
I know that $P \subseteq NP$, but for a problem in $P$, e.g. MST in a graph, is it a correct statement to say that: The MST problem belongs in NP-Class. (I mean, i think it is correct, but could someone classify that as wrong because he would expect P instead of NP?)
I'm currently working through Algorithms by Dr. Jeff Erickson. The following is an algorithm presented in the book: NDaysOfChristmas(gifts[2 .. n]): for i ← 1 to n Sing “On the ith day of Christmas, my true love gave to me” for j ← i down to 2 Sing “j gifts[j],” if i > 1 ...
Although many texts state Dijkstra's algorithm does not work for negative-weight edges, the modification of Dijkstra's algorithm can. Here is the algorithm to solve a single negative-weight edge without negative-weight cycle. Let $d_s(v)$ be the shortest distance from source vertex s to vertex v. Suppose the negative e...
First of all, I know objects are not meant to model the real world, although they have been marketed as such and perhaps that was an intention at some point. Here I say 'modeling the real world' in a general sense. That includes simulations, modeling of abstract (non-real) concepts and modeling of business support appl...
I'm new to writing math notation that describes algorithms and I need to translate some python code. Does the notation structure below correctly describe a nested for-loop that for-each value in p iterates over all other values in p? Example code function(p): for a in p: for b in p: // do something...
This problem is originated from the game MapleStory, where the player needs to build "tri-nodes" to enhance their skills, and each skill should appear in two different tri-nodes. For my character, Kanna, I want to enhance 9 skills with 6 tri-nodes (2x9=3x6). After thinking a while for an optimal strategy, it seems to ...
I am working with this code: function strange (list a[0..n-1] of integers such that abs(a[i]) ≤ n for every 0 ≤ i ≤ n - 1, list b[0..2n] of zeroes) for i ← 0 to n - 1 do a[i] ← a[i] + n for i ← 0 to n - 1 do for j ← 0 to abs(a[i] - 1) do b[j] ← b[j] + 1 return b I am trying to figure out ...
How do I name VRAM and RAM properly in a paper? "Video RAM" is clear but the "normal" RAM? Is it called "CPU RAM" or "Processor RAM" or "Main RAM" or totally different?
I am attempting to define an optimization for the following problem: given a graph find the largest interval(s) where S > S_th (the narrower the interval the smaller S will be) and P < P_th (the wider the interval the higher P will be). I am not 100% certain the claims in parenthesis are always correct as, I think, it...
I'm working through so textbook questions on regular languages, and came across a problem that amounts to showing the following language is regular, given that $A$ is a regular language: $$ \{x|\exists n \ge 0 \; \exists y \in A \; y = x^n\} $$ I've attempted to show that this is regular by a contradiction using Myhill...
In theory, given that: The LALR parser can be constructed by merging LR(1) states with the same core; If $I$ is a LR(1) set of items, then $\text{core}(\text{GOTO}(I))=\text{GOTO}(\text{core}(I))$; the SLR and LALR automata should be isomorphic.
In the standard 3-partition problem, there are $3 m$ integers, their sum is $m T$, and they have to be partitioned into $m$ subsets of sum $T$ and size $3$. Consider the variant without the restriction that the size is $3$ (but with the restriction that there are $m$ subsets with a sum of $T$). Are these problems compu...
Given a matrix $M$ of certain size $h\times w$, where $h\leq w$, for example $5\times 6$, are also given the following set $B$ of additional all-ones matrices, that I like to call target (b)oxes. $$ \begin{matrix} Boxes: & \begin{bmatrix} % 2 x 5 1 & 1 & 1 & 1 & 1\\ 1 & 1 & 1 & 1 & 1 \end{bmatri...
Prove that $3n^3 - 6n^2 + 9n - 9\log n \in \Theta(n^3)$ using So, how can I prove this by big theta definition? I don't what I should do with the log function
I have a recurrence relation as follows $$T(n) = 2T(\lfloor n/2\rfloor) + n\log(n)$$ Using the induction hypothesis how do I obtain a relation $T(n)\leq E$ such that $E$ contains neither $T$ nor floor operator ($\lfloor\cdot\rfloor$).
I’m an amateur in the study of algorithms. For a while I’ve had a burning question, why do we study complexity theory in computer science? The reason I ask is because algorithms with better asymptotic complexity are not always faster for practical purposes, in fact they can be absurdly slower. Why not instead develop ...
The master method works well on problems like $T(n)=kT(an)+cn$, but it does not handle problems like $$T(n)=n^{\frac{1}{3}}T(n^{\frac{2}{3}})+n^2$$ With the number of branches for each partition is a function of $n$. I wonder if there's a good solution to this kind of problems, I have no idea how to solve this, any hel...
I have heard the simply typed lambda calculus is the internal language of Cartesian closed categories. What's the internal language of the opposite type of category? The rules dual to currying and uncurrying are: $$ \mathrm{mal} : \mathrm{Hom}(b, a + c) \to \mathrm{Hom}(b \vdash a, c) \\ \mathrm{try} : \mathrm{Hom...
Given $T(n) = 9T(n/3) + n^3$, I know that $a =9$, $b=3$, and $f(n) = n^3$ and $n^{\log_{3}9} = n^2$ thus Case 3 applies: $n^{\log_{b}a} < f(n)$, $n^2 < n^3$. Can someone explain how to apply the regularity condition and how to check the regularity condition? $af(n/b) \le cf(n)$ where $c < 1$ I appreciate your help!
Which function results from primitive recursion of the functions $g$ and $h$? $f_1=PR(g,h)$ with $g=succ\circ zero_0, h=zero_2$ $f_2=PR(g,h)$ with $g=zero_0, h=f_1\circ P_1^{(2)}$ $f_3=PR(g,h)$ with $g=P_1^{(2)}, h=P_2^{(4)}$ $f_4=PR(g,h)$ with $g=f_3\left(f_1(x),succ(x),f_2(x)\right)$ (1.) $g:N^0\to N$, $h:N^2\to...
I am new to CFG's and automata in general and I came across an exercise where I needed to construct a CFG for the language {a^m b^n | n <= m + 3}. So m can be infinitely bigger than n but n can only be up to 3 more bigger than m and they can be the same. I have no idea how to make a CFG for this. What I came up with wa...
I am learning λ-calculus and I have some confusion about it. Is the term $(\lambda x.x)(y y)$ a normal form in call by value reduction strategy? (where $y$ is a free variable) From the wikipedia, it says: Call by value Only the outermost redexes are reduced: a redex is reduced only when its right hand side has reduced...
Can we construct an explicit Turing Machine with a Halt1 oracle that decides if a standard Turing Machine halts on all inputs? By a Halt1 oracle I mean that we have the ability to decide if Turing Machines with a Halting oracle halts or not.
I have a sorted list of numbers. I know they can be divided into two parts. I also know the sum of those 2 parts. I want to know what these subsets are. How can i find them? The size of my list can be ~ 10^6. The sum of my subsets can be ~ 10^24. Is there a better way to find my subset with a time complexity of O(n*sum...
Given the condition: $T(O(1)) = O(1)$ and $T(n) \leq \sqrt{n}T(\sqrt{n}) + n$. I need to solve this recurrence relation. The hardest part for me is the number of subproblems $\sqrt{n}$ is not a constant, it's really difficult to apply tree method and master theorem here. Any hint? My thought is that let $c = \sqrt{n}$ ...
The solution for solving the following recurrence with the substitution method involves adding the a constant inside the recurrence, which is confusing to me. This is question 4.3-2 in the CLRS textbook. Show that $T(n)=T(n/2) + 1$ is $O(lgn)$ The solution states that the guess should be $T(n) \leq clg(n-2)$. I underst...
In the ABC-partition problem, there are three sets $A, B, C$ with $m$ positive integers in each. The sum of all integers is $m T$. The goal is to construct $m$ triplets with the same sum $T$, each of which contains exactly one integer from $A, B$ and $C$. The problem "feels" NP-hard, but I could not find a proof for th...
I have taken a course "Programming for Performance" in my college and in the first week of the course, I have come across vectorization and Asynchronous Parallelism. But I am unable to figure out what is the relation and difference between the 2 of them. In the slides, the professor has provided something like this--> ...
Consider two strings $S$ and $T$ of length $n$. Here both the strings $S$ and $T$ consists of only ( and ) that is made of parenthesis. I need to find a string $w$ which is balanced parenthesis and it should be sub-sequences of both $S$ and $T$ among all those strings $w$ i need the maximum length strings. This problem...
There is this general sentiment about neuromorphic computers that they are simply "more efficient" than von Neuman. I've heard a lot of talk about neuromorphic computers in the context of machine learning. But, is there any research into performing logic and maths in general on such computers? How would one translate a...
Is machine epsilon the largest relative error in representing a number as a floating point number? There are so many definitions of machine epsilon. I'm starting to get confused. Isn't the machine epsilon the smallest?
If Mac OS, Linux, and Windows (mostly) all use Intel's 8086 64 bit instruction set, why can't we compile 8086 64 assembly from any operating system to any other operating system? (e.g. compile a Mac OS executable from assembly in Windows). Surely it would just be a matter of knowing what the machine code is for any giv...
In what cases is solving Binary Linear Program easy (i.e. P complexity)? The reason I'm asking is to understand if I can reformulate a scheduling problem I'm currently working on in such a way to guarantee finding the global optimum within reasonable time, so any advice in that direction is most welcome. I was under th...
I'm currently doing some research on signal processing and I got a dataset which includes the signal in itself and its "translation". So I want to use a Many-to-Many RNN to translate the first into the second. After spending a week reading about the different option I have, I ended up learning about RNN and Seq2Seq mo...
I came across Strassen's algorithm for matrix multiplication, which has time complexity $O(n^{2.81})$, significantly better than the naive $O(n^3)$. Of course, there have been several other improvements in matrix multiplication since Strassen, but my question is specific to this algorithm. If you see the algorithm, you...
I as studying VCdimensions and growth functions and found the following example on Wikipedia: The domain is the real like $\mathbb{R}$. The set H contains all the real intervals, i.e., all sets of form $\{c \in [x_1, x_2] | x \in \mathbb{R}\}$ for some $x_{0, 1} \in \mathbb{R}$. For any set C of m real numbers, the int...
I have been enjoying Pascal van Hentenryck's Discrete Optimisation course and we're in Week 4 on the wonders of Local Search algorithms for combinatorial optimisation. I'm wondering how important the initial configuration is to the quality of solution achievable in a fixed time or, somewhat equivalently, how quickly a ...
I have heard that there are sets that are not computable, but are lower in degree than the halting problem. How does this not contradict Rice's theorem? Are there any concrete examples of such sets?
If we (scientists) came up with a way of representing numerical timestamps as letters hence reducing the number of bytes needed to represent timestamps, would that mean an improvement in internet speed as less data needs to be serialized?
While trying to understand complexity I run into an example of going through records organized in following way: data = [ {"name": "category1", "files": [{"name": "file1"}, {"name": "file2"}], {"name": "category2", "files": [{"name": "file3"}] ] The task requires to go through all file records which is straight fo...
"Cookies" are a user-facing computing construct. They are codified in many technical specifications, including the earliest reference in an HTTP spec, RFC 2109, published February 1997. Many claim the use in HTTP followed from UNIX "magic cookies." Eric Raymond provided a definition of what a "magic cookie" is: Someth...
I have a Boolean formula in conjunctive normal form (CNF) $$(a\vee b \vee c) \wedge (a \vee b \vee \neg c) \wedge (x \vee y)$$ I know that this can be simplified to $(a\vee b)\wedge (x \vee y)$. Is there an algorithm to decide if a CNF is already in the reduced form or not? Is there an algorithm that can do this redu...
Is there an easy to use software that implements term-rewriting? Or do I need to write my own parser for it? I am looking for something that will take in a fixed set of user-specified rules and will be able to reduce arbitrary terms under those rules. Is there a standard tool for doing such rewrites?
Recursive class Solution { int ans; public int rangeSumBST(TreeNode root, int L, int R) { ans = 0; dfs(root, L, R); return ans; } public void dfs(TreeNode node, int L, int R) { if (node != null) { if (L <= node.val && node.val <= R) ans += no...
Merge sort always divides array of size $n$ into parts each of size $n/2$. It then merges these two parts. So its recurrence relation is $T(n)=2T(n/2) + O(n)$. What if there is an algorithm which is guaranteed to partition the array into two parts of sizes $n/100$ and $99n/100$? So its recurrence relation will be $T(n)...
Let $\chi$ be an instance space and $H \in \{0, 1\}^\chi$ a class with finite VC-dimension. For each $x \in X$ we consider $z_x\colon H \rightarrow \{0, 1\}$ s.t. $z_x(h) = h(x), \forall h \in H$. Let $Z = \{z_x:H\rightarrow\{0,1\}\mid x\in\chi\}$. Is $\mathit{VCdim}(Z)<2^{\mathit{VCdim}(H)+1}$? The only thing that co...
I have the following question : \begin{align} L_2 = \{a,k\ \mid \text{ a is a 3DNF (disjunctive normal form) and} \\ \text{there exists an assignment $z$ satisfying exactly $k$ clauses in }a\} \end{align} I know that $L_2 \in$ NPC. Show that $L_2 \in$ NP is relatively easy, I'll skip that part. I try to show that $L_2 ...
Given a sequence of integers $A_x$ of length $n$ such that $1 \leq A_x \leq N$,in one step we can remove an element, but when we remove an element we also delete all adjacent numbers which have the same value as the element we remove. We want to count the minimum number of steps to remove all elements. For example, if ...
I watched the Crash Course playlist of Computer Science. It was teaching about RAM, CPU, Storage etc but I felt it was way too fast and only people who have studied the course first hand understood it better. So I wanted to ask what CS couse actually teaches the details of CPU, RAM and how it is build from the scratch ...
Currently, I haven't learned about a functional language that can achieve the same performance as C/C++. And I have learned that some languages that favor functional programming to imperative programming, such as Scala and Rust, use imperative ways to implement their library functions for better efficiency. So here com...
Problem I'm working on an app that involves shuffling and distributing playing cards to players. As a challenge, I tried to solve this problem in a way that doesn't require a trusted intermediary. In other terms, the task is to find a distributed algorithm that uniquely assigns $n$ agents numbers $1..n$ allows each ag...
Could someone explain how to calculate the Big O notation for a runtime of a snippet of a code? for (int i=0; i<list.length; i++) { for (int j=0; j<list.length; j++) { for (int k=0; k<list.length; k++) { if (k%2==0) { list[i] += list[j]; } else { list[i]...
Formally a consensus protocol must satisfy the following three properties: Termination Eventually, every correct process decides some value. Integrity If all the correct processes proposed the same value "v", then any correct process must decide "v". Agreement Every correct process must agree on the same value. "...
I have an assignment to draw the heap after an ArrayList and a LinkedList is created. public static void main(String[] args) { List list = new ArrayList(); list.add(0); list.add(1); list.add(1); list.add(2); } and public static void main(String[] args) { List list = new LinkedList(); ...
Given a fixed dimension $d$, say $d=2$ we want the following: Input: $A_1\ldots A_m$: $m$ arrays of length $n$ of integers Each input array $A_i$ must be a permutation of the numbers $1..n$, so in each array each number from $1$ to $n$ appears exactly once. Output: For each tuple (pairs in the case $d=2$; triplets in t...
I've been pondering this question for a long time, that $a^ib^jc^k, i < j < k$ is a context-sensitive language, how we can prove it to be context sensitive or which grammar can generate such a language.
While working on a practice problem I "organically" came up with a method that does well at solving my load balancing problem. I do not know what the official name is for it, but I would like to read more on it, I think maybe it is a greedy algorithm similar to the least connections algorithm. Given m resources and n c...
Having mis-read What course in CS deals with the study of RAM, CPU, Storage? I now wonder what course in CS deals with time and space complexities including GPUs, CPU caches in multiple levels, seek times on hard disk vs. SSDs, and bandwidth to disk and RAM. I was taught the big O-notation but it never took into accoun...
Let’s make a big list of algorithms relying on abstract algebra. This will help us see how ubiquitous algebra is in algorithm design. I’ll start with two: one is the General Number Field Sieve, the other is Babai’s graph isomorphism algorithm.
I am studying Pumping Lemma for Context Free Languages, wherein, I am slightly confused in a question where one of the case doesnt obey all rules but another case does. What's the conclusion? Do we call it a contradiction and declare the language is not context free or do we say there is no contradiction? If its the fo...
I'm a student studying a data mining course and have come across a problem. I need to explain the problem with the help of an example scenario as I do not know how to explain the problem in any other way. I have n 'manufacture dates' (classes). On a particular day, y identical balls are to be segregated into these n cl...
I know, that the following is: O(n^2), int count = 0; for(int i = 0; i<array.length(); i++) { for(int j = i+1; j<array.length(); j++) { if(array[i] == array[j]) { count = count + 1; } } } But, should something like count = count + 1; be taken into account? For predicting or making up a c...
How to prove that if $G$ is an acyclic transitive digraph, then the least independent sets into which all vertices of G can be divided is equal to the size of the longest paths to $G$?
Let $G=(V,E)$ be an undirected graph. Given a pair of vertices $s,t \in V$, how can we construct a semi-streaming algorithm which determines is $s$ and $t$ are connected? Is there any way to construct such an algorithm which scans the input stream only once? Note that a semi-streaming algorithm is presented an arbitrar...
I need to take an kth index element from array like data structure and delete it (k is any possible index). Array have O(n) for deleting elements, and List have O(n) for searching element. I would like to do both operations in O(logn) time. Which data structure should I use to meet this requirement? Clarification: Dele...
I'm working on a project compiling various versions of the Bible into a dataset. For the most part versions separate verses discreetly. In some versions, however, verses are combined. Instead of verse 16, the marker will say 16-18. I wonder if, given I have a lot of other versions that separate them discretely, I can t...
I managed to find and understand algorithm for converting any $x \in \Bbb R$ from a decimal number to binary number. But I have a hard time finding an algorithm for converting a binary number with infinite bits to a decimal number. I will like to convert $(0.11001100...)_2$ to a decimal number.
So according to Wikipedia, In the Notation of [Flum and Grohe (2006)], a ''parameterized problem'' consists of a decision problem $L\subseteq\Sigma^*$ and a function $\kappa:\Sigma^*\to N$, the parameterization. The ''parameter'' of an instance $x$ is the number $\kappa(x)$. A '''kernelization''' for a parameterized p...
I got asked this question in an interview, where they showed me graphs of CPU being overused and RAM being normally used, and graphs of vice versa. What deductions can we make from this, and how can we fix both scenarios? I mentioned that this was a multiprocessing vs multithreading argument. Is this true?
Below is the lambda expression which I am finding difficult to reduce i.e. I am not able to understand how to go about this problem. (λx.λy.yx)z (λw.w) I am lost with this. if anyone could lead me in the right direction that would be much appreciated
So lets say I'm writing an algorithm that takes a vector as input. I want to know that I'm writing this algorithm correctly however so I of course write tests to see if the output equals what I expect on specific inputs. In fact I might do this for all vector sizes under a certain size, but I would never enumerate all ...
I read that for the euclidean Steiner tree problem it is known that it is NP-hard, but not known whether it is in NP or not. [Wikipedia] Shouldn't the euclidean version obviously be in NP since the metric Steiner tree problem is in NP and a non-deterministic TM that decides the metric Steiner tree problem could also de...
I figured out a solution to a recurrence relation, but I'm not sure what the constant should be for the last step to hold. $T(n)= 5T(n/4) + n^2$ Guess: $T(n) = O(n^2)$ Prove: $T(n) \leq cn^2 $ Breakdown $ T(n) \leq 5(c(n/4)^2) + n^2 $ $ = (5/16)cn^2 + n^2 $ $ \leq cn^2 $ For the last step to hold I'm not sure what the ...
Let $M_1$ be an inclusion-maximal matching in $G$ (that is, there is no matching which strictly contains it), and $M_2$ a maximum-size matching in $G$. How to prove that $|M_2| \le 2|M_1|$?
I’m attempting to write a heuristic for an implementation of A* search. The problem involves rearranging cells in a 3D grid until they match a particular solved state. I’m looking for options for a heuristic that does the following: Given a set S containing N start coordinates and a set G containing N goal coordinates,...
An SUBSET-SUM instance is a list of $n$ integers $\{ a_1, a_2,... a_n\}$. To evaluate a subset is to output the sum of a subset. However, I want to know, is it possible to create a new instance $T$, the same size as the original set $S$, that any subset in $S$ that evaluates to $W$, the corresponding subset in $T$ (the...
I have m bins (sums) and n summands. Each summand goes into a bin. In order to minimize the standard deviation, I have a greedy algorithm that appears to accomplish this. I am not sure of the name, but would like to know more. All m bins must have a sum greater than zero at the end of the algorithm. It seems simple: so...
I am trying to execute the following algorithm shown in the image from my course slide. I am trying to get the table shown in the image: 1st Iteration L2: 1:CS=A, SL = A, NSL = A L3: while NSL!=[]: true L4: L6:no children: false L17:NSL =BCDA L18:CS:=B L19:SL=BA L20, L21 2nd Iteration L3:While NSL (true) L4: L6:no ch...
We know [Ben-Or 1983] that deciding whether all elements in an array are distinct requires $\Theta(n \log(n))$ time; and this problem reduces to finding the most frequent element, so it takes $\Theta(n \log(n))$ time to find the most frequent element (assuming the domain of the array elements is not small). But what ha...
From my understanding, malloc and-the-like allocate contiguous blocks of memory. It then returns to you the start address of the memory block. This (and other things) leads to memory fragmentation where, after allocating/freeing many times, you have holes where there is unused memory that can't be accessed. I am imagin...
Let us say that I want to compute $f(x) = \sqrt{x^{2}+1}-1$ for small values of $x$ in a Marc-32 architecture. I can avoid loss of significance by rewriting the function $$f(x)=\left(\sqrt{x^{2}+1}-1\right)\left(\frac{\sqrt{x^{2}+1}+1}{\sqrt{x^{2}+1}+1}\right)=\frac{x^{2}}{\sqrt{x^{2}+1}+1}$$ Even though I can solve th...
Suppose that the problem of maximizing a real function $f$ over a certain domain $D$ is NP_HARD. What can be said about the problem of maximizing $f-g$, with $g$ being another function over $D$? Is it possible to characterize $g$ in relation to $f$ in a way that can be assured that maximizing $f-g$ is also NP-HARD?
Say you have 3 objects, a global MemoryStore, which has an array of MemorySlabCache objects, and each MemorySlabCache has an array of MemorySlab objects. Sort of like this: class MemoryStore { caches: Array<MemorySlabCache> = [] } class MemorySlabCache { size: Integer slabs: Array<MemorySlab> = [] } class Memor...
A sequence is called good if it contains at least one pair of numbers which are adjacent and equal. A good sub-sequence of an array is a sub-sequence of that array which is good and has maximal length. Now you are given two arrays $S$ and $T$ with integers. You need to find a sub-sequence which is common to both arrays...
Answer is c). I understand that the expression evaluates to true but what does signed/unsigned have to do with booleans?
Regarding this question: Rummikub algorithm. I was reading the first part of the solution in the posted answer (specifically, when there are no jokers involved, all tiles are distinct and only four colours are involved). Then, I reached the part in which the says that the algorithm runs in $O(ABCD(A+B+C+D))$ time, whic...
I've been looking into reductions to/from the TQBF language and have managed to get stuck on something that is almost certainly not true (or, if it is true I'm missing a significant computational cost associated with it) with respect to simplifying TQBF instances. For the sake of simplicity, let's restrict attention to...
The definitions I've stumbled across seem to indicate they express the same idea. That's that the relationship between record types is determined by their fields (or properties) rather than their names. Their Wikipedia pages also seem to indicate the same idea: A structural type system (or property-based type system) ...
I am trying to solve the following exercise given here. Consider the following number representation. How to define the addition? |0| = λx.x |1| = λx.λx.x ... |n + 1| = λx.|n| The successor and predecessor operators are easy to define: Succ n = λx.n Pred n = n (λx.x) An "obvious" solution for defining the addition i...
Recently, I was facing some problems in effectively proving the following : Consider the alphabet Σ ={0,1,2,...,9,#}, and the language of strings of the form x#y#z, where x,y and z are strings of digit such that when viewed as numbers, satisfy the mathematical equation x+y=z. For example, the string 123#45#168 is in t...
Consider an MDP defined as the tuple $\langle S,A,R,P,\mu,\lambda\rangle$ where $S$ is the state space, $A$ the action space, $R:S\times A\times S\to\mathbb{R}$ the reward function, $P$ the transition probabilities, $\mu$ the initial state distribution, and $\lambda$ is the discount factor. Let the decision horizon be ...
I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, ...] the index of the parent of element at index i can be found with parent index = floor((i-1)/2) I have tried to explain why it works. Can anyone help me verify this? Took reference from Why doe...