instruction
stringlengths
35
29.1k
I'm trying to solve the following recurrence. \begin{align*} B(2) &= 1\\ B(n) &= B(\lceil n / \log_2 n\rceil)+\Theta(n) \end{align*} Here is my attempt: \begin{align*} B(n) &= 3B(\lceil n/\log_2 n\rceil) + \Theta(n)\\ &= 3\big(3B(\lceil n/(\log_2 n)^2\rceil) + \Theta(n)\big) + \Theta(n)\\ &= 3\big(3\big(3B(\lceil n/(...
If given a sorted array of n distinct positive integers. And each element is incremented or decremented by a number between 0 and X. For positive integer X that is a function of n. Formulate an algorithm that takes the inc/dec array and sort it. Make the run time O(n) when X is constant. I am unsure with my solution. F...
We are given two decision problems: $Q_1\colon I_1\to\{0,1\}$ and $Q_2\colon I_2\to\{0,1\}$. By definition, if there exists a function $f\colon I_1\to I_2$ such that for each $x\in I_1$ we have $Q_1(x)=Q_2(f(x))$ then $Q_1$ can be reduced to $Q_2$ by $f$. Now suppose that $Q_1$ can be reduced to $Q_2$ by a given $f$. M...
If I have the following statements: For Idempotent: Since X * X = X, would that imply that ~X * ~X = ~X For Dominance: Since X + 1 = 1 would that imply that ~X + 1 = 1
I am trying to convert the follow language $$L = \{0^m1^n \ | \ 0 \le m \le n \le 2m\}$$ We have an exam in 2 days and the professor didn't teach us much about PDA's. They will be on the test though and I am freaking out because I have no idea how to do them. Could anyone give me a hint or get me started on this exampl...
I've been studying np-completeness proofs by reduction, and was wondering whether my approach to the following problem is viable. Define an Euler graph as a graph that 1) is connected, and 2) has every vertex with even degree. Input: An Euler graph and an integer $k$. Problem: is the given graph $k-colorable$? Show tha...
I am wondering why this $T(n)=3T(n/4)+n⋅lg(n)$ recurrence can be solve by Master Theorem case 3 but this $T(n)=2T(n/2)+n⋅lg(n)$ recurrence can not be solve by Master Theorem what is the difference between this two recurrences. When I searched on google I found tow questions related with this two recurrence First Ques...
I am looking for an invertible discrete function $f:\{0,1,2,\dots,n-1\} \to \{0,1,2,\dots,n-1\}$ for some given integer $n$. I want $f(0),f(1),\dots,f(n-1)$ to return all the integers in range $[0..n)$ exactly once, but in a "messy", random-seeming arrangement. I anticipate that $n$ will be not bigger than $2^{30}$. ...
I am having a bit of trouble figuring this out. If L is context-free then we know it is decidable. The class of decidable languages is closed under complement thus, $L$ $\cap$ $L^{c}$, therefore $L^{c}$ is decidable. Does this make any sense?
What is the fastest way right now to input all of 30 million "go" move from the beginning into the computer that haven't digitized? The idea is came from Google's AlphaGo
I´ve been reading the paper "SOKOBAN and other motion planning problems" by Dorit Dor and Uri Zwick. This is a link to the paper: Sokoban+ is pspace complete In the paper, they proved that a problem called sokoban+ is pspace complete, they did it by reducing simulation of a turing machine with bounded tape to that pro...
Are there published algorithms that can convert 2D videos to 3D ones? If there are few published algorithms for this I am also interested to know how the conversion quality is.
For a maximization problem $P$, I know that an $\gamma$-approximation algorithm for $P$ produces a solution $S$ that is $|OPT|\ge |S| \ge \gamma\cdot|OPT|$ for $\gamma <1$ and $OPT$ the optimal solution for $P$. Is there an alternative definition? For example, can we say that an $\gamma$-approximation algorithm for $...
Given two binary heaps, each represented by a binary tree with 2k-1 elements, design an algorithm to merge the two heaps into one heap in linear time. I've been having some difficulty in solving this problem. One thing I have thought of is traversing one of the trees using a tree traversal algorithm and adding each ...
I have the language: $$ L = \{0^m1^n \mid 0 ≤ m ≤ n\text{ or }0 ≤ n ≤ 2m\}. $$ My goal is to give an equivalent context-free grammar for this language, but I am unsure if I am going about it the right way. So far this is what I've come up with: $$ \begin{align*} &S \to A \mid X \\ &A \to 0A1 \mid A1 \mid \vare...
During an interview I was asked to calculate the big theta complexity for the following algorithm that receives 3 sorted arrays of variable size and returns a new array which has the elements of the original 3 arrays. The algorithm is pretty basic: we set indexes at the beginning of each array and use such indexes for ...
How would you recursively add numbers? Just in terms of pseudocode how would one approach such a problem in the most efficient run time
Following is a theorem from Sanjeev Arora and Boaz Barak I am unable to prove : If $\textsf{EXP} \subseteq \textsf{P/poly}$ then $\textsf{EXP} = \Sigma^p_2$. The previous similar theorem was If $\textsf{NP} \subseteq \textsf{P/poly}$ then $\textsf{PH}=\Sigma_2^p$. The second theorem was easy to prove as $\textsf{...
A perspective transformation of a point is defined as follows: $ x' = \frac{M_{11}x + M_{12}y +M_{13}}{M_{31}x + M_{32}y +M_{33}} $ $ y' = \frac{M_{21}x + M_{22}y +M_{23}}{M_{31}x + M_{32}y +M_{33}} $ Now, say I wish to transform a uniform grid (blue) and obtain the transformed grid (green), as illustrated below. My i...
I'm trying to prove that $q$-COL $\leq^P_m q$-COL$_{2q-1}$, where $q$-COL$_{2q-1}$ is the restriction of the q-coloring problem to graphs of maximum degree $2q-1$. Now, it seems fairly obvious "if you can color a graph of any maximum degree with $q$ colours, then you can colour a graph of maximum degree $2q-1$ with $q$...
I have a structure. that consist of the following: Athlete A Athlete B Athlete C speed=10 speed=12 speed=6 endurance=60 endurance=59 endurance=64 I would like to rank the strength of those three Athletes based on their speed and endurance. I would like to give a slightly greater weig...
$$L = \{ \langle M \rangle \mid \text{\(M\) is a Turing Machine and \(|L(M)| = 1\)} \}$$ I have to prove that this is not R.E. and not co-R.E. I know how to approach these kind of problems. For $\check L = \{ \langle M \rangle \mid \text{\(M\) is a Turing Machine and \(|L(M)| \le 1\)} \}$, Here a simple reduction from ...
I am going over the proofs for the simply typed lambda calculus in the book "Types and Programming languages" by Benjamin Pierce. I am trying to find inspiration for the similar proofs for System F Omega. When I was going over the preservation under substitution proof for the simply typed lambda calculus I was a bit p...
What is the term for the object to be identified in a pattern recognition problem? So, for example, if one were matching a glyph expected to be an alphabetic letter to a set of templates, what is the glyph called? The sample?
I have the following Python code. def collatz(n): if n <= 1: return True elif (n%2==0): return collatz(n/2) else: return collatz(3*n+1) What is the running-time of this algorithm? Try: If $T(n)$ denotes the running time of the function collatz(n). Then I think I have \begin{cases}...
I was given the Language $L=\left \{ a^nb^na^nb^n |n\epsilon \mathbb{N} \right \}$ and I'm supposed to find a Grammar that generates that Language. After some trying and fiddling I found one that I think works. The question is how do I verify it? On paper it looks fine, but are there some tools check this for me? Also ...
I'm trying to implement an autocomplete feature for a search engine. I have a database of words(stemmed) that occur in the documents that I have. what I'm doing is: Constructing a graph with words as nodes and weighted edges with weights as the number of times those 2 words have been searched together. Each node also ...
We know comparison sorting algorithms use the ternary information (lt, eq, gt) garnered from a single comparison to make decisions about what to do next. Is there any research into using a metric? That is, if we compare $x$ and $y$ and we not only know that $y > x$ but we also know the value $y - x$. Presumably if $y -...
I thoroughly enjoyed my algorithms class but I felt that it lacked rigor. Most of the time I was able to intuitively understand why the algorithms presented worked and why they had the time complexity that was presented but I'd like to be able to prove such things. As such, I'd like a book that goes over lots of common...
I am trying to solve some exercises on random algorithms from this book, randomized algorithms. This is not a homework. I am only trying to improve my skills. Here is the exercise: Exercise 1.3: Consider a Monte Carlo algorithm $A$ for a problem $\Pi$ whose expected running time $T(n)$ on any instance of size $n$ and t...
I had an idea for a sorting algorithm wich is very fast, but can (potentially) use a lot of memory. I'm not a Computer Science student/graduate, only a self-taught programmer so I don't know how to evaluate it's viability. Also, I would like to know if it has already been documented and under what name. Algorithm: Get...
I'm trying to prove that P$^{NP}_{||} =$ P$^{NP}_{O(\log n)}$ where $n$ is the length of the input. So, to see that polynomially many non-adaptive queries to a problem in NP can do as much as logarithmically many adaptive ones. I know I need to see both inclusions, and have worked out the "easy" one: P$^{NP}_{||} \sups...
I'm studying about representing fractional numbers as floating-point values. It is going to be an 8-bit representation. Somewhere in the text, it is said that: "We use the first bit to represent the sign (1 for negative, 0 for positive), the next four bits for the sum of 7 and the actual exponent (we add 7 to all...
I just wanted an example in which the equation given below is not correct. $f(n) = o(g(n)) \Leftrightarrow 2^{f(n)} = o(2^{g(n)})$
Consider we have $n$ disjoint segments and a point $P$ which is not on any segment. I want to find an $O(n \log n)$ algorithm to check which segments are visible from $P$. A segment is visible from $P$ if it has a point which is visible from $P$. My idea is to use a sweep half-line with one end-point on $P$, sort point...
Disclaimer: Not a HW. Given $n$ sorted positive floating point numbers, and one has to find the minimum subset sum of size $n-k$. What would be the most efficient way? I can figure out using Brute force becomes $O(n^{n-k})$
I need help with a home task with computer science. the problem is: compare the two complexity functions: $F(n) = n^{10\log n}$ and $G(n) = (\log n)^n$. Which is $O(\ )$ of the other? Which is $\Omega(\ )$ of the other?
I am currently studying temporal logic and find it much similar to propositional logic. However, temporal logic seems to be slightly more specific because it encapsulates more precise meaning symbols, like until, eventually, next etc.. My question is are there other major differences with temporal logic and proposition...
I have been trying to manipulate pointers just for the sake of studying. I have had some problems with some programs I wrote where I had memory leak. Does this memory stay allocated even when the program returns? If yes how to deallocate it?If no why, isn't all saved in heap so only the one who has that heap pointer ca...
As a fun project, I've been working on a C# implementation of Richard Korf's - Finding Optimal Solutions to Rubik's Cube Using Pattern Databases. https://www.cs.princeton.edu/courses/archive/fall06/cos402/papers/korfrubik.pdf I actually have it working, I'm just trying to improve my solution. One thing that Korf glazes...
Is there an algorithm to decide whether a closed-form expression over integer variables using, say, $\{+,-,\times,\div,\text{^},\lfloor\text{lg}\rfloor,!,()\}$, or some other useful set of operators, is everywhere zero? For example, is $(jk)^2 +k!-2j$ always 0 when $j,k$ are integers (obviously not)? If some of the ope...
How do you set the number of words in the visual dictionary? I tried to understand the different steps to obtain the visual dictionary first: Feature detection: Examines every pixel to see if there is a feature present at that pixel. Feature description: Each image is abstracted by several local patches Feature re...
Given an undirected graph, I need an algorithm that outputs all the independent sets of size >= k (constant) in the graph. I know the problem is NPC, and I do not want to use the exponential brute-force solution. What I am looking for is to hear about the best solutions currently known to this problem. If someone can r...
I need to remove indirect left recursion from the following CFG: remove indirect left recursion from the following CFG. $$A → Ba| b$$ $$B → Cd | e$$ $$C → Df | g$$ $$D → Df | Aa | Cg$$ In the following solution, I have expanded all the non-terminals to get them converted to direct recursion, instead of indirect recursi...
Here is pseudocode for the algorithm: select(L,k) { if (L has 10 or fewer elements) { sort L return the element in the kth position } partition L into subsets S[i] of five elements each (there will be n/5 subsets total). for (i = 1 to n/5) do x[i] = select(S[i],3) M = select({x[i]}, n/10) partition ...
Denormalized numbers can represent numbers smaller than 2^(-1022) whereas normalized number cannot. So I'm curious what happens if we add denormalized number and normalized number. Actually, I have tried some tests and it seems that the computer converts denormalized number to 0. Is my thought correct?
Let's say we have $n$ items of size $si_i$ and $m$ containers, each has a capacity $sc_i$. Every container can have at most one item at a time, provided its size is less than or equal its capacity. Now we add time axis to this problem, because otherwise it would be trivial. Every item $i$ starts to exist at time $t_{i1...
Firstly, I'd like to state that I do not have any basis to the Neural Networks and I'd like you to recommend me very simple and understandable resources. While I have a home assignment for a short time, I would like to ask you for help for the following question. Within the context of Artificial Neural Networks; How i...
I have tried two sentences on my computer : 2 + 10^(-18) == 2 2^(-55) + 2^(-57) == 2^(-55) My computer gives TRUE and FALSE respectively. Why does the computer give two different results? Shouldn't the computer give the same output?
You have to find the number of arrays having N binary elements (0/1), that satisfy the Q given constraints. The constraints are of the form Li Ri Bi. Where if Bi is 0, then it means that the sum of the elements of the sub array between Li and Ri is even. If Bi is 1, it means that the sub array has odd sum. Eg. N is ...
I was asked the below question in a test at school last week and I thought the answer given was incorrect. You had to give a file format from the options for the below statement: A file created in software that most users will not have available You had two options, PDF or DOCX. I answered DOCX but apparently the answe...
Currently I have a graph (basically, a state graph) in Scala which is similar to an NFA some nodes have multiple in/outgoing edges single start state there might be multiple final states a state can contain self loops where a symbol is consumed no epsilon transitions What i'm trying to do is generate a regular expr...
I am a beginner learning theoretical computer science. While learning about CFG, I found that doing both leftmost and rightmost derivations gave me the same parse tree. So, my question is: Why is it necessary to do both of them? What are we trying to really prove by doing them?
Variable Neighbourhood Search (VNS) is a metaheuristic for solving (combinatorial) optimization problems. It iteratively explores growing neighbourhoods to find better local optima in each iteration. I'm trying to apply VNS to a problem where a/the solution is represented by a finite vector in which each element is a f...
This question comes from economics. There is a market $M$ that contains $m$ items. There is a value function $v:2^M\to \mathbb{R}$, that assigns a monetary value to each "bundle" (- subset of $M$). The function is given by $2^m$ values - a value per bundle. A price-vector $p$ is a vector that assigns to each item $x\in...
How many different finite automata are there that have 3 states $q_0$, $q_1$ and $q_3$, have an alphabet of size 2, and where $q_0$ is starting state?
In Intel's x86 architecture, imul (integer multiply) usually has latency of a few clock cycles. Those CPUs are very smart in filling the time (e.g., pipelining or out-of-order execution), but do any commercial CPUs simply let the program access the intermediate unfinished result? To be realistic, one clock cycle after...
Suppose I have a mixed integer-linear program (MILP) with variables $x,y,z$, where $y$ is a 0-or-1 variable, and I want to impose the constraint $z=xy$. This is not expressible in a MILP directly. Is there a way to express this using linear inequalities, by adding some new variables (possibly variables restricted to ...
I'm looking for a problem, where i can reduce the knapsack feasibility problem: $$a^Tx=b,\ \textbf{with} \ a\in \mathbb{N}^n,b \in \mathbb{N}, x \in \{0,1\}^n$$ to a problem, where i have a matrix with only {0,1} entries. What would be a suitable problem, where there is easy reduction?
If $U$ is a universal prefix Turing machine, $U(p)=x$ for some program $p$ and string $x$, is it true that $K(x)=K(p)+O(1)$, with $K$ being the prefix Kolmogorov complexity?
Computing Pure Nash Equilibria (PNE) is a Game Theory related problem. Deciding if there exists PNE in a given game has been shown to be NP-Complete (Gottlob et al.). I want to design a metaheuristic algorithm that spits out a strategy that is either a PNE or an approximation of such. A metaheuristic algorithm would no...
The Quadratic Programming problem is as follows: $$\min_x \{\frac12x^THx+x^Tg\}$$ $$Ax\le b$$ where $H$ is symmetric and positive semi-definite. What is the complexity of the active set method for quadratic programming? The complexity might be dependant on size of $x$ or both size of $x$ and size of constraints.
My friend gave me a question to solve. The question he asked me was: the following sequence has been generated by a 7-bit linear feedback shift register. He asked me to find the feedback polynomial. I went through some lectures on LFSR on youtube. But still I am unable to solve this. Can anyone point out how to approac...
Let $C $ be a self-dual binary $[n,k,d]$ code. I want to show that if $ c=(c_1, \dots, c_n) \in C $ then $ \sum_{i=1}^n c_i=0$ and that all the words of the code have an even weight. We know that $ x \in C^{\perp} \Leftrightarrow Gx=0$ where $ G $ is the generator matrix. Since $ C=C^{\perp}$ we have that $ G=H $ whe...
I've been looking for the proof of correctness for the A star (A*) algorithm but none of the texts and websites offer it. Mostly they are talking about the proof of optimality of the A* algorithm. I'm looking for a proof that if the heuristic is admissible, A* will always give an optimal path. Please help me understand...
I've read numerous links on the fact that wang tiles are turing complete, and details about them (links at end). However there is little talk of how to actually place the tiles. One place i read mentioned (paraphrasing) "by placing tiles only where they are uniquely able to fit, you'll evaluate the program", but I'm f...
I am a bit confused by the notation here, http://www.boazbarak.org/sos/files/lec3.pdf Given 3 Boolean variables $x_i, x_j, x_k$ what is supposed to be the meaning of $x_i \oplus x_j \oplus x_k$? Is this to be understood as say $((x_i \oplus x_j )\oplus x_k )$? And hence this is true for only $2$ cases $x_i =0, x_j =...
I don't fully understand this build-heap function. Lets assume we have array 3, 4, 5, 13, 16, 32. It seems like we swap the parent when it is less than the current A[j] but which number does the loop start with? Maybe somebody can go through 2-3 loops and show how the array changes after 1st loop, 2nd loop, 3rd loop. ...
Suppose that we have $N$ integer points on coordinate line: $X = \{x_1, ..., x_N\}$ and we have to add $M$ more points (their coordinates can be rational). Suppose that we chose some $Y = \{ y_1, ..., y_M \}$. Let's define distance between sets $X$ and $Y$ to be $$d(X,Y) = \max_{i=1,...,N} ~~ \min_{k=1,...,M} ~ |x_i -...
My friend gave me a question to solve. The question he asked me was: the foll. Sequence has been generated by a 7-bit linear feedback shift register. He asked me to find the feedback polynomial. I went through some lectures on LFSR on youtube. But still I am unable to solve this. Can anyone point out how to approach or...
I don't understand why do we need to implement Open list using priority queue? There could be other data structure. I understand the usage of priority queues from this example clearly. The newly discovered node would always be inserted at the head of the Open List. Then why do we need priority queue? This article has...
My book defines queuing delay as the time the packet waits to be transmitted onto the link. It defines transmission delay as the amount of time required to push all of the packet's bits onto the link. It defines processing delay as "the time required to examine the packet’s header and determine where to direct the pack...
My friend gave me a sequence that has been generated by a 7-bit linear feedback shift register. [1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0...
Randomized Meldable Heaps have an operation "meld", which we then use to define all other operations, including insert. The question is, what is an expected height of that tree with $n$ nodes? Theorem 1 of Gambin and Malinkowski, Randomized Meldable Priority Queues (Proceedings of SOFSEM 1998, Lecture Notes in Computer...
I study Petri Nets to model some cases related to my job. Currently, I study the basics of Petri Nets and am confused. (For the time being I couldn't get a textbook yet, I will.) my questions q1) What determines the required number of tokens required for the model to be constructed properly? What is a bulletproof think...
This is a problem from usaco, which I solved, but I don't know how to estimate the number of times you can pour milk among the jugs, my solutions just uses a big enough number. Here's the problem statement: Farmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an inte...
I'm writing a computer game and one of my game's objects must follow a movement path that is very similar to the following graph. The bold lines are the Y and X axis. In order to be able to code this movement thought I need the algebric equation that translates to this graph. For example f(x) = x^2. Is there any mathe...
We were asked this question in exam and I am not satisfied with the answer the teacher gave. Let me justify my point of view. Let there be a polynomial time function having time complexity $n^{c_1}$. If we call the function polynomial times, say $n^{c_2}$ times, then the time complexity of the algorithm becomes $n^{c_1...
I'm studying Computational Complexity and I have stumbled upon the following question which I have no idea how to even start proving. I would appreciate any help. Prove that for every function $s(n)$ such that $n \le s(n) \le \frac{2^n}{100n}$ there exists a Boolean function $f\colon \{0,1\}^n \to \{0,1\}$ such that...
This is a follow-up to this question: Array covering problem Suppose that we have $N$ integer points on coordinate line: $X = \{x_1, ..., x_N\}$ and we have to add $M$ more points (their coordinates can be rational). Suppose that we chose some $Y = \{ y_1, ..., y_M \}$. Let's define distance between sets $X$ and $Y$ t...
In this page, there are two examples of tree decomposition of a graph $G$. Could there be another decomposition such as: $\{A,B\}, \{C,E,F\}, \{D,F,G\}$ or did I get the rules of decomposition wrong? Must two adjacent vertices of the tree share two vertices of the graph? And considering these decompositions, which one...
I'm trying to use the pumping lemma proof to show that the following language is context-free rather than regular $\{ba^n bc^n | n \geq 1\}$ I've been looking at tutorials on Youtube to try and gain an understanding but as of yet I cannot get my head around it. Is someone able to take my example and show step by st...
Is it necessary to remove all lambda productions, unit productions and useless productions from a context free grammar(CFG) before converting to Chomsky Normal Form(CNF) or Greibach normal form (GNF). If so why is it required? Also my Professor said that we should convert a CFG into CNF before converting it to GNF. Is ...
Graphical models are a very useful tool with many applications, whereby a joint distribution of a set of random variables is modeled using only pairwise dependencies between the variables, and two variables with a direct causal relationship are connected by an edge, which is associated with their joint distribution. It...
I am implementing a Naive Bayes algorithm for text categorization with Laplacian smoothing. The problem I am having is that the probability approaches zero because I am multiplying many small fractions. Therefore, the probability eventually yields zero. This is because there are several words within the documents and t...
So, this might be a really simple problem but I can't seem to find a nice algorithm to solve it: Given two ranges, [a1, a2], [b1, b2] (all real numbers) and a real number n, find the length of the overlapping segment between the two ranges over a modulo of n. For example, consider a 24-hour clock and the range [20, ...
I am studying the solution to “First Readers-Writers Problem” from the book Operating System Concepts (9th edition) and it describes: First readers–writers problem, requires that no reader be kept waiting unless a writer has already obtained permission to use the shared object. In other words, no reader should wait fo...
The problem I am trying to solve is to find the fastest way to produce an total amount of something. There are several different producers that each have a different production and cost (based on the number of the item that is already owned) which can be purchased during production. For example, assume that the goal is...
Let $G=(V,E)$ be a directed graph. The "invertible" part of $G$ is the subgraph $H=(V,E_2)$ such that $(u,v)\in E_2 \iff (u,v)\in E \land (v,u)\in E$. Find an algorithm that generate $H$ from $G$ in a linear time, where $G$ is represented with an adjacency list. Non linear memory is allowed. Obviously the brute forc...
Given a directed graph $G$ and two vertices $u$ and $w$, how can we find a simple cycle that goes through $u$ and $w$? One can try putting together paths from $u$ to $w$ and $w$ to $u$ — but these might have edges or nodes in common, even if they are chosen to be shortest paths.
Say I have $k$ sorted lists of the same size $n/k$, and I want to combine them into one sorted array in $O(n\log k)$ time. The solution I came up with is to recursively halve the lists until you have sections of two lists. Then you combine them by setting a pointer at the start of each one, and placing the smaller ele...
Premise: Two types of cache miss: capacity miss, conflict miss\ Cache contains only 2 sets, SET 1 and SET 2 Problem: If data A maps to SET 1 and it doesn't exist in SET 1 while SET 1 is fully occupied and SET 2 is not fully occupied, I know this case is called conflict miss. But what should it be called if the same...
I could not find a big-oh cost for Doolittle's algorithm for LU decomposition of a matrix online, so I took a pseudocode implementation from here and analyzed it to get $$\frac13n^3+\frac32n^2+\frac16n$$ operations. However, the same document states here that there are in fact $$\frac23n^3+\frac12n^2+\frac16n$$ operat...
I am wanting to show that this language fails to show that it is not context-free. So, in essence, it satisfies the pumping lemma If L = {ambncndn | m,n >= 1 } Should I have n be the constant of the pumping lemma? Is z=ambncndn and |z|= m+3n>n ? By the pumping lemma, there exist u,v,w,x,y such that z=uvwxy, |vwx| <=n, ...
Does a non deterministic Turing machine which is a decider halt on all branches for all inputs?? I know it must halt on all branches for a string not in language, but for a string in language, NDTM requires only one accepting branch so even if some other branch is infinite, NDTM will still accept the string
I'm trying to find a "language" or a way to express any change that has occurred to a string. I'm given two strings; a seed string and a new string of the same length that came from it. I'm trying to find the "algorithm" or causes that made the second string what it is. Now, my current thinking is to come up with a "ma...
Why do we call binary search as 'Divide' and 'Conquer' strategy? It does not combine the results unlike other Divide and Conquer strategies.
I am trying to implement an algorithm that finds the key of the RC4 cipher from the inner permutation. For each key byte I have several options, each with different weight. Is there any way, to test first the possibilities with highest weight, than with second highest, and so on? Basically what I need is to generate ve...
Lately, I saw an NP-complete proof that involves creating an instance of a problem using $\infty$. Is this a polynomial-time reduction? More precisely, let a problem $\Pi$ has an instance $I=(n, A, v)$ where $A$ is a matrix of size $n\times n$, $A=[a_{ij}]$, and $v$ is positive. The proof that $\Pi$ is NP-complete work...
I have been reading a couple of texts on operational semantics. In [1], the evaluation of expressions is done as in this rule: $\frac{<e_1,s>\;\Rightarrow \;n_1\;\;\;<e_2,s>\;\Rightarrow \;n_2} {<e_1+e_2,s> \;\Rightarrow \; n_3}$, where $n_3 = n_1+n_2$. That is, the state $s$ is represented in a tuple with the expressi...