instruction
stringlengths
35
29.1k
I am taking an introductory course in complexity theory, and as an exercise, we were given the following problem. Consider the bin packing problem, with objects of positive (rational) weights $W = \{w_1, w_2, ..., w_n\}$ ($0 < w_i \leq 1 \forall i$) that should be placed in bins of capacity 1. Imagine that you are give...
From what I understand, designing an IT security systems requires to build an algorithm D which can decide whether any program M is malicious or not. That tasks looks very similar to me than deciding a non-trivial property of an arbitrary large set of programs. And as we know by Rice or diagonalization or many differen...
I have to find an unambiguous context-free grammar that generates the following language. $$L= \{ w \in \{a,b\}^+ : |w|_a = |w|_b\}$$ I think I have found the context-free one, it should be this one. $$S \to aS'bS'|bS'aS'$$ $$S' \to aS'bS' | bS'aS' | \lambda$$ Now I am stuck with proving whether it is unambiguous or no...
The first line of the Wikipedia article on Moore's law states that Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years As scientists groan on about running into the physical limits of Moore's law, another bunch of scientists[or the media?] seems to...
In my last test, our teacher gave us this question: In an conference with 90 participants, the staff wants to divide all participants in 6 groups of 15 participants each. Each participant of each group must have at least one article with exactly 7 other participants of the same group. Prove using Graph Theory th...
Prove that $L_2 = \{ w \in \{a,b\}^* \mid w = a^ib^j, i \neq j \}$ is not regular. I was wondering if my intuition holds for proving this language as not regular: Let $q = \max(i, j) - \min(i, j)$. Case 1: $i > j$ Let $$L_3 = b^q \Rightarrow L_2 \cdot L_3 = \left \{ a^ib^{j+q} \right \}=\left \{ a^ib^i \mid i \ge 0 \...
If we assume that NP is not equal to co-NP, how do we show that EXPTIME \ NP is not a subset of NP-Hard?
Suppose in an NFA we have an $\varepsilon$-move from a state $q_0$ to $q_1$. According to Sipser, Without reading any input, the machine splits into multiple copies one following each of the exiting $\varepsilon$-arrows and one staying at the current state. Then the machine proceeds nondeterministically as before. He...
I want to implement a tournament managing software , something like challonge(https://challonge.com/) and am currently stuck at the data structure to be used. I read up on tournament trees and a format like this, https://i.stack.imgur.com/UOMVI.png . The problem I am facing is in balancing it. The method works very wel...
Square braces around a grammar symbol or symbols denote that these constructs are optional. Thus, production A -> X[Y]Z has the same effect as the two productions A -> XYZ and A -> XZ. Curly braces around a grammar symbol or symbols say that these sym­bols may be repeated any number of times, including zero times. Thus...
For proving that $L$ is in NPC, why do we reduce a known $L'$ into $L$ and not the other way around i.e. reducing $L$ into $L'$.
$T(n)=4T(n/4)+\log n$ I'm solving this recurrence relation by master theorem. $a=4, b=4$ , $n^{\log_b a}=n^{\log_4 4}=n$ $f(n)=\log n=O(n^{1-\epsilon})$ when $\epsilon<1$, it is correct. So, $T(n)=\Theta(n)$. But I'm confused how can $n$ be an asymptotically tight bound of $\log n$? I'm not sure my solution is correct....
Does the associative/commutative/distributive/etc property hold for arithmetic performed with IEEE 754 floats? Obviously the answer is no to most of those questions, but do any of the properties of standard arithmetic hold? How can one formulate proofs (or at least proof-like statements) explaining why any particular p...
Well the title pretty much says it all, I've heard our professor saying that the smallest strongly-connected components in DAG (directed acyclic graph) are its vertices. Sadly I was unable to ask him for explanation and now this is stuck in my head ever since.
(I can't seem to find actual definitions of these terms anywhere, only hints and guesses). Is it fair to say, that: Virtual address space is the amount of bytes that can fit into RAM cells of all virtual addresses belonging to this virtual address space (virtual address space HAS MANY pages HAS MANY virtual addresse...
From Computational Complexity - A Modern Approach, it is claimed in a remark that the following holds true. Remark 5.5 Note that $\mathbf\Sigma_1^p = \mathbf{NP}$ and $\mathbf\Pi_1^p = \mathbf{coNP}$. More generally, for every $i \geq 1$, $\mathbf\Pi_i^p = \mathbf{co\Sigma}_i^p = \{ \overline{L} : L \in \mathbf\Sigma_...
Prove or disprove: The following language $L$ is decidable: $\{ \langle M, x\rangle: M \text{ is a Turing machine and } M(x) \text{ halts in less than } |x|^2 \text{ steps} \}$ So for proving I need to construct a TM $U$ if it accepts $L$, so $L$ is decidable, otherwise not. My steps are: $U$ = "On input $ \langle M, x...
Prove or disprove: The following language $L$ is decidable: $\{ \langle M, t\rangle: M \text{ is a Turing machine and } \forall w \in \{0,1\}^* [M(w) \text{ halts in at most } t \text{ steps} ]\}$ So for proving I need to construct a TM $U$. If it accepts $L$, so L is decidable, otherwise not. My steps are: $U$ = "On i...
Three processes A B C. When conducting the safety algorithm, no explanation that I've been able to find answers the question of how the processes are being compared. Is it the total processes added up, or every process individually must pass the '<=' operator, or is it like regular integers where Process A would be th...
Is $L=\{\langle M\rangle\mid \text{$M$ is a Turing machine and $L(M)$ is uncountable}\}$ decidable? My intuition is that it is not, but I'm not sure if Rice's Theorem applies in this case. If it is not decidable, how can I prove that using reducibility?
Is L = $\{\langle M,w\rangle \mid \text{$M$ accepts string epsilon or string $w$, or both} \}$ decidable? I attempted to use Rice's Theorem for this question to prove that it is undecidable. Is my approach in the right direction if I let S, the non-trivial subset of recognizable languages, in this case to be S = {L | ...
Suppose we have random lines made with 2 points. and point has (x,y) For example: Now when we draw a random line you will see many lines intersect with each other. This eventually gives rise to bounded regions. How to find the vertex points for each bounded region? My approach: First we find all the intersection point...
In some code I'm currently writing, I'm stuck on the following algorithm to implement. The goal is to find real world users using multiple different accounts. I've a List of UserData. This list is pretty big (> 10M entries) A UserData is defined as: { userId, List<TimeSegments> }. A TimeSegment is {connectionDate, dis...
I'm doing research for a system that is based on rules. The goal of the system is to fire when some of the rules are true. Explanation (requirements/working of the algorithm): The algorithm will run in the background of an app. There will be a lot of data available about the user. The algorithm will apply the defined ...
If you have directed and unweighted graph G how could you find a path from node s to node t that also goes through another node w? This could be a non-simple path.
Does anyone keep a database of (or including) linear codes with small covering radius? I'm specifically interested in the smallest-dimension codes known of covering radius R ($2\le R \le 4$ say) for each codimension (up to codimension 10 or 12) over various small fields, especially $\mathbb{F}_3$, $\mathbb{F}_5$ and m...
Let $G = (V, E)$ be a weighted, directed graph with weight function $w : E \to R$, and let $s \in V$ be a source vertex. Assume that G does not contain a negative cycle reachable from $s$. Then, if we execute relaxation steps resulting in $d[v] = \delta(s, v)$ for all $v \in V$ . Then the predecessor subgraph $G_\pi$ i...
I was reading an article and I saw this one: 'under the Exponential Time Hypothesis, Split Contraction cannot be solved in time $2^{o(l^{2})}\cdot n^{O(1)}$ where $l$ is the vertex cover number of the input graph'. And next. 'it is easy to see that Split Contraction can be solved in time $2^{O(n\log n)}$'. Could you p...
How would you prove that product of two fully time constructible functions is fully time constructible? I managed to prove for sum, but product seems more complicated
Intuitively it would seem like these equalities are false since DTIME(n) and DSPACE(N) are in terms of deterministic Turing machines and NP is non-deterministic, but I'm struggling to come up with a convicing argument as to why this is. I'm assuming that both the Time and Space Hierarchy Thoerems must be used but I'm j...
I recently came across this question in my textbook. $ \text{Let } L \text{ be a language over an alphabet } \Sigma \text{ that is accepted by some FSA.} $ $ \text{Prove that the language is also accepted by some FSA.} $ $ \operatorname{Max}(L) = \{x \in L : \forall y \in \Sigma^* - \{ \lambda \}.\ xy \notin L \}....
I have been stumped on the following question for a few hours now, I feel like I am missing some "aha" moment. $\text{Suppose that } \{ a^nb^n : n \ge 1 \} \text{ is non-regular.}$ $\text{Prove using closure results that } \{ 0^i10^i : i \ge 1 \} \text{ is non-regular.}$ Starting off I assumed for contradiction tha...
Given a grammar for a space delimited list of words: S -> word { space word } word -> [a-zA-Z]+ space -> [ \t]+ And given the input "Hello World", what token would a peek() operation return?
I have written a program which contains a while loop: while k < sqrt(n), so clearly my program evaluates $\sqrt{n}$ at each iteration of the while loop. (Note that $n$ and $k$ can both change throughout the loop, although I do not think that this is relevant to the question.) I am required to calculate the number of ar...
If this is not the right forum for this question let me know. I am looking for a physical algorithm that can be easily followed by anyone not knowing much mathematics to get integer partitions of a number. I have come up with the following way - but there is an issue (described later). Suppose I want to divide number 1...
In a previous post, I have asked: Generally speaking, an algorithm takes some inputs and provides some output. I would like to understand how the algorithm performs when the inputs are incomplete for various real-world reasons. Are there any papers on this issue? As a specific example, suppose *the seller wants to sell...
Suppose I have the expression $abcdef$ and I want a combinator $X$ that does this: $Xabcdef=a(bcd)(ef)$. Is it possible to express $X$ using just the $B$ combinator, defined by $Babc=a(bc)$? Is this possible in general? That is, if I have a string of letters without brackets, is there always a combinator in terms of $B...
I am studying computer architectures in university and my teacher asked me if we can create a computer without PC/IP register?
From Wikipedia: In computer engineering, microarchitecture, also called computer organization and sometimes abbreviated as µarch or uarch, is the way a given instruction set architecture (ISA), is implemented in a particular processor. Computer architecture is the combination of microarchitecture and instruction set. ...
i have to calculate the average branching factor of the given successor function(pseudo-code) for every $m,n \in N$: succ (x,y) = {(x-1 `mod` m, y), (x+1 `mod` m, y), (x, y-1 `mod` n), (x, y+1 `mod` n)} with $n \geq m^{2}+2, n \geq 1$ and {} represent a mathematical set. What i know is that the average branching facto...
Let's say we have millions of strings (each of them < 100 characters): alpha allo blah hello world orlando ... I know how a binary search tree or a trie can help to do "prefix search" (example: find all strings that match al*, i.e. beginning with al). Which data structure / algorithm could be used to search patterns ...
First of all, a definition of the operations: Insert by index: insert element e at index n, increasing the index of all subsequent elements, Delete by index: delete element at index n, decreasing the index of all subsequent elements, Access by index: access element at index n. The interface, therefore, is that of a D...
Any ideas for proving that $L=\{\langle T \rangle : \text{ time complexity of $T$ is polynomial}\}$ is not Turing-recognizable?
Is there a simple example of a monotone Boolean function $f:\{0,1\}^m \to \{0,1\}$ that we know can be computed by a polynomial-size circuit, but cannot be computed by any polynomial-size monotone circuit? Ideally, I'd be especially interested in a simple example where there is an exponential gap between the size of t...
In theory of distributed systems, I understand message complexity and time complexity are common performance measures, with the first being the number of messages sent in the overall execution of the algorithm, and the time being the number of "steps" it takes to complete the algorithm. My question is, with asynchrono...
A good exercise is to show $NC^1 \subseteq L$. (According to the complexity zoo page this was first shown by Borodin, 1977.) Although the details must be checked, the proof is simple: take the $NC^1$ circuit and do depth-first-search on the output gate of the circuit. Recursively evaluating the gates in the circuit wor...
If a pointer specifies a point in memory, would the amount of space a pointer takes not be dependent on how much memory it could possibly range over? So for example, if we have 4 locations of memory and a pointer, then the pointer can be 2 bits, but if we have $2^k$, we will need $k$ bits. My confusion stems from peopl...
The multiple choice knapsack problem (MCKP) can be defined as follows: MCKP is known to be NP-hard in general. I have a special case of MCKP for which $N_i=\{1,2,\cdots,|N_i|\}$, for all $1\leqslant i\leqslant k$ ; $p_{ij}=j$, for all $1\leqslant i\leqslant k$ and for all $1\leqslant j\leqslant|N_i|$; and $w_{i1}<w_...
Users can be assigned to one experiment on my site. I have an API that developers use to trigger logic for each experiment. They call ExperimentEngine.run() to trigger the code logic for the experiment. I would like to allocate users to each experiment, at the point where a user might be exposed to the logic for that e...
I don't understand how linked list insertion is constant time. The larger the list gets, the more bits are required to specify memory locations, and then the more bits that must be edited to account for changes in pointers. Where is my mistake here?
From Wikipedia, a symmetric matrix is a square matrix that is equal to its transpose. An example of this (I think) is an adjacency matrix with undirected edges, which is a square matrix representing links between elements (undirected in this case). The thing is, the data is duplicated in this case (looking at it from a...
Given a B+tree indexing scheme, wondering how a database actually goes and finds records matching a range query such as the following: CREATE TABLE foo ( x int, y int ) SELECT * FROM foo WHERE x > 10 AND x < 100 AND y > 20 AND y < 200 From my understanding this would require 2 b+trees, one for each property...
What is an algorithm that will take as an input a flat list of objects with a varying degree of overlapping properties: thing1 (instance of "Mammal", but we don't know this now) -eatsFood -reproduces -hasMilk thing2 (instance of "Emu", but we don't know this now) -eatsFood -reproduces -laysEggs -hasFeath...
Can AVL trees be interned for fast equality comparison? Is there work on interning data-structures or can you show that this cannot be done in better than $O(n)$ time? I recently implemented a rope data structure in Lua as an AVL tree. However, I realized a since the ropes are not interned, they can't be used efficien...
I was studying branch prediction & predication execution and faced a trouble.. I'm not quite sure whether I understood the concept of predication but based on what I have learned it is taking both taken and not taken at the same time. For example, let's assume we have 'if' and 'else' each filled with 3 instructions. Fo...
As the title suggests, I'm trying to implement an algorithm to decompose a polygon into the minimum number of star-shaped polygons. I've been searching for quite some time but I can't find any algorithms or even anything theoretical to study on this problem online. The closest I found is decomposition to the minimum nu...
In Wikipedia, it says the transdichotomous model is a variation of the random access machine in which the machine word size is assumed to match the problem size. However, a random access machine is by definition a register machine, whose registers can store any non-negative number. In addition, the concept of "word" ...
Using the elevator algorithm for processing disk requests, suppose requests arrive in the order: 8, 36, 34, 12.... (These numbers are cylinder numbers). Suppose the direction is UP meaning that the arm is taking on higher requests. Here we can see that both 36 and 34 are higher requests but 36 comes before 34, So, I'm...
I'm facing a problem described as follows: You are given a set of $n$ types of rectangular 3-D boxes, where the i-th box has height $h_i$, width $w_i$, depth $d_i$ and value $v_i$. You want to create a stack of boxes with a height limit $H$ and maximize the sum of the values, but you can only stack a box on top of anot...
So i need to draw a DFA for this language, i know i need to separate for 2 DFAs and than combine them both. What is the approach ? How do i do the $\Sigma^*$ inside the DFA ? The 0100 condition is kinda easy, also the 11 language.
I am not sure what problem may reduce to $3$-Spanning-Tree where $3$-Spanning-Tree is defined as a decision problem which given an undirected graph $G$ determines if there is a spanning tree of $G$ in which every vertex has degree no larger than $3$. I have already done this for $2$-Spanning-Tree using a reduction from...
There is a theorem that states that if A is polynomially reducible to B and B is in P, then A will be in P. Now, would that hold for NP problems? Simply, since coming out with verifiers all the time might be a longer/trickier task if there is a actually an easier way to to prove something is in NP.
There is paper which expresses lambda terms in the terms of logic programming http://www.cse.unt.edu/~tarau/teaching/PL/docs/dbx.pdf Is there conversion in the other direction - expressing definite clauses / Horn rules / logic programming sentences using the lambda terms and type calculus? This question has the followi...
I am trying to understand how computers work under the hood, and I came across following sentence. "Computer technology is based on electronic circuits able to process vectors of 0's and 1's. For that reason all data are encoded by strings of 0's and 1's." So does the vector mean normal string/number 0 and 1? Thank yo...
I was studying the chapter 24 of the CLRS and got to the following question: 24.1-5 $\star$ Let $G=(V,E)$ be a weighted, directed graph with weight function $w : E \rightarrow \mathbb{R}$. Give an $O(VE)$-time algorithm to find, for each vertex $v \in V$, the value $\delta^{*}(v) = \min_{u \in V}\{\delta(u,v)\}$. F...
I have a question about predication and branch prediction. I've emailed my professor regarding this and he replied me that predication has a less instructions than branch prediction. So I tried making an example of my on but I'm not sure if this is right.. I've assumed for predication it has 'if' and 'else' each having...
Let Program P be :"Generate, in lexicographic order, all sequences with k ones and n bit length; Of these sequences, print the ith sequence." Apparently the length of this program is $\log(n) + \log(\binom{n}{k}) + c$ where $c$ is a constant. Where $i$ can be represented in $\log(n)$ bits and k in $\log(\binom{n}{k})$...
how to use substitute algorithm to prove T(n) =4T(n/2) + n^2 compact lower bound. this is a algorithm of my class home work,but i dont know how to solve it.
(x >= 0 && y >= 0) q = 0; r = x; while ( r >=y ) { r = r - y; q = q + 1; } (x = q*y +r) && (r >= 0) && (r < y) For this what if y = 0 ? If y = 0, then r stays at r inside the while loop, which makes r >= y true always. So it doesn't seem to terminate. So I think, for pre-condition, doesn't it have to be (y > 0)...
I am just starting to study Java and was wondering why the following code if(x>2) x*=2; if(x>4)x=0; System.out.println(x); returns 0 for any value of x greater than 2. For example, when x=3, why would 6 not be returned?
I have the function: $$ f(n) = \begin {cases} 4 & , n = 1 \\ f(\frac{n}{3}) + n^2 -3 & , n \ge2 \end {cases} $$ The given solutions shows the unwinding of the function as follows: Assuming $ n \ge 2$ $$f(n) = f\bigg(\frac{n}{3}\bigg) + n^2 - 3$$ $$ = \bigg[f\bigg(\frac{n}{3}\bigg) + \bigg(\frac{n}{3}\bigg)^2 -3\bigg]...
Wondering if there is a way to convert a binary tree into a grid such as this: a / \ b c / \ / \ d e f g or d--b--e | a |...
I am simplifying a big formula to find the big notation of a certain algorithm. The expression is: $$\log_2(1-l)/\log_2(1-2^{nH(m/n)-n})$$ where $0.98<l< 1$, $0<m<n/2$, $n>0$ and $H$ is the binary entropy function. In practice, I known that the algorithm is exponential, but I do not known how simplify that to get the ...
I need to find average number of recursive calls in quick-sort with array of length 2. I established and solved the following recursion: $$T_N = \frac{1}{N}\sum_{k=1}^N\left(T_{k-1}+N_{N-k}\right) = \frac{N+1}{N}T_{N-1} = \frac{N+1}{3}.$$ Where $T_0 = T_1 = 0, T_2 = 1$. But: \begin{align*} T_3 &= 1/3(1 + 1) &= 2/3\\ T_...
Sipser in his book provided the following proof for undecidability of REGULAR$_{TM}$: S = “On input $<M,w>$, where $M$ is a TM and w is a string: Construct the following TM $M_2$. $M_2$= “On input $x$: If $x$ has the form $0^n1^n$, accept . If $x $ does not have this form, run $M$ on input $w$ and accept if $M$ a...
i have been solving the Time-Dependent Traveling Salesman Problem using an Ant Colony Optimization. Upon reading the ACO papers, there are several reminders which state that ACO performs best with daemon actions - improvement heuristics. In the classical TSP, the most common improvement heuristic used is the k-opt exc...
I have the impression that for every NP-complete problem, for infinitely many input sizes $n$, the number of yes-instances over all possible inputs of size $n$, is (at least) exponential in $n$. Is this true? Can it be proven (probably only under the assumption that $P\neq NP$)? Or can we, maybe artificially, find a pr...
Theoretically, Hoare-Logic let's one prove the correctness of an algorithm, given pre- and post-condition. However, as far as I've seen it so far, one idealizes his data-types to a mathematical set like $\mathbb{N}$ or $\mathbb{R}$. So, even though the logic might be sound in Hoare-calculus, the discrepancies between ...
The PCP theorem characterizes NP as the class of problems checkable probabilistically using log(n) bits and a constant number of random bits and yields $NP=PCP(O(log(n)),O(1))$ . Is there a pair $(f,g)$ of functions such that $P=PCP(O(f(n)),O(g(n))$ where $g(n) \ne 0$? Or is there any research in that direction or an ...
Let's say we have given weighted tree of size $n$ and list of important nodes in the tree $k$. We want to choose subset of edges of the tree such that: For each two important nodes at least one edge of the path between them will be choosen The sum of the subset of edges will be minimized Note that we only need to fin...
How to generate a numeric or string id(not very large text) for a sequence of elements where ordering doesn't matter. Example: [41,1001,32] should generate the same ID as [32,1001,41] [41,1001,32, 5] should be different. Elements could be hundreds where each individual ID can be a 4/5-digit number. I thought about...
Specifically, many say that to speed up an HTTP routing code going from regex to a Trie is the solution. Sometimes also a compressed Trie or Radix Tree. The problem though is that after reading everything I think I could read from Wikipedia to blog articles and even Stack Exchange answers I couldn't wrap my head on ho...
I found that there are algorithms like VFlib and LAD filtering for subgraph isomorphism with one edge type. For multiple node types,one idea could be color all node types with the same type and use colored sub-graph isomorphism which is available for VFlib. I was wondering is there any algo specifically for multiple ed...
Specifically when it comes to R-Type instructions, the format is operand, sR1, sR2, dR where sR1, sR2 are source registers and dR is the destination register. What I don't understand is why the operation ADD, R1, R2, R3 results in the sum of R2 and R3 being stored in R1. If R1 and R2 are the 'source registers' then...
Given an array $A$, find the number of pairs $(i, j)$, such that $ i > j$ and $A[i] \ge A[j]$. This is a modified version of the famous problem of Counting Inversions, only in this version it allows the elements to be equal as well. I have an algorithm for the classical counting inversions problem implemented, so i´d...
I have a system which uses segmented paging. Every address is divided as follows: (s,p,d) = 2,2,11. Main memory has a capacity of 32KB. There are 4 segments which have 4 virtual pages each. I have to find the number of physical and virtual pages. For the virtual pages i suppose that the answer is 16 because every segm...
We know that $EXPTIME ⊆ NEXPTIME ⊆ EXPSPACE$, where $EXPSPACE = DSPACE(2^{poly(n)})$. Question: Is known any consequences of $EXPTIME \neq EXPSPACE$? (nothing in complexity zoo or wikipedia)
Does $P=NP$ implies $3SAT$ reduces to $2SAT$? If so then from $2SAT$ is $NL$-complete can we conclude $NP=NL$?
We are currently developing an ilp/milp model to fit the best routes with given resources (people) in a given timeframe and given visits and costs to travel from one visit to another (asymetrical). We went with a very simple aproach (make a cube person x visit x Time and add constraints from here on). Our solution work...
I am trying to understand basic concepts such as MIPS rate, frequency, CPI etc. But I am having some trouble understanding the details. For example suppose a processor designer builds a processor with frequncy 200 kHz and furthermore let's suppose that the processor has MIPS of 0.2. In what ways can that design be acco...
The stack seems to be an optimization of memory use for a specific application. Whereas the heap is a general model that works in all cases. Wondering if there are any other types of models of computer memory allocation that are optimized for different use cases. Following from this: https://softwareengineering.stackex...
I am a little confused on how to approach this problem. I am unsure how to construct both parts of the grammar using a context-free grammar. This is as far as I got, but this will end up producing a's inside of the group of b's and a's. I'm not sure how to add the second group of a's to the right of the b's. $S \right...
Tendermint Consensus is resilient for up to 1/3 of Byzantine participants. Question: What actually happens after when the network hits the threshold of byzantine actors? Forking happens? Does transaction fails for honest nodes? Similarly, for all the BFT/PBFT consensus algorithm, what happens after when the network hi...
I'm asking because it seems that P problems refer to decision problems rather than actually propose a solution.
Below is a paragraph from a book. In an ordinary superscalar processor, we would use branch prediction to guess which of the given instructions is to be executed, and go down that path. If the processor guesses wrong, the pipeline must be flushed. Predication execute all of instructions and once the values of the pred...
I've been studying the low-level hardware implementations of floating point numbers and doing an exercise to design a custom floating point implementation. I know that being able to represent negative zero is important for some purposes, but ran across a curious question. Complex numbers are generally represented by tw...
In a Operating System, who decides which parts of a program (or task) has to be stored in the virtual memory and which in the RAM ?
This is an attempt to understand better recursion. The following recursive function returns the integer obtained by reversing the digits of an input integer. I'm trying to prove its correctness: public static int reverse(int n) { return reverse(n, 0); } public static int reverse(int number, int reverted) { if (...
I've been back and forth about this one. I have the following theoretical homework problem, which describes the SET-INTERSECTION problem. In my homework, it's presented as being NP-complete. Does this problem have a more common name in general Computer Science nomenclature? I'm trying to wrap my head around the defini...
I have a fully-connected graph $G=(V,E)$ with edge weights $w(v)\in\mathbb{R};v\in V$ and I need to find a spanning tree $T=(V_t\subseteq V,E_t\subseteq E)$ where the set of edge weights in the tree have as close as possible to equal separation. We quantify the notion of equal separation by minimizing the variance of d...