instruction
stringlengths
35
29.1k
When the architectures of the teacher and student networks do not just vary by network depths but are completely different, is it logically correct to distill knowledge at feature level (say from middle layer) in such scenario? Thanks in advance
Saw it on another post that there is a way of solving FVS in polynomial time if the treewidth is constant, using dynamic programming?... If I'm given the treewidth of a graph, how do I solve it in time $tw^{O(tw)}\cdot n^{O(1)}$ ? thank you very much!
I am learning Turing machine in automata. Following problem might be simple, as that's the first question on Turing machines in my textbook, however I am not sure if I am doing it efficiently. Give Turing machine with input alphabet {a} that on input $a^m$ halts with $a^{m^2}$ written on its tape. My approach: The ma...
I was trying to find a grammar that generates $B=\{a^n b^m \mid n \not= 2m\}$ but I couldn't so I'm not sure that it is a CFG. This is what I did : $$ S\rightarrow X \mid aX \mid a \mid b \mid \epsilon $$ $$ X\rightarrow aa Xb \mid Y \mid Z $$ $$ Y\rightarrow aY \mid a $$ $$ Z\rightarrow bZ \mid b $$
I may sound stupid, but few people say that programming is witchcraft (maybe Joking) as a Christian I Must take it seriously, because I am planning to become Software Architect in the future. Honestly I do not think it is like Witchcraft, since it has nothing to do with evil spiritual world. How can compiler translate ...
I am trying to convert this recursive algorithm isqrt(n){ if(n==0){ return 0; } a = 2*isqrt(n/4)+1; if(n<(a*a)){ return a-1; } else { return a; } } into an iterative algorithm. So far I was able to do this: isqrt(n){ vector c; for(d = n; d>0; d = d/4){ ...
I'm trying to simplify the following REGEX: $$R:=0^*+0^*1\left(1+000^*1\right)^*0^*$$ $R$ is the result of transforming a GNFA that recognizes $L:= \{w \in \{0,1\}^* | \left(\forall \ i \in \left[1,|w|-2\right]\cap \mathbb{N}\right)\ w_iw_{i+1}w_{i+2} \neq 101\}$ I already know that there exists $R':=0^*\left(1+000^*1\...
I'm reading Computational geometry book. In exercise 4.9 of the mentioned book we encounter the following problem: Suppose we want to find all optimal solution of 3d- linear programming with $n$ constraints. Argue that any algorithm for solving this problem have lower bound $\Omega(n\log n)$. I try as follow: i thi...
I need to prove if the following languages are recursive: $A_1 \subseteq \{0, . . . , 9\}^∗ $ consists of all finite sequences of $\pi$ without the decimal point. We may thus write $A_1 = \{3,31,314,3141, 31415, 314159,... \}.$ The idea is to apply the Turing machine and prove if it can recognize a given string or wo...
Hey I was wondering I did all the 3 neccessary things so Head to Head comparision, Diagraph and the Head to Head Strength Comparision with the help of the Diagraph. In first method there is no condorcet winner so I went on and did the graph with a,b,c,d,e candidates and as result comes out that a wins all his pairs and...
Is assignment atomic is Promela? That is, can concurrent x = value1; and x = value2; produce anything different from value1 or value2 ? And can a concurrent execution of x = expression1; and x = expression2; produce anything else than the values of expression1 and expression2, executed atomically (especially if re...
I've proven the following: For each $n\in\mathbb{N},n\geq 2$ there exists a graph on $n$ vertices such that all degrees are distinct except two. Formally for each $n$ there exists a graph on vertices $v_1,\ldots,v_n$ such that there exists at most one pair $i\neq j$, such that $\deg v_i = \deg v_j$. The construction go...
Suppose we have PDA (same for DFA and Turing) that has a transition from a state to itself. Can we convert this PDA to another one without any transition like this? EDIT (My thoughts): I guess we can do it. for example in a PDA we might be able to do this(?)
I have a not so large network/graph that contains roughly 4000 edges and 1200 different nodes. Each edge has a weight (or cost) and a type (let's say either red or green). Going from one type of edge to another should add an additional cost to the total cost of the desired path. So staying in the same type of edges wil...
Given an array of size n, find minimum number of swaps required, so that no two adjacent elements are equal. For ex- n = 6, a[] = {1, 1, 5, 2, 5, 5}, answer = 1, ( swap a[0] with a[4] or a[5] ) n = 8, a[] = {1, 5, 5, 1, 4, 6, 1, 1}, answer = 2, (swap (a[0] with a[1]) and (a[5] with a[6]) ) n = 8, a[] = {3, 1, 1, 5, 3,...
Below, I appended a fragmented paragraph from Operating Systems Concepts on interrupts. To start an I/O operation, the device driver loads the appropriate registers in the device controller. The device controller, in turn, examines the contents of these registers to determine what action to take (such as “read a cha...
Input: An undirected, unweighted graph $G=(V,E)$. A cut is defined as a partition $V=A\dot\cup B$. A bisection is defined as a partition $V=A\dot\cup B$ with $|A|=|B|$ if $|V|$ is even (or $|A|= |B|+1$ if $|V|$ is odd). We define the value of a cut/bisection $V=A\dot\cup B$ as $E[A,B]$, i.e. as the number of edges betw...
I know that given any regular expression, we can find always find a minimal DFA which accepts the language it describes. However, this process can take up to exponential time and space. I'm wondering though if there are any known bounds on the number of states in the DFA even without going through with a construction....
I need to generate a set of square tiles that are colored and are grid-able. Each square tile must have a unique set of 4 colors and each exterior edge of each tile is colored with a different color. There are 8 colors, so that leaves us with 8 choose 4 (70) tiles. In order for these tiles to be placed into a grid, ort...
I was asked in the test to draw a Spacetime diagram for debugging in message-passing parallel programs, I want to know is this even a valid question?
Consider the CBC mode where the block cipher is replaced by a function $\pi$ where $\pi(k,x)=k\oplus x$. Show that the mode is not CPA secure. I am not got how to proceed to solve this question. Please someone helps me out to know how to solve it.
I have a problem on my hands, and would like help matching it to the existing, studied problems. I explain it like so: I have a sequence of $n$ equal-sized glasses of water. Each has a different amount of water inside, some are very full, some are near empty, and some completely empty. I can pour water from one glass ...
I am trying to understand this paper, in which (k, b)-clusterability is defined like so: A set $X$ of points in a metric space is (k, b)-diameter clusterable if $X$ can be partitioned into $k$ subsets (clusters) such that the maximum distance between any pair of points in a cluster is $b$. The paper offers an algorith...
I am working on a related Steiner tree problem that I have reduced to Minimum Set Cover, but stumbled across this related problem and got stuck. Given an universe of $n$ elements $U = \{1,2,\ldots,n\}$, let $F_1$ be a family of subsets on $U$, that covers the elements, and $msc_1$ be its minimum set cover. Let $F_2\sub...
The closes related question I have found for this is Find string patterns preferably in regex for string streams, but it has no answer and is also a little less constrained as my idea. Given a set of strings as for example: Foo 25 bar zoo animals Foo 50 bar zoo animals Foo 1 bar and boo decorative plants Foo animals F...
Wiki states: "...partitioning algorithm guarantees lo ≤ p < hi which implies both resulting partitions are non-empty, hence there's no risk of infinite recursion." What prevents Hoare partition from not returning j equal to hi? If our pivot is max number, we may execute j <- j – 1 only once and exit with j=hi E.g. A= [...
I was trying to get an arbitrary linear language to its GNF, and I converted it into one where all the productions were of the form $A\to Ba, A\to aB, A\to a$. In this question, the accepted answer shows a way of converting some productions of a linear grammar to the GNF. The issue would be, what about the transitions ...
The Problem I am working on a problem that boils down to finding the closest representation of an arbitrary number ($x$) in the form: $$x = A\times\frac{N}{D}$$ Where $A$ is a 32-bit integer, and $N$ and $D$ are 16-bit integers. Typical inputs are real numbers between 1 and 1 billion. My Attempts I first attempted to ...
I am trying to understand this paper, in which (k, b)-clusterability is defined like so: A set $X$ of points in a metric space is (k, b)-diameter clusterable if $X$ can be partitioned into $k$ subsets (clusters) such that the maximum distance between any pair of points in a cluster is $b$. The paper offers an algorith...
I have a sorted (by key) sequence of key value pairs: < (1,"A"),(1,"C"),(1,"G"),(1,"B"),(2,"D"),(2,"F"),(3,"E") > And I have to produce a sequence of tuples like this: < (1,< "A","C","G","B" >),(2, <"D","F">),(3, <"E">) > Where the second element of the tuple is a sequence with the values corresponding to the key. I...
I want to learn programming. I have knowledge of mathematical logic. So, what I am searching is a book (or varios books) for learning to programming, but I think that a book like one which I imagine would be great. As I said, I have knowledge of mathematical logic, hence I have experience with formal languages. So, I a...
If $L=\{w \in \Sigma^*\mid w=uv,\text{ number of occurnce a's in $u$ equal to number of occurrence b's in $v$}\}.$ I think $L=\Sigma^*$ because for any string in $\Sigma^*$, we can split it to $uv$ such that it contain equal number of a's and b's. But I can't prove it or maybe that language isn't regular. Any help for ...
I am having a little bit of a hard time distinguish between a TM which accepts a language, and a $TM$ that decides a language. To be more precise: $L_1 = \{\langle M\rangle\; | \; M$ accepts the 10-PCP $\}$ and $L_2 = \{ \langle M\rangle \; | \; M$ decides the 10-PCP $\}$ I guess $L_1$ is undecdiable, since I could pot...
Many complete problem of different class of complexity has SAT variant. Like 3-SAT or $k$-SAT is $NP$-complete, Horn-SAT is $P$-complete, 2-SAT is $NL$-complete, and so on. So I was wondering if there is a $L$-complete variant of SAT?
I am currently reading Arora and Barak's Computational complexity. In Chapter 4 (Space complexity), they say the following: Since the TM's work tapes are separated from its input tape, it makes sense to consider space-bounded machines that use space less than the input length, namely, $S(n) < n$. This is in contrast t...
We have n box and an array of weights, where weight of ith box is given by arr[i]. We have a container which can carry a maximum weight of w. Now we have to find minimum number of containers required to pack these N items. Exact question link : - link Useful Resources :- https://www.geeksforgeeks.org/bin-packing-probl...
Which one is asymptotically larger? $\log^*(\log(n))$ or $\log(\log^*(n))$? I think they are asymptotically tight bounds for each other (one is $\Theta$ of the other).
Let's say for example we have 1000 points and 50 dimensions. And we build a quadtree where each node represents a 50-dimensional box and is divided by splitting the box into smaller boxes that are half the size in every dimension? How would i calculate how many children each internal node has?
Henry Yuen's youtube comment on this video https://www.youtube.com/watch?v=HL7DEkXV_60 (should be one of the top comments) explains that with the help of quantum entanglement (or quantum computers), it is possible to solve a problem that has been proven to be unsolvable by a turing machine. Does that mean quantum compu...
One approach to solve recurrences is the so called substitution method. While practicing I encountered some recurrences, where non integer arguments can occur, e.g. T(n) = 2*T(n/2) + n, if n is not a power of 2. My understanding of the substitution method, is that it only works, if all arguments are integers. Is this c...
I am trying to prove something, and it will help e greatly to show that the maximum degree of any vertex, $d$ is a connected simple graph, goes up asymptotically linearly along with the number of edges in the graph. I came up with a somewhat hand-wavey "proof", and I wonder if it is anywhere near correct: For fixed $|...
*a = *b In C, the above expression is always interpreted as the assignment of the value at the address contained in b to the value at an address in a. But, according to the precedence of operators and associativity rule, * has higher priority than the assignment operator '=', and is associative from right to left. If w...
I am new to programming and trying to get better at writing efficient code. The obvious thing to do is practice and gain experience. I did learn a few general pointers through exercising, but in most cases, the only option is to simply think of a better algorithm to solve a given problem. What would be a good source (...
I'm considering the planar BSP problem, where we are required to partition a set of disjoint line segments in the plane, such that every region in the partition contains at most one line segment or a portion of one line segment. My question is: is there a way of partition these line segments such that no line segment i...
I'm trying to understand the example showing disadvantages of a long time quantum in Tanenbaum's book in Section 2.4.3 “Scheduling in Interactive Systems”. To improve the CPU efficiency, we could set the quantum to, say, 100 msec. Now the wasted time is only 1%. But consider what happens on a server system if 50 reque...
Let's assume I have array which I need to parse into binary tree [10, 15, 8, 12, 94, 81, 5, 2, 11]: 10 / \ 8 15 / / \ 5 12 94 / / / 2 11 81 or slightly modified arrays with the same elements generate the same binary tree above: [10, 8, 5, 15, 2, 12, 11,...
You are given x,a. Find a polynomial p(y) with the leading coafficent 1 such that p(x)=a. How to write an algorithem to solve this efficently? I have no idea where to start
We know that a recurrence relation without initial condition(s) might specify more than one solution (if it has any), but if we set some initial condition(s) the solution becomes unique. Now The book CLRS claims for a recurrence like this: $ T(n) = 2T(\lfloor n / 2\rfloor) + n$ or other divide-and-conquer-related recur...
You are given a list of prices (non-negative integers) $$ P=<P_1, P_2, ..., P_n> $$, where the prices $P_i$ appear in non-decreasing order. Moreover, you have access to an oracle that can be queried with an integer $a$ and returns "yes" if and only if $a \le k$ for some unknown integer $k$. Each query to the oracle req...
Let $F$ be a family of sets of consecutive integers in $\{1,…,k\}$ that is closed under taking subintervals, i.e. for any $a≤b≤c≤d$, if $\{a,…,d\} \in F$, then $\{b,…,c\} \in F$ also. Find a minimum number of intervals in $F$ that covers $\{1,…,k\}$. Is this a known problem? after some trial and error I do have the fee...
I have a simple connected undirected graph $G=(V, E)$ and I would like to enumerate all possible connected components that arise from removing $k$ edges in $E$. A naive way is to remove each $k$-tuple of edges (of which there are $\binom{|E|}{k}$ total) and then run a connected components algorithm, but this feels incr...
For simplicity, and I think without loss of generality, we can consider a binary tree. Suppose that we want to find the path between the root node and some node in the tree (we don't know where it is and only that it exists in the tree). Worst case scenario is if the node was a leaf node at the largest depth. If we wan...
The excerpt below is from the OS text by Galvin et. al. When we use a paging scheme, we have no external fragmentation: any free frame can be allocated to a process that needs it. However, we may have some internal fragmentation. Notice that frames are allocated as units. If the memory requirements of a process do not...
Disjoint Lite Feedback Vertex Set. given an undirected graph G and k ∈ N, and a Lite Feedback Vertex Set(LFVS) X of G of size ≤k+1 the objective is to decide whether there exists a subset S ⊆ V (G) of size at most k that is disjoint from X and that every connected component in G − S is either a tree or a simple cycle. ...
/// is an esoteric language, and I thought of posting a code-golf problem related to it. A /// program of the form /p/q/r where p, q, and r are strings that do not contain / or \ does: If the string p is a substring of r, go to step 2; otherwise step 5. Replace the leftmost occurrence of p in r with q. Let the result...
Should the $a$ and $b$ in Master theorem be integers or they can be rational numbers? I think $a$ must be an integer but $b$ can be rational.
the problem: In Almost Feedback Vertex Set, we are given an undirected graph G and k ∈ N, and the objective is to decide whether there exists a subset S ⊆ V (G) of size at most k such that every connected component in G − S is either a tree or a cycle. Design a (4^k)*n^O(1)-time algorithm for Almost Feedback Vertex Se...
Calculate the CC (Cyclomatic Complexity) of the following code snippets. I am not sure if I have drawn the Control Flow Graph correctly and furthermore if my calculation for the Cyclomatic Complexity is correct. And as for the formula M = E - N + 2P, the P is defined as "P = number of nodes that have exit points". Am I...
Can anyone help to prove that $\sum\limits_{i=0}^{k-2}\log_2\left(\frac{n-i}{k-i-1}\right) > cn$ for some constant $c>0$? Here $k=\Big[\frac{n}{2\log_2 n}\Big]$ and $[x]$ denotes the integer part of $x$, for example, x=5.2999, then $[x]=5$.
Many sources (including Wolfram's MathWorld) say that NP problem is defined as a decision problem "verifiable in nondeterministic polynomial time" (check Google to see more sources). But accordingly Wikipedia tells that NP are problems that can be solved in non-determnistic polynomial time. From conjunction of these tw...
Several (tutoring) students have asked me for a formal definition of amortized time and I've never been able to find one online. All the literature I've found usually outlines the three most common methods for doing the actual analysis and no more. In a few places there are explanations of why the amortized time for $o...
I just finished watching the 1986 SICP lectures, and the concepts are rolling around in my head. My question: why is "finite-state controller with datapath" the implementation of computer programs we use? I can think of a few of types of answers, which have different emphases: We don't use it: there are various impl...
L={⟨M⟩: M is a DFA and for each string in L(M) the number of 1s is more than or equal to the number of 0s } T = "On input where M is encoded DFA" 1. Construct another DFA D such that L(D)={x|x has more or equal 1s than 0s} 2. For each input x a. if( x is accepted by DFA M){ if(accepted by D){ ...
The question is: "Prove that we can also express the total cost of a tree for a code as the sum, over all internal nodes, of the combined frequencies of the two children of the node." I found an answer here (16.3-4): https://walkccc.me/CLRS/Chap16/16.3/, but I'm confused about one part of it. Specifically I'm confused ...
and $L_{\leq k} = \{\langle M \rangle : |L(M)|\leq k\}$ The solution that I saw is: Proof by contradiction, assume such $M$ exists. So reduction $f$ from $\overline{HP}$ to $L(M)$, when $\overline{HP}=\{(\langle M\rangle,x ) | M $ doesn't halt on $ x\}$ $f(\langle M'\rangle,x ) = \langle M_x\rangle$ When $M_x$ on input...
Is there a way that I can use If $L=\big\{\langle M_1,M_2\rangle\mid M_1, M_2\text{ are TM and } L(M_1)\cup L(M_1)=\Sigma^* \big\}$ is in $RE$ or $coRE$ or not in $RE\cup coRE$? to prove that $L=\big\{\langle M_1,M_2\rangle\mid M_1, M_2\text{ are TM and } L(M_1)\cup L(M_2)\neq\emptyset \big\}$ is undecidable and recogn...
Fallowing are some definitions from book "introduction to theory of computation" by sipser. a nondeterministic turing machine is a decider if all its computation branches halt on all input. $NTIME(t(n)) = \{L | L \text{ is a language decided by an $O(t(n))$ time nondeterministic turing machine } \}$ What is the dif...
I think that Alan Turing's solution for the "halting" problem might be wrong. Turing's main premise is wrong, he assumed the only way to check whether a program halts is to run it. He didn't consider that it's possible to determine whether any given program will ever halt by parsing and analyzing its code without runni...
I have been studying NP-Complete problems and I saw the Dense Subgraph problem. Then I saw that they are trying to show that the problem is NP (see below quote), but I can't understand how it verifies that time is polynomial. Problem: Dense Subgraph Input: A graph $G$, and integers $k$ and $y$. Output: Does $G$ contai...
I don't know if I should have posted this on StackOverflow or here but what's the difference between these terms? Are the definitions of these dependent on the programming languages or they're things independent of them?
I'm new to the area, and we don't have a course on graph neural networks at our university. However, I will still like to know the main theoretical results when considering convergence of graph neural networks. Where can I learn more about the topic? Thanks.
I am revising operating systems theory (I'm Italian, forgive me for bad English) and there is a slide that states: If page size is small then we avoid internal fragmentation (I get that) but we have larger size of page table and therefore larger cost of managing this page table". If page size is large then we have a l...
I am studying Compiler Design. The instructor told us that when a program is given to lexical analyzer it find all tokens then a symbol table is created and it is updated at every phase accordingly, but I read this online notes and here is the statement The lexical analyzer produces a single tokens each time it is cal...
So a few days ago my lecturer told us that for every nondeterministic polynomial time oracle machine $M$, there is a nondeterministic polynomial time oracle machine $N$ that gives us $L(N^{3-SAT}) = L(M^{3-SAT})$ and $N$ makes a single query to its oracle. He didn't give us a clear explanation for why this is true. My ...
I mean if $L'$ defined as $L'=\overline{L}$, when $L\notin RE,coRE$. From the logic point of view it should be $L'\in RE \cup coRE$, isn't? But it's not make sense for me, where am I wrong?
I have the following algorithm runtime: $T(1) = b $ for some positive constant. Otherwise, $T(n)=8T(\frac n 2) + 100n^2$ I am trying to prove that it is $\Theta(n^3)$ by induction. I proved that it is $\Omega(n^3)$ using constant $c=\frac b 2$ and $n_0=1$. I am trying to prove that it is $O(n^3)$ by induction (without ...
I need a polynomial algorithm that finds the minimal length cycle in a directed graph containing a specific edge (u,v), or prove that this is NP-hard. All edges weigh the same. Thanks
What is if we have f(n) = 15n^2logn +500n^2,5 , g(n) = n^3 + 1000 , h(n) = 21n^3logn , x(n) = 50n^2,5 + n*log(n) How to check " is f(n) O(g(n) or O(h(n)) , or O(x(n)) and why? and other examples? like is h(n) O(g(n)) or is f(n) O(n^2logn)
If we have a string rewriting system within the alphabet $\{X,Y\}^*$ and the rule $XY\to YX$. How can we prove by induction that on every string input the system terminates?
I think that everyone will agree that the following class achieves data abstraction (hiding of its internal representation): class A { private List x = new ArrayList(); public List getX() { return this.x; } public void setX(List x) { this.x = x; } } But could we say the same about...
I am currently working on some analyses of the Berlin road network, and I am using OSMNX to get a relevant graph representation. I noticed that - if with drawbacks - many authors use planar representations when working with road networks. Geoff Boeing, the author of osmnx, has concerned himself with the issue, too (htt...
The problem I'm trying to solve reads as follows: Given a graph $G=(V,E)$ ,a parameter $k$ and two values $U^\star, P^\star \in \mathbb N$, where every vertex $v\in V$ has a utility and a pollution $u_v,p_v \in \mathbb N $, we define $U(v)=\sum_{w\in N(v)} u_w$ and $P(v)=\sum_{w\in N(v)} p_w$. The goal is to find a ve...
I have to test if $ \sum_{n=0}^\infty \frac{n^2}{2^n} = O(1)$. To show: $ \sum_{n=0}^\infty \frac{n^2}{2^n} \le c \cdot 1$ So my attempt was: $ \sum_{n=0}^\infty \frac{n^2}{2^n} = \sum_{n=0}^\infty n^2\frac{1}{2^n} $ then split the sum to $ \sum_{n=0}^\infty 2^n \cdot \sum_{n=0}^\infty \frac{1}{2^n} $ With: $ \su...
Is there a substitution, so that the following recurrence relation can be solved using the given version of the master theorem? $$ T(n) = 2T(n/2) + \log n $$ Let $a,b \in \mathbb{N}$, where $b > 1$, let $g\colon \mathbb{N} \to \mathbb{N}$ belong to $\Theta(n^c)$, and suppose that $t(1) = g(1)$. $t(n) = at(n/b) + g(b)...
I am currently learning complexity theory and wasn't able to find a tightest lower bound to BigOmega(n!), I am quite certain it isn't n^n and so wasn't able to reach to a tightest lower bound, can log(n)^n be the one, of course lose lower bounds are possible, but can you please help me understand the tightest lower bou...
The exact definition of $3SAT$ and $MSAT$ are as follows: $3SAT :=$ each clause has exactly 3 literals $MSAT :=$ At least half of the literals of every clause are True My intuition was, as we know that for $3SAT$ we have clauses with $3$ literals, we might just add $2$ new variables, wich are always True. This ensure, ...
I have the following problem statement: Is G well-defined here? I am unsure of this since there's no production rule for $X, Y, Z$, and this confuses me a bit. And secondly, how do I prove $L$ is regular? I was thinking the grammar might be right-linear, but I'm not sure if this is the case. Do you have any ideas on h...
I want to sort a list of n items with a comparison sort. However, one of the comparisons made by the algorithm will be flipped from what it's supposed to be. Specifically, there is one pair of items for which the comparator function consistently gives the wrong result. What is a efficient n*log(n) sorting algorithm tha...
I don't have a strong CS background so apologies if the question is trivially simple: So I am working on an algorithm, say $A(n)$ , which runs over all integer partitions of $n$. Now the algorithm calls a sub-routine $S(\pi)$ for each of the partition $\pi$ (and does nothing else). The time-complexity of running the su...
I have an algorithmic question. Suppose there is a ground truth binary tree of N nodes and there is an oracle which answers queries of the form: given any user specified pair of nodes a and b, do a and b have a ancestor-descendant relationship and if yes, which of them is the direct ancestor of the other?". Now assumin...
I want to find the answer for $$\sum_{i=0}^{\log_3 n-1}i\times 3^i$$ Can you please explain? I this a geometric series?
I was reflecting on what I learned about demand paging and I have a question: In demand paging, we have entries in the page table only for frames that are present in physical memory. So I was wondering how could a page fault (not because of a bug , occur in such a state). In my class we where shown an image : My confu...
I want to sort a list of n items from pairwise comparisons. Each round, I receive k comparisons, one each from k different "arbiters". The arbiters cannot coordinate, and must choose their comparisons independently from myself and each other. How should they choose their comparisons so that I can sort the list of items...
As I am headed into a Computer Science major wishing to eventually become a software developer, I wonder this: should I immerse myself in computer science theory and knowledge (data structures, algorithms, how computers work). I think today many developers can just get by knowing their own tools and technologies depend...
You have n items x[0], ..., x[n-1]. Beforehand, you're given a list of several comparisons c[0], ..., c[k] for those items (e.g. c[0] = (x[0] < x[4]), c[1] = (x[3] > x[7]), etc.). The objective is to sort the items by requesting as few additional comparisons as possible. For example, if c contains all the pairwise comp...
I'm not sure if my solution to the following problem (adapted from Exercise 20, Chapter 4 of Algorithm Design by Jon Kleinberg and Éva Tardos) is correct. I would appreciate it if anyone could point out any logical flaws in it. The problem: Let $G=(V,E)$ be a connected graph on $n$ nodes. Suppose each edge $e$ in the g...
Variant of 0-1 Knapsack Problem is when you can choose exactly $k$ items from $n$ items, and $k$ is positive integer parameter that came in the input. Is there an algorithm with running time complexity $f(k) \cdot n^{O(1)}$ when $f$ is some function of $k$ only without $n$ that solve the Variant of 0-1 Knapsack Problem...
When I started doing programming I wondered that why the variable names can't start with integer. Back then I accepted that , may be this is how the compiler designers have decided to go with. But now I am studying Compiler Design and they say that lexical analyzer produces token and it is easy / fast if we use identif...
There are $3$ red socks, $4$ green socks and $3$ blue socks.You choose $2$ socks. The probability that they are of the same color is Answer: $\dfrac{^{3}C_{2}+^{4}C_{2}+^{3}C_{2}}{^{10}C_{2}}=\dfrac{4}{15}$ But my approach was to $1-$all unfavorable cases $i.e.$ $1-\dfrac{RED*GREEN + GREEN*BLUE + RED*BLUE}{^{10}C_{2}}$...
First definition: $A_{TM}$ = $\{ <M,w> | $M is a TM and M on w accepts$ \}$ Second definition: $E_{TM} = \{ <M> |$ M is a TM and L(M) = $\phi \}$ Let $T^{A_{TM}}$ be an oracle Turing machine with an oracle $A_{TM}$. We want to show that $E_{TM}$ is Turing reducible to $A_{TM}$. $T^{A_{TM}}$ = "On input $<M>$, where...