instruction
stringlengths
35
29.1k
I have been presented a set of FridgeIQ by a friend and she has planted an idea in my head. FridgeIQ is a geometric disection puzzle consisting of 16 polygonal tiles as seen in the terrible picture near the bottom of this post The shapes of the tiles are based on a square grid with the occasional diagonal across one of...
As any tree can be described as a binary sequence ($i$-th bit is 0 if the edge goes down and 1 otherwise, every edge is travelled twice $-$ up and down, so such sequence's length is $2 |V| - 2$), any tree of size $n$ can be encoded as $O\left(\frac{n}{\log n}\right)$ integers (assuming an integer holds $\log n$ bits in...
Let us suppose the best case running time of an algorithm is $\Theta(n \log n)$. Can the average case run time of the algorithm be $O(n \log n)$? Since $O(n\log n)$ would imply the value going even below $n \log n$ hence would be lower than the best case bound of $\Theta(n \log n)$. Is this possible?
I have a vey specific question regarding the pumping lemma in the context of regular languages. The theorem states that if $L$ is a regular language, then there exists a constant $n$ such that for every string $w$ in L, with $|w|\geq n$, $w$ can be broken into $w=xyz$ with the following properties: $|y|>0$ $|xy|\leq n...
I am trying to figure out the time complexity of a heuristical algorithm used to solve the Travelling Salesman Problem in a more efficient way than by brute force, ($\theta(n!)$ or similar) The first step is to compute Kruskal's Minimum Spanning Tree, which to my best knowledge is of $\theta(E+V)$, where E is the nu...
I'm new to Computation Theory and trying to figure out the undecidability problems. Last night, I came up with the language of TM with a useless state: $\text{USELESS_TM} = \{ \langle M, q \rangle\mid q\text{ is a useless state in TM }M\}$ where q is a state that M never enters on any input w. The problem is simply d...
As far as I'm aware, EXPSPACE is the most inclusive computational complexity class. I was wondering if/how people conceptualize supersets of EXPSPACE. Thinking about this question, I came up with a couple thoughts of my own: Maybe EXPSPACE = the set of all Recursively Enumerable problems, i.e. $\Delta_1$ in the arithm...
I know it is possible to convert LTL formulas to Büchi automatons. But is it possible to convert a LTL formula to a deterministic Büchi automaton? Are there formulas that can't be converted to a deterministic Büchi automaton, then why not? Do you have examples for that case?
I'm trying to find a method to randomly split a connected planar graph $G$ into two connected components, such that the sum of the weights of vertices in each component are relatively close. (If there is a >10% difference difference, the split is simply not considered valid.) Additionally, I want to be able to calculat...
I've read that a Declarative language is called "stateless". This means that we can imagine that internally every variable is a constant variable, and it never get reassigned ( in contrast with what usually happens in procedural programming). How can this work?
I computed the first four eigenvalues of a quite large ($2^{24}\times 2^{24}$) but very sparse matrix. I used pythons in-build function sparse.linalg.eigsh to compute them. I need a validation that the results are correct up to an error of at most $10^{-3}$. Very specifically I want to ask if there is a rigorous error-...
Okay, I’ve done a lot of research on this, but I can’t seem to wrap my head around it. Essentially, the question is as follows: How can an operating system prevent a machine instruction from a user-level program (Firefox, Word, etc.) from accessing memory locations that it isn’t supposed to access? Here’s what I think ...
My goal is to formulate the learning and generalization phases of any Boosting algorithm as a matrix-vector operation. Through Google, I found a good pdf (*) describing several boosting algorithms but the author Marco Cusumano-Towner only hints and doesn't explain how to recast the boosting algorithms (GradientBoost, A...
Suppose we have a list of buckets, each with a unique type and a maximum capaciy. We also have a list of items, each with a value and a list of compatible bucket types. An item is compatible with a bucket type iff the item is able to be inserted into a bucket of that type. The goal is to insert the items into the bucke...
Functors in category theory, and also in its application to functional programming, can be seen as a kind of "structured" functions: Given two sets $A,B$, rather than just having a function $f:A\to B$, we have a functor $F$ which contains $f$, but additionally also maps morphisms on $A$ to morphisms on $B$ (i.e. maps n...
sorry i haven't found a good title for these three questions i'm wondering if someone could give me explaination with proof (if possible ) of these three questions : Given a grey-level image stored as a rectangular array of grey-level values, describe what the mean and median filters with an n x n kernel (neighborho...
Please take this question with a grain of salt. I'm trying to write a very simple layout engine and wanted to formally create a grammar to parse the input. I stayed up all night researching LL(k) parsers - mostly from papers from different colleges. They tend to use the same examples and I've never been a fan of abstra...
Please help me understand on how to prove or disprove the following. I have been practicing and doing others which are ok, but with this sum, it is rather confusing. $$\sum_{i=1}^n i \in \Theta(n^2). $$
I have a set of $N$ different values, and my goal is to find the biggest one in the least number of comparisons. Comparing subsets (using the sum of each) is also allowed, and counts as one comparison. The intuitive algorithm would be comparing them linearly: compare two items, compare the biggest with the next one, re...
I have an exercise problem and don't know why its answer is like this. $$ \sum_{i=1}^{\lg n} 2^{i-1} \in \Theta(2^{\lg n}) = \Theta(n). $$ Regarding this equation, I think it would be, $$ \sum_{i=1}^{\lg n} 2^{i-1} \in \Theta(\lg n \cdot 2^{\lg n}) = \Theta(\lg n \cdot n), $$ with the proof, $$ \sum_{i=1}^{g(n)}f(i)...
Hi i want to convert random number with uniform distribution to desired distribution using arithmetic coding. It has been done in the following research paper called arithmetic distribution coding available in the following research paper. https://arxiv.org/pdf/1408.3931.pdf Kindly can any one guide me how come arithm...
This problem is from a coding competition ( Website Here ) in Mexico that does not provide solutions and has me stuck. Consider the following automata: Every state $B_k$ is an array of fixed length $n$ such that $B_k[i]$ an integer for all $0\leq i \leq n-1$ The state $B_k$ can be obtained from the state $B_{k-1}$ as f...
I've been struggling for a while trying to solve this problem: Show that the following problem is in $\mathbf{NP}$: Check that a system of linear equations with $m$ integer variables and integer coefficients has no solution. Let $L = \{\langle A, b \rangle\ |\ A \in \mathbb{Z}^m\times\mathbb{Z}^m\text{ and }Ax = b...
Are there any existing algorithms/strategies to test if an integer value is within the bounds of any of a list of intervals, where each interval is denoted by a [min, max] pair? The naive approach is very straightforward, but has O(intervals) test performance: list intervals (min, max) func testVal(val){ foreach (in...
I have an undirected graph with weighted edges. I want to color the vertices with a given $k$ colors. Let's assume there is no proper coloring with $k$ colors such that adjacent nodes will always have different colors. I want to find the improper color assignments that would minimize the sum of weights of edges between...
The language $$ L_1 = \{w \in \{0, 1\}^\ast \mid \exists x \in \{0, 1\}^\ast\colon M_w(x) = x\} $$ ($w$ is an encoding of a DTM, $M_w$ is the respective DTM.) is not decidable, according to Rice's theorem. However, it is recursively enumerable: an NTM simply chooses an $x$ for which the condition is fulfilled non-deter...
I've been reading the basic paxos algorithm from the "Paxos Made Simple" paper. I can't understand how paxos algorithm maintains the safety properties under partial failures of the accept messages, meaning cases where the proposer receives prepare responses from a majority, but the subsequent accept message does not re...
A much much weaker idea similar to the P=NP question, is there a decision problem that can be verified in $O(n^2)$ time, but it can be proven that there is no algorithm that decides it $O(n^2)$ time?
If we are given an A$^*$ path search with some heuristic $h$ that yields an optimal path, without knowing that the heuristic is admissible beforehand, would this imply that $h$ is admissible?
According to this Wikipedia article on unary language every unary language has a binary variant. My question is that given a unary language is there an equivalent binary language in P that is P-Complete.
I want to be able to reduce the 3SAT problem to a flavor of set-splitting problem. Basically, given $n$ items and $m$ subsets $S_1, S_2,...,S_m$ of these items I want a yes or no answer based upon the fact if it is possible to color the items red and blue so that each set $S_i$ contains at least one red item and at lea...
As you can see in this tree its unbalanced at the root with a balanced factor of $-2$. You can also perform a Right left rotation or a Right Right rotation. Which do you have to pick in this case?
I'm looking for a solution which can able to identify the any row or column addition or deletion in a table of numbers. What I have thought of as of now by using the LCS i.e. "Longest common sub-sequence" algorithm I can find out the common sub-sequence between two versions of a table but this method is not 100% correc...
I have the following problem: There are n entities (persons) having a common attribute (weight) and I need to build weight categories (this is for a sports event) grouping people based on their weight. The weight of the people in one group should be as equal as possible. Problem/Opportunity is that the group size can v...
I am trying to do the following: Interprete RGB color values as a 3-D vektor Transform the RGB color into polar coordinates L, teta and phi Create colors with constant L The math behind this is the standard transformation into spherical coordinates: b = L * Sin(teta) * Cos(phi) r = L * Sin(teta) * Sin(phi) g = L *...
I encountered an issue at work that can be derived approximatively to this problem. Let say we have a machine that can be triggered to instantly do an action. There are several (between 10 to 15) possible triggering times per day. I have to select exactly 5 times per day (between 00:00 a.m. and 12:00 p.m) to respect th...
Taken from site "Geeks For Geeks". The lemma: "A concatenation of pattern(regular) and a non-pattern(not-regular) is also not regular language." example: $\left \{L={a^{n}b^{2m}|n\geq 1,m\geq 1} \right \}$ I think I managed to build dfa (q2 is an accepting state) for language. perhaps I'm wrong...
The original question was in the context of an array, but I just used a list without changing the length for easier debugging purposes of toString(). Given an unsorted list of integers, design a O(n) algorithm to transform the list such that the integers are replaced by the next bigger integer on their right. If there...
Suppose we're given the non-deterministic PDA shown below which reads from the alphabet $\sum = \lbrace a,b \rbrace$. How will this PDA behave if we pass it the string $ba$? We read $b$ first and push $b$ to the stack, but when we read $a$ I get confused. My assumption is that we fork into two new branches - one in whi...
Is the following true or false? Why? Let $Y$ denote the complement of the tautology problem. If a problem X is NP-hard, then there is a polynomial-time (many-one) reduction of $Y \leq_{p} X$.
Is the following true or false? Why? Let L be a context-free language with $\epsilon\notin$ L. Then there is $\epsilon$-free grammar $G=(V,\Sigma, P,S )$ with $L (G) = L$, so all production rules are of form $A \to BCD$ or $A\to a$ with $A, B, C, D \in V$ and $a\in$ $\Sigma$. I don't know normal forms for context-free ...
In my theory of computing class, we've been talking about how to prove languages regular and non-regular. I've heard of methods like the pumping lemma and Kolmogorov complexity to prove languages non-regular, while proving languages regular revolves around building a DFA, or using the Myhill-Nerode theorem. All of thes...
Is there an efficient method of sampling an n-choose-k combination at random (with uniform probability, for example)? I have read this question but it asks for generations of all combinations, not combinations at random. I general I'm aware of rejection sampling, however it's very inefficient. I also came across reserv...
The following variation on the vertex cover problem was given: Given is an instance of graph $G = (V, E)$. Does $G$ have a vertex cover of size at most $\frac{|V|}{4}$? I was asked to prove that this problem is also $\mathsf{NP}$-hard. I am pretty sure that this can be done by using Karp-reduction from the original v...
I'm new to this forum. I have some difficulties on using Pumping Lemma to prove non-CF language. Let $L=\{a^ib^kc^k : i\geq k\geq 1\}$ and the followings are my attempt. Proof. Suppose by contradiction that $L$ is a context-free language. Let $p$ be the constant given by the P.L. We choose a string $s=a^pb^pc^p$. Ass...
The language $$L = \{x^r \# y | x, y \in \{a, b, c\}^*\\ \text{ and }x\text{ is a contiguous sub-string of }y\}$$ where $x ^ r$ denotes the backward written word x, is context-free. Can someone explain, if this statement is true? I am not able to construct a PDA, so I think the language is not context-free. Does any...
Let P $ \neq $ NP. D is in the complexity class co-NP. B is in the complexity class P. Let $ \bar{D} $ be the complement of D, then $\bar{D} $ $\leq _ {p} $ B. Is this statement true or false? My guess is that it's wrong because D is $ \in $ co-NP and therefore $\bar{D} $ is $ \in $ NP. From the reduction $\bar{D}$ $ \...
There are many great references for computer scientists interested in untyped first order logic, such as Melvin Fitting's "First-Order Logic and Automated Theorem Proving" or John Harrison's "Handbook of Practical Logic and Automated Reasoning". However, I have been having difficulty finding a solid reference that spec...
Initial Bubble sort pseudocode(Typical): 1)foreach Element in array 2) initialise a flag that flips whenever a swap is done 3) Starting from the element, attempt to swap and update flag 4) If no swap is done, i.e flag remains true, break We can improve the sorting algorithm further as values that are already sorted ...
Ususally a grid pattern (circles or squares) is used for camera calibration. Features (circles or corners) are detected in a function (e.g. findCirclesGrid in OpenCV) and passed to the a camera calibration function (e.g. calibrateCamera in OpenCV) together with corresponding object points (object coordinates). Is it ...
I want to give a grammar for the following language: $$L = \{x^r \# y |x, y \in \{a, b, c\}^*\\ \text{ and }x\text{ is a contiguous sub-string of }y\}$$ where $x ^ r$ denotes the backward written word $x$ I have tried the grammar, is this right or have I made a mistake: $S \to Sa \mid Sb \mid Sc \mid T$, $T \to aTa \m...
Prove: $\left \{ 0^{n}1^{m} \mid (n-m) \bmod 5=0 \right \}$ is regular. Is it reasonable to get a DFA with at least 30 states for this language? is there an easier way to prove it is regular?
Let $T : \mathbb N \to \mathbb N$ be some computable function. Then by $\mathcal C_T$ we denote the class of languages decidable by a deterministic Turing machine in at most $T(|w|)$ steps for an input $w$. In On the Computational Complexity of Algorithms by J.Hartmanis and R.E. Stearns it is stated that $\mathcal C_T...
A link of capacity 100 Mbps is carrying traffic from a number of sources. Each source generates an on-off traffic stream;when the source is on, the rate of traffic is 10 Mbps, and when the source is off, the rate of traffic is zero. The duty cycle,which is the ratio of on-time to off-time, is 1 : 2Assuming that all sou...
I am new to the concepts of recursion, backtracking and dynamic programming. I am having a hard time understanding if at all I can apply memoization to a particular recursive algorithm and if there is a relation between memoization being applicable ONLY to top down recursive algorithms. Any explanation on the same wo...
It's well known that 3-SAT is in NP, which means that one can evaluate a 3-CNF formula in polynomial time. However, I was wondering what the tightest upper bound is for formula verification, expressed in big-O notation or some other way. My best guess is that 3-CNF formulas can be verified in linear time in the number ...
These are the only ones I have been able to find online: Pulley Logic Gates Marble adding machine MARBLE COMPUTER LOGICAL AND GATE I would like to find some more discrete models like these (as opposed to say, water logic gates or things like that). Not sure if there is a library of different techniques to build logic...
What would be the line by line analaysis and construction function T[n] with Big Oh notation? Thanks a lot.
I am a self-taught in computer science. I am interested on have a robust test book on which study the nut and bolt of application deployment. I mean all the processes involved in getting new software up and running properly in a given network. (entry point, rest interfaces etc etc) I went through books of computer netw...
A graph $G$ is said to be a model of a first-order sentence $\varphi$ if $G$ satisfies $\varphi$. Now let $\varphi(x_1,...,x_r)$ be a first order formula with free variables $x_1,...,x_r$. What is the standard terminology for a tuple of vertices $(v_1,...,v_r)$ of $G$ such that $G$ satisfies the formula $\varphi(v_1,....
Recently I read the source code of Clang, and found that it just do the lex thing by reading characters one by one and manually do the matching. But both my teacher when I'm in college and the book "Compilers Principles, Techniques, and Tools" take lots time to illustrate how to build a regular expression state machin...
Say you have this function call sequence: function all() { fn1() fn2() fn3() } And say that fn2 was asynchronous and caused all kinds of side effects: var globalPacketCounter = 0 function fn2() { var httpRequest = ... httpRequest.on('data', function(){ globalPacketCounter++ }) drawGraphicsToDisplay(...
In this proof of the Space Hierarchy Theorem the following language is defined $$ L = \{ (\langle M \rangle, 10^k) : M \mbox{ does not accept } (\langle M \rangle, 10^k) \mbox{ using space } \le f(|\langle M \rangle, 10^k|) \}. $$ And then stated: Now, for any machine $M$ that decides a language in space $o(f(n))$, ...
There's an algorithm for finding the k'th smallest element in an unsorted array similar to quickselect: kthSmallest(arr[0..n-1], k) 1) Divide arr[] into ⌈n/5⌉ groups where size of each group is 5 except possibly the last group which may have less than 5 elements. 2) Sort the above created ⌈n/5⌉ groups and fi...
You are given an array $A$ of $n$ positive integers, you have to find the number of subsets the product of whose elements is less than or equal to a given integer $k$. Is there an efficient algorithm to solve the above problem. We can assume $1\le n \le 10^5$ and $1\le A_i \lt k \le 10^9$ for each element $A_i$ in $A$....
I have an IP program where $\forall i \in I, j \in J$ my decision variables are $x_{i,j}$. I have two sets of inequalities (one inequality for every $i,j$ pair) that are of interest which are $$a_{i,j} x_{i,j} \geq 1 \ \ \ \ \forall i \in I, j\in J$$ and $$ \sum_{j \in J} b_{i,j}x_{i,j} \leq b_{i,j}- 1 \ \ \ \ \forall ...
I have an integer linear program with variables $x_1,\dots,x_n$. I have an inequality $a_1 x_1 + \dots + a_n x_n \ge b$ that I care about; it may or may or not hold. I want to introduce a boolean variable $y$, with the intent that $y=1$ if this inequality holds or $y=0$ if it doesn't. How can I write linear inequalit...
I tried to use machine learnign in matlab using bagoffeatures to captures features and teach the code betwee two types of plots. However, bagofFeatures could not detect ant features. this is my plot: How does bagofFeatures work? and would work on my plot if I changed the color og point depending on their high?
If $\mathsf{NP}\subseteq \mathsf{DTIME}[n^{O(\log n)}]$ then what happens? Does it imply $\mathsf{NP}\neq \mathsf{EXP}$? Is there any other consequences such as $\mathsf{BPP}\neq \mathsf{EXP}$? Does it also give $\mathsf{PSPACE}\subseteq \mathsf{DTIME}[n^{O(\log n)}]$?
I am trying to implement the Deutsch algorithm. My steps were: Write down $|01\rangle$ in a matrix form $A$; Apply $H^{\oplus2}$ gate to $A$ matrix; Multiply it with $U_f$ matrix; Apply $H$ to the first qubit; After the above steps, I got a matrix: array([[ 0. ], [ 0. ], [-0.70710678], ...
EDIT @20190313 I can rephrase my question a follows : I am given everyday a non weakly-connected directed graph by its so-called adjacency list representation -- nodes are stored as objects, and every node stores a list of adjacent nodes, its direct successors and predecessors. The graph is in fact highly non weakly-co...
I have a value, a, it can be any value from 0 to 1. In an integer linear program, how can I formulate a constraint that uses a binary variable, y, to determine whether a is within a range of 0 and 1 or not. Thanks
In my book they use the following argument which I don’t understand : Let $L$ be a langage such that there is $m_1, ..., m_k \in \Sigma^*$ such that $ L \subset m_1^*...m_k^*$. Now choose the minimum $n$ such that there exists $l_1,..., l_n$ such that every word of $L$ is a prefix of a word in $l_1^*...l_n^*$. Henc...
Why is it true? I understand why $n^g$ but how does the $f$ get there in the power?? I believe from the context that it's not just that $\binom{n}{f}^g$ is strictly smaller than $n^{f g}$, but rather that it really belongs to this class, which means it's also tightly bounded by it or very close. But why is it?
I have a set A = [x1, x2...xn] where xi in R (real). I need to find all non intersecting subsets with subset sum ~0 (approximately equal to zero). Since the set can have non zero real numbers, I have opted to use Ant Colony Optimisation for this problem. I have implemented this in python and the program tends to be a ...
Just for curiosity, I recently heard that many compilers are written in its own language. For example, gcc is partially written in C. And old version of compiler is used to compile the new version of compiler. Then I have a question, if there is a bug in the compiler, and you fix the bug in the source code and use the ...
What is flow in context of minimum-cost network? I know that a minimum cost network is a directed graph G={V,E}, where each edge has a cost and capacity value. The problem is to find best 'path' to send d amount of flow from source to terminal node so that the total cost is minimized. My question is: what does flow den...
If I have an affine camera with a projection relationship governed by: \begin{equation} \begin{bmatrix} x & y \end{bmatrix}^T = A \begin{bmatrix} X & Y & Z \end{bmatrix}^T + b \end{equation} where A is a 2x3 matrix and b is a 2x1 vector. How can I form a matrix representing the linear mapping between the world p...
I have seen this result but I don’t understand why it’s true : Every rational language is the image of a local language by a morphism : $\phi : \Sigma^{*’} \to \Sigma^*$ I know what a local automaton is. It’s just an automaton that recognizes a local language. A local language is basically a language where all factor...
This is a rather strong claim, and therefore likely to be incorrect, but hear me out. Firstly, when I talk of “computations”, I mean this in a broader sense than normally used, because I am including “infinite computers”, e.g. Turing machines that can perform computations not in a finite amount of steps, but infinite o...
Given an integer array and an integer $k$, we have to count the number of pairs of elements from the array whose bitwise OR is $k$ in $O(n)$ time complexity. How could this be done?
Does there exist a system, e.g., software, an environment, a programming language, or the like, to represent knowledge and to reason with it, to query with, where the (descriptive) language used is at least predicate logic with modal operators, using standard logical symbols (⊃, ≡, ◇, ∧, etc.)? It has to follow the rul...
Database book by Korth explains validation protocol as follows : To perform the validation test, we need to know when the various phases of transactions took place. We shall, therefore, associate three different timestamps with each transaction $T_i$: Start($T_i$),the time when $T_i$ started its execution. Validatio...
What is the number of floating point operations needed to perform exponentiation (power of)? Assuming multiplication of two floats use one FLOP, the number of operations for $x^n$ will be $n-1$. However, is there a faster way to do this? How does it work if $n$ isn't an integer?
I’m trying to understand the time complexity of a queue implemented with a linked list data structure. My book says that we can the implement a queue in O(1) time by: enqueueing at the back dequeueing at the head and it also says Note that although adding an element to the tail is constant time, removing an eleme...
I learned that the CPU is composed of two units and the machine’s instructions can be categorized into three groupings: (1) the data transfer group, (2) the ­arithmetic/logic group, and (3) the control group. It could be concluded that Control Unit for the control group and Arithmetic/logic for the corresponding grou...
I have this problem where I need to design a greedy algorithm. The problem is as follows: A chocolate factory owns $n$ stores, which are connected by a single road. Each store has a limited supply $c_i$ of chocolates. Furthermore, the factory would like to have the same amount of chocolate in each store. Therefore, the...
You are given a word $w$ and a rational expression $R$ ($R$ is represented as a binary tree). Find an efficient algorithm that says whether $w \in L(R)$ or not. I think I found a quadratic algorithm. First let denote $n$ the size of $R$ (i.e. the number of nodes). Then apply Glushkov's algorithm. So we get an automat...
How can People with a background in Mathematics pursue PhD in Computer Science" Although I have a Postgraduate degree in Mathematics with basic programming knowledge,it sounded quite interesting how knowledge in Mathematics can help to solve Computer Science Research Problems. Since this site is for researchers in Comp...
I have come across this tricky problem. An array of N elements should be converted to another array within k operations such that, distinct element's frequency should be Equal and A largest possible prime number e.g. [2, 2, 2, 3, 3, 4] and k = 3 Here element 4 can be converted to 3 in one operation and by doing so,...
If i want to save something in a computer such as a number 1 that would be 001 but if i save 001 in a computer how would the computer know that 001 is 1. Should we first save the number 1 in memory and tell the computer that hey this is 1 and it is 001 in your language. Basically if we want to save something, how woul...
What are preconditions and postconditions in this C++ function? I have this example in my slides but still didn't get the idea! *Comment function declaration: void showInterest(double balance, double rate); //Precondition: balance is nonnegative account balance // rate is interest rate as percentage ...
Can someone please help me in understanding the statement. What does it exactly mean? What I think it means is that: the derivation produces by the leftmost derivation is also possible with rightmost derivation. What do you think guys?
I learned that the boot loader transmit the operating system from Hard Disk to Main Memory during the booting process. I wonder, today's computers are equipped with multiple slice of memory of dual-channels. How the Operating System is allocated to each channel? I guess it should not clone twice.
I'm a computer science newbie and I thought I understood cases and bounds when I first studied them. I would take worst case as upper bound and best case as lower bound, but now I know that they are two separate concepts, so now I came up with this assertion which I think is correct, but I want to sanity check it: An ...
We want to design a synchronous counter that counts the sequence 0-1-0-2-0-3 and then repeats. The minimum number of flip-flops required to implement this counter is________ According to me, the answer should be 2, as the max. value in the sequence is 3 and 3 can be repeated with 2 bits only. But my solution man...
my question is basic but I want to know how to code algorithms containing maths like this https://web.stanford.edu/~skatti/pubs/sigcomm15-spotfi.pdf , TY for your help !
Suppose I have a matrix $m \times n$ with entry 0 or 1. Of course there is a possible $2^{m\times n}$ matrix. I want to sort all the matrices so that every two consecutive matrices are only 1 bit different, and the different ones must be neighboring. I can make the first 2 matrices arbitrarily, but the next matrix will...
So, I have trouble understanding and solving the following question: You are given a 2D array. Design an algorithm that, given two coordinates (each with two indexes ofc), returns the minimum in the rectangle between those coordinates. You know that the number of lines in that rectangle (of each query) is greater than ...
My naive distinction between parametric polymorphism and ad-hoc polymorphism, is that: In parametric polymorphism, the type is given as a variable: (pseudocode) Function f: <.Type T> T $\to$ T {...} Whereas in ad-hoc polymorphism, we write different functions for each type: Function f: Int $\to$ Int {...} Function f...