instruction
stringlengths
35
29.1k
Given a sentence like this, and i have the data structure (dictionary of lists): {'cat': ['feline', 'kitten']} A feline was recently spotted in the neighborhood protecting her little kitten How would I efficiently process these set of text to convert the word synonyms of the word cat to the word CAT such that the...
Introduction This is a heavily updated question I have asked on this forum previously. I have understood and corrected the earlier errors and mistakes I made, and after doing that it still seems I have a problem. I would also like to state that I am not looking for a different proof of the halting problem, and I am not...
I'd like to know how a computer can determine the beginning and end of certain file components (attributes, headers, frame/packet/segment headers etc.) when these components can be omitted or added in optionally, on top of being of variable length, and how it can even recognise files and protocol packets within an ocea...
Suppose we have an undirected, connected graph $G$ where vertices have positive integer weights. Let $\bar{v}$ be a given vertex in $G$. Take a spanning tree $T$ of $G$ rooted at $\bar{v}$ and define its cost as the maximum total weight among all proper subtrees. (Since weights are positive the proper subtree(s) with m...
There must be a complexity class C that includes exactly the problems that can be solved in exponential time and having access to a truly random coin (which in turns implies that you will be able to use an exponential number of random bits). I searched for a class like like this in the Complexity Zoo but I only found P...
I was shown these diagrams in the context of search algorithms. The green tile shows the initial state, and the orange tile shows the goal state. I am told that each option shows a path each search method would take to reach the goal state. This one is apparently breadth-first search: This one is apparently bidirectio...
When we defining a Functor instance in Haskell, it should satisfy the following two laws: fmap id = id fmap f . fmap g = fmap (f . g) But I found these two articles that say the second Functor law can be derived form the first: The second Functor law is redundant The free theorem for fmap The proof in these article...
I am writing a scientific paper in which I describe some algorithms (using pseudocode) that have point clouds as inputs. In these algorithms, I need a mathematical structure to represent a point cloud. I need this mathematical structure to permit to access the $i$-th point in a point cloud. I have read some papers that...
there are 3 kinds of TMs a Halting TM on all inputs prints finitely many symbols on it's output tape and halts a Circle-free TM on all inputs prints infinitely many symbols on it's output tape a Crashy TM is neither Circle-free nor Halting (if a TM reject any input it's Crashy) "the kinds of TMs" problem is to find ...
I'm struggling with question 7-38 from Skiena's Algorithm Design Manual: Let G be a directed graph. We say that G is k-cyclic if every (not necessarily simple) cycle in G contains at most k distinct nodes. Give a linear-time algorithm to determine if a directed graph G is k-cyclic, where G and k are given as inputs. J...
I have the following diagram showing a case of merge sort: I am trying to find the value that would be in the box with the red cross when applying merge sort in ascending order. It seems to me that it would be $71$. If we start at the bottom-right, we have $[30, 71]$ for the first array. We then have the sorted arrays...
First of all LPL is Leaf path length & IPL is internal path length. While i was studying algorithm analysis for average complexity of binary search , i saw that inequality. Before that, i proved by induction for any full binary tree T, LPL(T) = IPL(T) + 2*I where I is the number of internal nodes . Now after that i tri...
Suppose we have an array of $n$ integers. Suppose that we pick one of these elements uniformly at random and call it $x$. Suppose that $\log n$ elements are also sampled (uniformly at random) from the $n$-size array and we call $A$ this sampled array. What is the probability that $x$ lies in the middle third of the sor...
In lecture the following was mentioned in the context of matchings in bipartite graphs: Let $U$ be a finite set and let $\mathcal{S}$ be a family of subsets of $U$. For $u \in U$ let $r(u) := \lvert \{S \in \mathcal{S} \mid u \in S\}\rvert$ and let $n := \lvert \mathcal{S} \rvert$ and $N := \sum_{S \in \mathcal{S}} \l...
Recently, I study the instruction set of riscv32 and face a order as "mulh" which tends to multiply two 32-bits signed integers and store the high 32 value into the register. And here comes the problem, there are two integer src1 and src2, I want to implement these instruction in C language by using shift operation but...
Why don’t operating systems save process state (registers, page tables, pages) by writing state to storage in blocks? Wouldn’t this allow for a seamless restoration of state when the process needs to continue? Specifically, in graphics intensive processes (ie video games), wouldn’t this make load time way quicker?
I have been thinking a bit about error correcting codes, in particular the following problem: Consider the problem of transmitting a single real number $x \in [0,1]$ over a lossy connection, where each bit sent has a i.i.d probability $p < 0.5$ of being flipped during transmission. For a given number of transmitted bit...
Back here with some more doubts, i wanted to understand, how can we formally or may be easily calculate time complexity for such question without getting into "DRY RUN", i mean is there any way for it? and for below question i am getting O(loglog(n/2)) which is not right! Thankyou in advance for sharing your wisdom :) ...
After going through the resource list, is the following a way to explain ford fulkerson concisely ? Graphs is represent is a 2D matrix with flow capacity as a tuple in each cell. while exists (P_residual = residual graph path from S to T obtained via BFS ) modify actual and residual graph with P_residual by 1. ...
I'm studying for an exam and have run into a problem that I do not understand. The main program starts two threads that execute the following program concurrently, whenever both threads terminate the program will print the result of counter. I am assuming that the maximum value of counter will be 10? But what will the ...
Suppose we modify the Knuth-Morris-Pratt string-matching algorithm to scan the pattern right-to-left a la Boyer-Moore, and consequently apply the shift rule on the right side of the cursor instead of the left side. The quantity $\text{sp}_i(P)$ is now defined as the length of the longest proper prefix-suffix of $P[i\do...
Ford Fulkerson 1956 uses words like "arcs" and "chains". What do they mean ? Arc = path and chain = edge ?
Exercise 9.2.3(c) of the book by Hoffman, Motwani, Ullman states In fact a definition of the RE-but-not-recursive languages is that they can be enumerated but not in numerical order How do we show this equivalent to the following definition? RE-but-not-recursive languages are those, that are accepted by a TM, but do ...
I had earlier asked the question What is a witness string? I unable to understand the concept From the answers I got, it seems that a witness is more or less the answer. For e.g. in the padlock example given in the accepted answer, the witness is the padlock combination which can be easily verified to be true or false....
In the worst case, the Traveling Salesperson Problem (TSP) is mostly accepted to take exponential runtime in terms of $|V|$ and $|E|$ (the number of vertices and edges respectively). But for many real-world TSP problems, while $|E|$ and $|V|$ may be large, you often have many other properties of the graph that one woul...
I understand that if $A$ is NP-hard, and $A \leq_{T} B$, then $B$ is NP-hard. Is the converse also true? So if $B$ is NP-hard, and $A \leq_{T} B$, then $A$ is NP-hard? Why (not)?
Wikipedia states that the time complexity of the General Number Field Sieve (GNFS) is $$\exp\left( \left(\sqrt[3]{\frac{64}{9}} + o(1)\right)(\log N)^{\frac{1}{3}}(\log \log N)^{\frac{2}{3}}\right),$$ where $N$ is the number to be factored. The same site also mentions that quasi-polynomial time is $$\mbox{QP} = \bigcup...
I have a graph data structure that has some source points (the red ones) and some destination points (the blue ones). I want to find the shortest path from every source point to its nearest destination point, or to its nearest source point that is already connected to a destination point by a shortest path. Please see ...
Let $G$ be a graph and $G_s$ its $s$-subdivision, i.e. the graph obtained from $G$ by subdividing each edge $s$ times. Why is the treewidth of $G$ the same as the treewidth of $G_s$? (Subdividing an edge $s$ times means that we replace $e = (u,v)$ with a path from $u$ to $v$ of length $s+1$, i.e. $u, x_1, x_2, x_3, ......
The problem reads as follows: Write a regular expression for the following language on {0, 1}: $\bullet$ all strings not ending in 01. The solution my teacher gave is (0+1)$^{*}$(00+10+11)+0+1+$\lambda$ So if I understand this correctly I could produce a string like 0001 right? Which ends in 01 which is what we DON'T w...
this question is related to this question but it's different there are 3 kinds of TMs a Halting TM on all inputs prints finitely many symbols on it's output tape and halts a Circle-free TM on all inputs prints infinitely many symbols on it's output tape a Crashy TM is neither Circle-free nor Halting (if a TM reject an...
Is there an algorithm that help to build a linear order on a set of states of automaton (without output signals), such that this order is compatible with a transtion function of automaton? Let A = (X, S, δ) be an automaton, where X is a set of states, S is a set of input signals, δ: X × S → X is a transition function. ...
I have the logical formula $$ A \Leftrightarrow B \Leftrightarrow C $$ In order to make the truth table I'm not sure wheither I should interpret it as $A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$ Here is my first truth table: $A$ $B$ $C$ $A \Leftrightarrow B \Leftrightarrow C...
I am trying to prove that an undecidable language $L$ is not many one reducible to its complement. The problem goes as follows: Formally prove that $L \not\leq_m \overline{L}$ for any undecidable $L$. ($\overline L$ is also denoted $L^c$.) How would I go about proving this? I am unsure how to prove mapping reducibili...
Chapter 2.3.2 Analysing divide-and-conquer algorithms of Introduction to Algorithms, fourth edition, by CLRS, says the following: A recurrence for the running time of a divide-and-conquer algorithm falls out from the three steps of the basic method. As we did for insertion sort, let $T(n)$ be the worst-case running ti...
Enumerator programs appear quite often in even an elementary computer science textbook without a formal definition. It does not seem to fit the standard definition of a computable function (through mu recursion, Turing machines or lambda calculus), which takes a single input and a single output. What's a standard liter...
Show that the formula $\bigcap_{i=1}^n (X_i \leftrightarrow Y_i)$ cannot have an equivalent disjunctive normal form with less than $2^n$ clauses. I am puzzled on what approach to take -- whether to consider the equivalent boolean functions or some depth trees or some specific example of $X_i$-s and $Y_i$-s in order to ...
I am studying the concept of heuristics in search algorithms, and the $A^*$ search algorithm in particular. I am told the following: Greedy search minimises estimated path-cost to goal. But it's neither optimal nor even always complete. Uniform-cost search minimises path-cost from the start. Complete and optimal, b...
I am working on parameterized complexity and started exploring on various structural parameters. The problem I am working on is known to be W[1]-hard parameterized by treewidth of the input graph and I am wondering if there is any known relationship between treewidth and maximum degree of the input graph. Could anyone ...
Looking at the tree on the left it seems that the triangles represent leaves of the avl tree. To arrive at the balancing of -2 besides the node y the right subtree must have 2 nodes while the left subtree has a maximum of 4 nodes. Thus 2-4 = -2. However what does the h indicate?
The problem: Given a set of measurements $x_1, x_2, ..., x_n$ and corresponding labels $y_1 <= y_2 <= ... <= y_n$ that designate the desired ranking, count the number of pairs that are actually ranked correctly by $x$. In other words, compute $$ R((x_k, y_k)_{k=1}^n) = \sum_{i \in 1,...,n-1} \sum_{j \in i+1, ..., n} I(...
I found this PDA online that accepts all non-palindromes over {0,1}. However, I can't seem to understand how it would accept, say "01011", and not accept "101101". Can someone help me understand how "01011" reaches the final state, and why "101101" doesn't by running through the states with me? Source: Source
For the given figure, let's consider vertex v3. For v3, v0 has a higher partial order,v1 & v2 has the same partial order, and v4 & v5 have lower order than v3, e.g., higher: {v0}, same: {v1,v2} and lower: {v4, v5}. I am looking for an algorithm to recognize these three sets. Is there any proven algorithm to find them? ...
I am still quite confused on how to properly handle in answering the intersection and equality of two FAs in terms of table form and manipulating its transformation. It is a bit challenging at times when I encounter new FAs to compare. It would help a lot if there would be a proper way and tip to understand the questi...
So I have a problem that is ,I have an integer array and first I define an interval as a good interval iff, within the interval every integer appears an even (including zero) number of times. I want to find the number of good intervals in a given integer array. For example, if array = [7, 7, 1, 5, 5, 1], the good inter...
A company is able to earn x dollars per day without any machines. However, there are n machines available for purchase. The i-th (0<=i<n) machine costs v[i] and can bring an extra profit of m[i] per day to the company. Each machine can be purchased only once, but the company can buy multiple machines on the same day. I...
I am currently studying the concept of heuristics in search algorithms. I recently asked this question about the so-called "pathmax modification," $f(n^\prime) = \max(g(n^\prime) + h(n^\prime), f(n))$, and how it is useful. The user Pål GD commented with the following: The heuristic will be monotone, and furthermore t...
I have the language $L = \{ 0^{2l} 1^m | l,m >= 0 \} \ where \ \Sigma= \{0,1\} $ which I am trying to find the class of language for, e.g. not context-free, context-free, regular. By this notion I assume $L$ is context-free and has some pumping length $p$, and I will use the pumping lemma. $w = 0^{2p}1^p$ and can be s...
I am working on the decision version of an NP-complete problem. The problem is known to be fixed parameter tractable(FPT) with respect to the solution size $k$ as the parameter. If I consider another parameter (e.g. $p$), then which among the two following statements holds true? if $p \leq f(k)$, since the problem is ...
How to prove that for any words $w_1, ..., w_n$ on alphabet $\{0,1\}$ the regular expression $w_1^*w_2^*...w_n^*$ doesn't represent language $\{0,1\}^*$?
Consider an algorithm with the following recursion $$ T(n) \leq T(n/3) + T(2n/3) + \mathcal O(n)$$ for its running time. I understand that $T(n) = \mathcal O(n \log n)$ by drawing the recursion tree and seeing that every level takes time $n$, and that the depth of the tree is $\log_{3/2} n$. But, why is this upper boun...
I am studying term rewriting using Baader and Nipkow's book "Term Rewriting and All That". I am trying to solve the following exercise about word problems: 4.1 Give a trivial example of a finite set of identities $E$ such that the ground word problem for $E$ is decidable, but the word problem is not. My idea to solve...
There is a class exercise question asking about global sink in a directed graph. Finding normal sink is not difficult but the conditions of the question have made me stuck on this question. Let $G=(V,E)$ be a directed graph for which you have an adjacency list. A vertex $v$ is called a global sink if and only if it me...
***Climbing Stairs Problem: https://leetcode.com/problems/climbing-stairs/ 1) Take the "***Climbing Stairs" Problem for instance: If I was given a problem like this on a test after mastering "Fibbionacci Series" and "Factorial Implementation", I would not be able to solve it, despite the fact that "Climbing Stairs" pro...
We receive a stream of $n$ integer numbers: $x_1, x_2,\dots, x_n$. Assume that each $x_i$ is a constant and can be stored with $O(1)$ bits. Whenever a new number $x_i, i \geq 2$ is inputted, we need to evaluate and output the sum: $$ S_i := \sum_{j=1}^{i-1} |x_i - x_j|$$ After outputting it we receive $x_{i+1}$ etc. My...
I'm working on a game where there are several different entities represented by nodes. Each node has a starting balance, and directed edges show where money is owed from one account to another. One problem I'm trying to figure out is which order to process transactions in, take this example below: If you start by proc...
I am a research scholar working in parameterized algorithms. For more information on parameterized complexity please refer to this. Recently, I have come across a problem which is known to be NP-complete on split graphs. Now, it has come to my attention that the problem will not be tractable parameterized by the param...
In this paper, the author discusses colourings of the plane, or in other words, of the underlying graph. I suppose a finite colouring is a colouring using at most $k$ colours for some natural number $k$. However, what do countable and measurable colourings mean? Does the former perhaps mean that any vertex of the graph...
By using limits, show that log n! ∈ Θ(n logn). Using Stirling's approximation for n! I get the limit: $$\lim_{n \to ∞} \frac{log({\sqrt{2πn}}*(\frac{n}{e})^n)}{nlogn} = constant > 0$$ When I break this down separately: $$\lim_{n \to ∞} \frac{\sqrt{2πn}}{n^n} * \lim_{n \to ∞} (\frac{n}{e})^n = constant > 0$$ To me, the ...
I read that if $\alpha$ is the fraction of the code that cannot be made parallel then it is desirable that $\alpha < \frac 1 p$ where $p$ is the number of processors. Why is it the case? The speed-up is $S(p) = \frac{T_1}{T_p} = \frac{p}{1+(p-1)\alpha}$
I am stuck at the following exercise: Consider a directed graph $G = (V, A)$ with start vertex $s ∈ V$, target vertex $t \in V$ and weights $w_{ij} \in \mathbb{R}$ for each arc $(i, j)\in A$. For any $i \in V$ let further be $\pi_i \in \mathbb{R}$ be the so-called potential of $i$. The potential difference $\tau_{ij} ...
In the following algorithm $A[1..n]$ denotes an array $A$ of size $n$, of $n$ distinct integers. Func1() and Func2() are functions that run in $\mathcal O(\log n)$ and $\mathcal O(n)$ time, respectively. Foo(A[1..n]) if n == 1: return while (True) { Func1() i = random[1, 2, ..., n] ...
I want to sort the list of parameters (p1, p2, p3, p4, ..., pn) according to their importance. All parameters have to be compared with each other at best once, but not less than once. The person will be asked to select the winner of the comparison, so for every comparison, there is only 1 winner. The workflow should be...
How do we write an unrestricted grammar for $$L = \{a^n \ | \ n \ \text{is prime}\}$$ I know that $L$ is neither regular, nor context-free. Also, I know how to build a Turing Machine for $L$. The idea is to use two tapes, one having $n$ ones, and the other having $m$ ones. The TM checks if $m$ divides $n$. If it does, ...
D.E. Knuth, in his infamous The Art of Computer Programming, section 1.2.2, presents the following algorithm to efficiently calculate logarithms based on the method used by Henry Briggs: Suppose that we have a binary computer and a number $x$, $1\leqslant x < 2$. Show that the following algorithm, which uses only shif...
Recently i studied three theorems which says about Hamiltonian graph, they are as follows, Dirac's Theorem: Let G be some simple graph of order n >= 3, for all vertices of the graph G, its degree >= n/2 then we say given simple graph is actually an Hamiltonian graph. Ore's Theorem: Let G be a simple graph of order n...
I am wondering if anyone knows if there are any NP-complete problems that are also known to be in IP (interactive polynomial time). I know problems like Graph Isomorphism are in IP, but such problems are not known to be NP-complete. Moreover, if there were or were not an NP-complete problem in IP, what would be the co...
It is a well known fact, the throughput of a given compute pipeline (say, CPU instruction pipeline) is determined by its "slow" segment. All the resources I've seen so far, demonstrates this fact via describing a concrete pipeline with 2-3 stages. I'd love to see, more-or-less, some formal proof, the above holds for an...
The wikipedia article for #P states that if we have a polynomial-time algorithm for a #P-complete problem, P = NP is true. As #2SAT is #P-complete, this would mean that providing a polynomial-time algorithm for #2SAT implies P = NP. But why exactly is that? It means that there is at least one NP-complete problem that c...
In a 2015 Quanta article talking about a breakthrough in the graph isomorphism problem, it was mentioned that graph isomorphism has a unique property where we have an interactive proof protocol for it. That is a prover can convince a verifier that two graphs are not isomorphic in polynomial time. That is, for the grap...
Input There are three chairs (1,2,3) in the same row. We need to find a seat for three guests (a,b,c). Constraints The first guest does not want to be seated next to the third one (neither left nor right). The first guest does not want to be placed on the leftmost chair. The second guest does not want to be seated o...
Consider the max-flow problem with a set of additional constraints, each in the following form: the flow on edge $e$ must equal the flow on edge $e'$. My question is how to modify existng max-flow algo to solve this variant.
bool isPrime(int n) const { if(n<2)return false; if(n==2)return true; if(n%2==0)return false; for(int i=3;(i*i)<=n;i++){ if(n%i==0)return false; } return true; } this worst case procedure should produce an O (sqrt (N)) which would be the number of comparisons I am going to do in the ...
Why is it possible that this word can have 4 errors but not 2?
I am reading a proof of correctness for the MergeSort Algorithm. This is the code for the MergeSort and the Merge function: The correctness of the MergeSort function is easy to prove since the two MergeSort recursive calls decrease the size of the problem by half, which guarantees the convergence to the base case ($p ...
If we have the natural numbers defined as: Plus the following: $pred \space \_\_<\_\_ \space: Nat \times Nat$ $\forall i,j:Nat$ $0<suc(j)$ $\neg(i<0)$ $suc(i) < suc(j) \Longleftrightarrow i<j$ How to prove $0<i => 0 < i + j$ by induction? For the base case the premise fails when $i=0$, and thus the implication ho...
Let F be a function defined for all nonnegative integers by the following recursive definition. F(0) = 0, F(1)= 1 F(n + 2) = 2F(n) + F(n +1), n>0 Compute the first six values of F; that is, write the values of F(n) for n = 0,1,2,3,4,5
I am learning about context free languages. I understand how $\{a^nb^nc^n|n>0\}$ can be shown to be not context free using the pumping lemma for CFL's. Intuitively however it seems that a pushdown automata to recognize $\{a^nb^nc^n|n>0\}$ can be constructed. This PDA would initially push single a's into its stack whene...
Assuming a contiguous array implementation of a binary min heap with n elements, is it possible to remove the k-smallest elements in a faster time than $O(k \log n)$, as can be done via iteratively removing the minimum of the heap $k$ times? More formally, by removal of k smallest elements, I mean removing the k smalle...
I am fitting different 2D geometric transformations by least-squares. For instance quadratic, $$\begin{cases}a'x^2+b'xy+c'y^2+d'x+e'y+f'=X\\a''x^2+b''xy+c''y^2+d''x+e''y+f''=Y\end{cases}$$ which is linear in the unknowns $a',b',\cdots f''$. I also solve homographic transformations $$\begin{cases}\dfrac{a'x+b'y+c'}{dx+e...
There are a lot of work about bounds on the complementation of Streett automata (see e.g. this paper). They talk about the general setting of nondeterministic Streett automata. But what about deterministic ones? Streett automata are closed under determinisation although with an exponential blow-up. And complementation ...
There is a chess tournament planned. It is a single-elimination tournament, and for spectacle purposes, only one match at a time will take place, on a table in the middle of the stage. The winner of a match will have to stand offstage if they don't play the next match. The loser will be out of any further consideration...
I have an algorithm with running time that satisfies $$ T(n) \leq n + \frac{1}{n}\sum^{n-1}_{i=0}(T(i) + T(n-i)),$$ and $T(0) = 0$. I was able to show that $T(n) = \mathcal O(n\log n)$ with a leading constant $c > 4$. I modified this algorithm such that the recursion for $T(n)$ now satisfies $$ T(n) \leq 3 \log n + n +...
I am starting to learn online algorithms but am still stuck in determining the competitive ratio. I cannot understand how to find it. All the research papers are so difficult to understand. Please share a proper source from which I can start my journey.
I have an oriented and weighted graph, and I need to find the cheapest route from source to destination. Now I have a source node A and a destination node B the cheapest path is given to me by the sum of the weight of the arches to which I have to subtract the discount, the discount is given to me by the weight of the ...
A proof of $\mathsf{NP}$-completeness for a decision problem requires two things: $\mathsf{NP}$ membership; $\mathsf{NP}$-hardness. It is often the case that the $\mathsf{NP}$-hardness part is the most difficult to prove, and it is not rare that some papers completely omit the $\mathsf{NP}$ membership part. What I wo...
I trying to understand where, as a programmer in situations where it can be good to do a NP-complete reduction to prove that a problem is NP-complete, why is it good to do that as a programmer? I don't understand.
\begin{bmatrix} 1-\alpha & 3\alpha/4 & \alpha/4\\ \alpha/4 & 1-\alpha & 3\alpha/4\\ 3\alpha/4 & \alpha/4 & 1-\alpha\\ \end{bmatrix} I was told that the probability of error of this channel can not be $\alpha/4 $ or $3\alpha/4$. How do I know this? How can i find the probability of error?
Examples like swinging both of their hands squat walking around jump around etc Is it possible to perform this in real time under crowded scene without depth information? I can find out the "action level" if I knew what kind of action the person are doing, but can't find a fast solution to find out their action level...
I have tried to convert signed binary number, -11.875, to unsigned value. I am not sure about where to add the carry bit taking 2's complement of binary -11.875. The carry bit should be added with the decimal part or the RHS side of -11.875?
What happens if Operand Fetch and Write Back happen in same cycle?
Start with $N>3$ vectors $\vec{v}_I$ in $\mathbb{R}^3_+$, any $3$ of which are linearly independent. $I$ here ranges from $0$ to $N-1$. Let $v_{\left[abc\right]}$ be a matrix in $\mathbb{R}^{3 \times 3}_+$ that picks three of the (column) vectors $\vec{v}_a\, \vec{v}_b\, \vec{v}_c$ in order $a < b < c$, without duplica...
For an inverted page table, it's number of entries = number of frames in main memory. One frame in the main memory, could be shared by two (or more) processes, say process A and process B. Usually this is noted down in process A and process B individual page table. Like process A page 0 maps to frame 1 offset 1-50, pro...
How do I convert a graph to a search tree? Here's the question- The problem is that I don't know how to represent interconnections in a graph on a tree. In the diagram A is connected to D, and same goes for B and E, C and F. But in tree I think no interconnections should be there between sibling nodes. So how do I rep...
I have some basic information about the graph coloring problem, which is an NP-Complete problem. I am very new to genetic algorithms, and I have faced a problem in which we have to solve the graph coloring problem using genetic algorithms. I have seen this video, and also I have read the explanation which has been prov...
In some languages, e.g. Ruby, an expression like: val = call_fn() || DEFAULT_VAL; will set val to the results of call_fn() if it is truthy (non-zero, non-NULL, etc), or to DEFAULT_VAL otherwise. This can be really useful. In C, the result of the || operator is always a boolean value (1 or 0). Is there a strong argume...
Let's say I have a Operating System with 4KB page size, but I need to allocate 8kb of memory for all the variables. Does the Process get new page (second one) or does the current page table simply get bigger?
Consider a domain on a unit grid such that the grid nodes hold a point with probability $\frac12$. We construct a Euclidean minimum spanning tree on these points. How could we compute the probability that an edge of the tree is of unit length (so it joins two immediate grid neighbors) ? The probability that a point ha...
A quad-edge is a well-known data structure used to represent planar subdivisions or polyhedra. https://en.wikipedia.org/wiki/Quad-edge The procedure to enumerate the edges works by recursively visiting edges, and for every edge, the next edge starting from the same origin and the next edge after reversal. A flag is use...
In A Simple Yet Fast Algorithm for the Closest-Pair Problem Using Sorted Projections on Multi-Dimensions, Mehmet E. Dalkılıç and Serkan Ergun present algorithm QuickCP for finding the closest pair, discussing the planar case more often than other Multi-Dimensions. Algoritm 1 $\text{QuickCP}(P)$ // $P = \{P_1, P_2, \do...