instruction
stringlengths
35
29.1k
I want to know when we enter a command in a shell then how does the computer recognize that command? Does it match that command with something already stored in files?
I'm going through Jeffrey D. Ullman's Introduction to Automata Theory, Languages, and Computations. The author reduces an instance of the membership problem in $L_d$ (diagonalization language) to a membership problem in $L_u$. Those are defined as follow: $L_d = \{\langle M\rangle \mid \langle M\rangle \notin L(M)\}$ ...
I'm trying to solve for https://projecteuler.net/problem=27, and I have to optimize one part of the implementation from slow() to fast(). Why do they perform so differently? I'm guessing branch predictions, but I don't quite understand how they are different to the optimizer. The code is in javascript. function primes(...
Given a spline, what is an efficient way to find (approximately) the least amount (and position) of key-points to approximate the spline with a line strip, so that the largest distance between the line strip and the spline at any given point is <= d. Here is a visual example. I'm looking to find a computationally effic...
After a few courses using CLRS, I still have not been able to find a satisfying answer to the title question. This answer suggests Hoffman trees. But here the greedy choice is the two subtrees with the lowest frequency. I am however not convinced, that it does not exhibit OPS, since the optimal solution to the full p...
Let denote $\mathbf{x} = \{x_1,x_2,...,x_N \}$ with $x_i \in \Bbb R$ for $i=1,...,N$ and $f(\mathbf{x},n)$ be the $n$-th symmetric sum of the set $\mathbf{x}$ $$ f(\mathbf{x},n) = \sum_{\sigma_1,...,\sigma_n} \left(\prod_{i=1}^n x_{\sigma_i}\right) $$ with $\sigma_1,...\sigma_n \in \{1,2,...,N \}$ and $\sigma_i \ne \s...
Context: Suppose I have a matrix $P_k\in\mathbb{R}^{n\times n}$ that evolves in time $k$ according to $$ P_{k+1} = H_{\sigma(k)}^TP_kH_{\sigma(k)} $$ where $H_{\sigma(k)}\in\{H_1,\dots,H_L\}$, $H_i\in\mathbb{R}^{n\times n}$ are some given matrices and $\sigma(k)\in\{1,\dots,L\}$ is a scheduling signal. My goal is to ob...
Consider a graph $G=(V, A, w)$, where each arc $(u,v)\in A$ has a non negative weight $w_{u,v} \in \mathbb{R}^+$, partition $V$ into $U$ and $W$, $W=V-U$ such that $\sum_{(i,j)\in A} w_{i,j}z_{i,j}$ where $z_{i,j} = [[i\in U \land j \in W]]$. By getting a randomized cut we have a 1/4 approximation: \begin{align} \mathb...
How to show that the following language is undecidable using reduction on the halting problem? $L: = \{w \in \{0,1\}^* |$ TM $M$ with $w = \langle M \rangle$ does not accept any input $\}$ When TM doesn't accept any input, does it mean that the Turing machine halts or it just rejects any words? And how to show that thi...
Let there are $n$ devices in the setup. Let each device sends data with a probability $p$. Successful transmission for a slot (hence of the setup in general) occurs when only one device communicates. Hence using the binomial theorem, we have $P_{success}= \binom{n}{1}\times p \times (1-p)^{n-1}$. Differentiating $P{suc...
Let $P$ be a poset on $n$ points, $\text{Aut}(P)$ its automorphism group, and $a_1,a_2,\dots,a_k$ the lengths of the orbits under $\text{Aut}(P)$. Goal: An algorithm to generate a member from each equivalence class (under $\text{Aut}(P)$) of assignments of nonnegative integer weights to the vertices of $P$ such that th...
I am to use Agda to prove some intuitionistic tautologies. One of them is the so called Weak Peirce's Law $$ ((((A \rightarrow B) \rightarrow A) \rightarrow A) \rightarrow B) \rightarrow B $$ I understand that there is an "equivalence" between intuitionistic tautologies and programs and their types, that is if I manage...
The paper I'm working on uses sets as implemented in https://docs.sympy.org/latest/modules/sets.html. A set is stored in a data structure as a sequence of intervals with open or closed bounds, so it can represent uncountable and infinite sets. What prior work can I reference for this data structure?
Assume I have a set of $N$ ordered points, $X$. I would like to find the set of $N$ points, $Y$, where the distance between $X$ and $Y$ $(d = \sum_{i=0}^{N-1} |X_i - Y_i| )$ is minimized but there is a minimum distance between points of $M$ $(Y_{i+1} - Y_i > M)$. Is there an algorithm or approach to deriving $Y$ given ...
Today, in my self-lead studies, I found out about greedy algorithms, more specifically, a greedy approach to solve The Weighted Job Scheduling Problem. I understand how the solution is implemented but, I'd love to see a proof of correctness for this solution (i.e. partial correctness and termination). If anyone can hel...
I am unable to understand how Canonical LR(1) grammar is more powerful than LookAhead LR(1). Both have lookahead symbols in their items and works almost similarly, so how can CLR(1) derive a larger set of languages than LALR(1).
I have a DFA transition table like \begin{array}{cc|c|c} & & 0 & 1 \\ \hline \to & p & qs & q \\ * & q & r & qr \\ * & qs & r & pqr \\ & r & s & p \\ * & s & t & p \\ ...
I need an $O(|V||E|)$ algorithm to detect if a graph has a minimum spanning tree with diameter 3. This paper mentions that it is possible for any diameter by finding the vertex 1-center which can be done using Floyd's algorithm, but I need something much simpler only for the case of diameter 3.
I am wondering if every problem with an output's size that grows polynomialy is $\textsf{NP}$? My thinking is every $\textsf{NP}$ problems can be solved in polynomial time by a non-deterministic Turing machine. (Wikipedia) Moreover, consider a non-deterministic algorithm, that takes in input an integer $n$ and an integ...
I am reading Computer Architecture & Organization by William Stallings to understand I/O operations. I get the general mechanisms of how interrupts are handled in computer systems, but the results of interrupts improving the efficiency of user programs with many I/O programs is kinda counter intuitive. As from what I k...
We have an algorithm problem in hand, can you please write your ideas about this, thank you! There are N many nodes with K different colors. Some of the nodes have direct connection between each other and some do not. We want to select M nodes from these N total nodes, but these M nodes must be connected. Also, our sel...
Consider the standard assignment problem: $n$ people are assigned to $n$ jobs (one person to one job) so to minimize the sum of costs. When the costs are generated randomly (using the exponential (1) distribution), it is known that the expected sum of costs is $\pi^2/6$ . An alternative solution to the assignment probl...
I have trouble understanding DAG behind the "contiguous subsequence of maximum sum problem". Let's say I denote by S(i) maximum of sums of contiguous subsequences ending in i. So S(i) are my subproblems. To calculate S(i) I need S(i-1) so the edge will be between node i and i-1. Denoting the sequence by a_i, I think my...
Given this sort of dataset: ID Score1 P1 Flag id1 0.01 0.2 False id2 0.99 0.9 True ... ... ... ... The limitations of each variable are: ID: identifier if each object, unique in the table Score1: A number between 0 and 1, that represent the value of the object P1: probability of call, betwen 0 and 1 Fl...
New to proofs (in the context of analysis of algorithms). I'm wondering, if I were to prove a greedy algorithm is the optimal solution, does this imply its correctness as well? (partial correctness + termination). I'm trying to understand how The Job Sequencing Problem is correct but can only find proofs for its optima...
Background Let L = {aa}. We know that the minimum pumping length of L is |aa| + 1 = 3. For this length all the three conditions of the pumping lemma vacuously hold true. Doubt Let L = {aa, aab}. Is it right to say the minimum pumping length is max(|w| | w belongs to L) + 1(in this case |aab| + 1 = 4) for finite languag...
At page 21 of this book: https://cs.au.dk/~amoeller/spa/spa.pdf I found this: I started reading everything and understanding it pretty well, until this. It's defining the possible types of a language. I'm very confused about what theta and alpha mean. What are those meta-variables? What is ua.t and t[ua.t/a]? Could so...
The context: I have been working lately with problems like the following: Let $x_{k}\in\mathbb{R}^n$ be a state evolving accroding to: $$ x_{k+1} = f(x_k,u_k) $$ where $k \in \{ 0,\dots,N-1 \} $, given some $x_0$ and controls $u_0,\dots,u_{N-1} \in \{1,\dots,L\}$, i.e., the set of possible controls is a finite set of "...
Consider the standard assignment problem: $n$ people are assigned to n jobs (one person to one job) so to minimize the sum of costs. When the costs are generated randomly (using the exponential (1) distribution), it is known that the expected sum of costs is $\pi^2/6$. An alternative solution to the assignment problem ...
Let $\Sigma=\{0,1\}$ and $L$ be a regular language. Prove that $$Z(L) = \{x \in \Sigma^* : \exists w \in \Sigma^* \ xww \in L \}$$ is a regular language. I tried to build a NFA based on the DFA that accepts $L$ but failed to do so. I don't know how to ensure the $\, ww \,$ part. Please advise.
I am learning computer architecture and organization. I have the following doubt. Given below is a question along with its solution as seen in number 5 of some homework assignment solutions. But I think that solution is wrong. Consider an instruction pipeline for the MIPS32 processor where data references constitute 4...
I am thinking about the following case where the data in region 1 is always positive and the data in region 2 is always negative, but the data in region 3 can be both positive and negative. Are there any existing results on finding exactly the $l_1$ and $l_2$ (or region 3)? As far as my understanding of SVM when the d...
According to Actor-Critic algorithm, $\psi_{\theta}=\nabla_{\theta}\ln \mu_{\theta}(s, a)$ where $\mu_{\theta}(s, a)$ is the policy followed by the actor and $\psi_\theta$ is the compatibile features space. The updates for the actor and critic parameters are as follows: For critic with the parameter w: $w_{t+1} = w_t ...
I have just started learning regular expressions and I don't have anybody around me to help me building conceptions. So I rely on online mediums. My question is whether every regular set corresponds a language. I had a regular expression $(0+10^*)$ and I was trying to find the regular sets. My books suggests that $L=\...
Given the language $L:= { \{ c^{2k} w \ \vert \ k \ge 1, \ w \in \{a,b,c\}^* \ and \ \vert w\vert_a \ = \ \vert w\vert_b \} \ \cup \ \{ a,b \}^* }$ I'm really unsure how to even start because of the union. I tried it with $w=a^nb^n$ but my correction said that it's pumpable because it is in $\{ a,b \}^*$ which makes ...
When we do union by rank we merge the smaller tree into the larger tree. I dont understand why we do this exactly?
I have the following definition: A green-blue tree is a binary tree that follows the following properties: Each green node has only blue descendants. Every path that goes from a node to a leaf has the same number of blue nodes. This is an example of a green-blue tree: For the first part, we can ensure that every nod...
Design a regular expression for the language accepting the strings containing at most one pair of $1$'s over $\{0,1\}$ So basically we have the language $L=\{11,011,110,0011,1100\ldots\}$. I find the expression to be $R=(0+1)^*11(0+1)^*$. But I found here the answer to be $R=(0 + 10)^*(11 + \epsilon)(0 + 10)^*$. I ca...
Language $L$ is trivial if $L=\varnothing$ or $L=\Sigma^*$. I'm trying to prove the following theorem: If $L_1\in R$ and $L_2$ is non-trivial language then $L_1\leq L_2$. If $L_2$ is non-trivial the $L_2\neq\varnothing$ and $L_2\neq\Sigma^*$. If I want to prove that $L_1\leq L_2$, then I need to show that there exis...
I have the following two languages: $$ L_{U}\triangleq\left\{ \langle M,x\rangle\,:\,M\text{ accepts }x\right\} ,L_{D}\triangleq\left\{ \langle M\rangle\,:\,M\text{ accepts }\langle M\rangle\right\} $$ I'm trying to prove that $L_{D}\leq L_{U}$. For that I need to show that there exists $f\,:\,\Sigma^{*}\to\Sigma^{*}$...
Today i wrote something about the bijection between turing machines and recursive functions. And i describe a Turing Machine as a Well-formed formula because it seems like a WFF to me. But is it correct when we say that a Turing Machine is a WFF ?
Good morning everyone. I am working with Python and Pandas. I have two DataFrames, of the following type: df_C = pd.DataFrame(data=[[-3,-1,-1], [5,3,3], [3,3,1], [-1,-1,-3], [-3,-1,-1], [2,3,1], [1,1,1]], columns=['C1','C2','C3']) C1 C2 C3 0 -3 -1 -1 1 5 3 3 2 3 3 1 3 -1 -1 -3 4 -3 -1 -1 5 ...
I have the following exercise I have been staring at for several hours to no avail. Question: Testing the monotonicity of a function - the case of bits: Given a function $f: [n] \rightarrow \{0,1\}$ and a parameter $0 < \epsilon < 1$, show an algorithm that runs in $O(\frac{1}{poly(\epsilon)})$ queries to $f$, with the...
I have been reading up on the Count Sketch algorithm, and I stumpled upon the Count Sketh algorithm explained in section 5 of https://www.cs.dartmouth.edu/~ac/Teach/data-streams-lecnotes.pdf. Then, I tried to solve some of the exercises. However, exercise 5-3 is causing me some problems. If we let $\hat{f}_a$ denote th...
Given an array of $n$ elements, containing values in the range $[1, n-1] $ (assume $ n > 1 $) this implies there is at least one repeated element. The problem is to get one of the repeated values in linear time on average. My first try was to do something with the Partition scheme from Quicksort. However, I don't know ...
In Dragon book for compiler design there is this example of SDT in Example 5.16 $L\rightarrow En$ $E\rightarrow \{ print (' +') ; \} \space E_1 + T$ $E\rightarrow T$ $T\rightarrow \{ print (' *' ) ; \} \space T_1 * F$ $T\rightarrow F$ $F\rightarrow ( E )$ $F\rightarrow digit \space \{ print ( digit . lexval) ; \}$ ...
Today I read the following text in CLRS: We say that an algorithm solves a concrete problem in time $O(T(n))$ if, when it is provided a problem instance $i$ of length $n = |i|$, the algorithm can produce the solution in $O(T(n))$ time It is ambiguous for me, because if we consider a problem in which a number $n$ is g...
I was trying to build up this regex but I am having huge expressions but nothing generates the given regex. I tried to break up the regex as $0$ multiple of five times and odd $1$'s $0$ multiple of five times and even $1$'s Bu this doesn't help me. The regex I Found was $(00)^*1(00)^*1(00)^*1(00)^*1(00)^*$. But in ...
We have a list of strings with the same length. Each string only contains a, b and c.(For instance : aabcc) The program gets a string and returns true if the two strings(input and the list of strings) only differ by one character. A = {cacab cbabc} cbbaa : False cbaac : True My first thought was to solve it with brute...
I have generated the CFG of $a^n b^m c^p$ where $m = n+p+2$: $S \rightarrow ASC \mid \varepsilon$ $A \rightarrow aAb \mid \varepsilon$ $C \rightarrow bCc \mid \varepsilon$ I have been trying $a^n b^m c^p$ where $n=m+p+2$ but cannot figure out how to represent $n=m+p+2$. Any hint would really be appreciated.
I'm working on a video game and I'm struggling with the math behind one of the enemies. The enemy is a grenade launcher mounted on a vertical rail, which can slide up and down, and lob a grenade at any angle with any amount of force. The grenade's path will be a parabola which must hit the player, but there are line ...
I'm aware that an algorithm that compresses every input doesn't exist (by the pigeonhole principle), however I tend to think about the problem sometimes and I came up with a (flawed, but why?) idea: Suppose a file, or whatever it is that will be compressed. It can be represented with a number (we can actually invert th...
I have a very silly question, when data is transferred from the RAM to the CPU is this data transferred "copies" of the original data stored inside the RAM?
I came across the following line in the book ‘Deep Learning (Ian Goodfellow) 10.2.1, pg 374; The disadvantage of strict teacher forcing arises if the network is going to be later used in an open-loop mode, with the network outputs fed back as input. Please explain the difference between these modes.
I am going through a fairly non-rigorous textbook called 'Cracking the code interview' and I am bothered by this terminology called "unit of work". It says in the textbook that certain operations take constant work, where as others take variable amount of time. For example, adding/subtracting/multiplying/dividing two n...
I'm not sure if CS SE is the right place for this question, but since originally this question was in the CS area (and I translated it to a mathematical form), I will post it here. I am given two parameters $m\in\mathbb{N}$ and $\frac{1}{2}< p\le 1$, and I want to find the maximal value $k\in \mathbb{N}$, such that the...
This exercise is taken from Goldreich's textbook of "Computational Complexity - A Conceptual Perspective", first ed., p.140. Exercise 4.3: Referring to any reasonable model of computation and assuming that the input length is not given explicitly, prove that any algorithm that has sub-linear time complexity actually h...
I need to prove that the following language is not recursively enumerable, while its complement is recursively enumerable: $L := \{w \in \{0,1\}^* |$ TM $M$ with $w = \langle $ M $\rangle$ does not accept any input $\}$. Should I use a reduction from the halting problem in this case?
I don't have a CS degree but I have recently taken up studying algorithms very seriously. I have been studying greedy and dynamic programming for days and I come across the below definition a lot, seems they all come from the same source, but I do not understand what it means, it is one of the vaguest definitions I hav...
I was wondering about some questions related to the Halting problem. I might have not understood all the assumptions in it fully. Would you kindly help me, please? I understand that the construction in the proof leads to a contradiction. My thoughts are: If one runs these theoretical programs in the real world, I woul...
we know that $n \geq \log{n}$ however I understand that $(\log n)^{\log n}$ grows faster than $n$. I have been trying to prove this however I can't seem to figure it out.
A part of ORCA local avoidance collision is calculating a linear program with an incremental approach - adding the constraints one by one. If the problem is determined to be infeasible, the constraints $g_i(x) \leq 0$ are relaxed, and we could instead solve the problem of $\min_{x,d} d$ $g_i(x) -d \leq 0, \forall i$ Ho...
Consider a uniprocessor system with four processes having the following arrival and burst times: (i) Calculate the average waiting time and also the average turnaround time if shortest (remaining) job first (SJF) scheduling policy is used with pre-emption. Assume that the context switching time is zero. Note that in S...
I have this question which is asking for the worst case time complexity for a balanced binary search tree, assume the nodes are labeled as integers and we consider a range of [nodex, nodey], nodex<=nodey. And also given that the range has exactly k nodes, k can be at most n ie. total number of nodes. The question asks...
Given a simple graph $G=(V,E)$ s.t. $2\mid \omega(G)$, Show that $\exists S\subseteq V\text{ s.t. } f_G(S)=f_G(V\setminus S)$ where $f_G(A)$ is the clique number of the sub-graph of $G$ induced by vertex set $A$. I'm have trouble proving this property of clique number. Several approaches have been tried but none lead...
It is known that for every $\varepsilon>0$ there is an appropriate neural network architecture, such that one can approximate any continuous function $f:[0,1]^n\to[0,1]^m$ by the neural network output $\hat{f}(\bullet;w):[0,1]^n\to[0,1]^m$ as: $$ \|f(x)-\hat{f}(x;w)\|\leq \varepsilon, \forall x\in[0,1]^n \quad \quad \q...
Because of the existence of free variables in lambda calculus, the evaluation of open terms (at least as outlined here) is more complicated relative to the evaluation of closed terms since the evaluator must ensure that the beta-reduction step uses capture-avoiding substitution, i.e., that the variables it substitutes ...
I am doing Shai Simonson's course on Theory of computation. I am not able to understand part b of one of its problem sets. a. Prove that languages of form $0^{mx+b}$, where m and b are positive integer constants and x ranges from 0 to infinite, is regular. b. Give an example of a regular set over the alphabet {0} wh...
Minimum Cost Maximum Flow algorithms have been known to provide an optimal flow routing for network flow problems in satisfactory runtime. Some of the algorithms for solving a min-cost max-flow problems that I'm aware of include : Cycle cancelling (reff) Successive shortest path Relaxation (reff) Cost scaling (reff) ...
It always has been bugging me that we (humans) know pretty easily when most programs we write halt or not, but the halting problem is still undecidable. I have just thought of a variant approximation-like extension to this problem, that tries to "maximize" the correct answers an algorithm can make on this problem. Form...
3SAT with the additional condition that exactly 1 or 3 literals must evaluate to 1.
I'm reading a book CLR via C# which says how Windows does asynchronous I/O: To read data from the file, ReadAsync internally allocates a Task object to represent the pending completion of the read operation. Then, ReadAsync calls Win32's ReadFile function (#1). ReadFile allocates its IRP (I/O Request Packet) and then...
Suppose there is graph problem $L$ such that the instance $x$ of $L$ is a simple graph with $n$ vertices and $m$ edges. In the Turing machine model, we can encode a graph using $O(n^2)$ cells or $O((m+1)\log n)$ cells. (i.e., $|x| = O(n^2)$ or $|x| = O(m \log n)$). Now I want to study the lower bound and the upper boun...
Is database server really really exist? i mean the server wasn't made by general purpose computer but that database device have their own hardware and architecture. We know that good database server means good in shorting data. So the database server i mean have hardware that only found inside it which general purpose ...
This is the given task: Suppose you are given an arbitrary directed graph G in which each edge is colored either red or blue, along with two special vertices s and t. Describe an algorithm that either computes a walk from s to t such that the pattern of red and blue edges along the walk is a palindrome, or correctly re...
Task: A Hamiltonian path of a graph is a path that visits all nodes of the graph exactly once. The hamiltion path problem (HPP) consists in deciding whether a given graph has such a path. Similarly, the 1/2 hamiltion path problem (1/2-HPP) asks for a path that visits exactly half of the nodes. Show that: $HPP \le_{P} ...
I am learning about regular expression, and trying to describe a regular expression for the language L $\qquad L = \{a^i b^j c^k \mid i+j = k\}$ What is the right approach and how to describe a regular expression like this?
I could not find an answer to the question directly by google. I think this question is rather simple but I am not really sure about it. Any advice is welcomed. Thanks
Let $f$ be a maximization problem. If there is a reduction from SAT to the following problem: "given an integer $c$, decide if there is an $x$ for which $f(x)\geq c$", then $f$ is NP-hard. Suppose there is a reduction from SAT to the following problem: Given an integer $c$, return "yes" if there is an $x$ for which $f...
I'm trying to develop an the algorithm for the problem: The cat-and-mouse game is played by two players, “Cat” and “Mouse,” on an arbitrary undirected graph. At a given point, each player occupies a node of the graph. The players take turns moving to a node adjacent to the one that they currently occupy. A special node...
It is usually assumed that the average time complexity of the linear search, i.e., deciding whether an item $i$ is present in an unordered list $L$ of length $n$ is $O(n)$ (linear). I have read several proofs, usually assuming either: that $i$ and the elements of $L$ take values in an infinite domain, in which case th...
Chlebik and Chlebikova prove that the problem "maximum 3-dimensional matching" is NP-hard to approximate within a multiplicative factor of $95/94$. This means that, unless $P=NP$, there is no polynomial-time algorithm that finds a 3-dimensional matching with at least $(94/95)\cdot OPT$ edges, where $OPT$ is the number ...
I have to show that this language is not context free $\mathcal{L} = \{ \omega \omega^R a^{|\omega|} : \omega \in \{a,b\}^* \} $, where the $R$ corresponds to the reverse. For this I will use the pumping motto for free context languages. I know how it works, but I have problems choosing the correct $ \sigma $, because...
I have to prove or disprove the following identities: $(RS+R)^*RS=(RR^*S)^*$ $(R+S)^*S=(R^*S)^*$ $S(RS+S)^*R=RR^*S(RR^*S)^*$ So what I tried: Not same because LHS cannot generate $\epsilon$ while the RHS can. Not same because LHS can generate $\epsilon$ while the RHS can. Not same because LHS is the set of strings s...
Need to prove $(a + ab)^*a = a(a + ba)^*$ by using regular algebra. Concatenation does not commute. So repeated use of commutativity will fail. I am getting confused about which identity I should use to prove this. What I can interpret is that I just need to change the side of $a$ but the $^*$ must be kept outside. But...
The paper "The Knowledge Complexity of Interactive Proof Systems" uses the language of quadratic nonresidues defined via the following excerpt from page 293 as an example of constructing an interactive proof system. Example 1: Let $Z_m^*$ denote the set of integers between $1$ and $m$ that are relatively prime with $m...
There are implicit versions of some set system problems or matroid problems. A set system is a pair $(U, \mathcal{F})$, where $U$ is a universe of size $n$ and $\mathcal{F}$ is a collection of susbets of $U$. $\mathcal{F}$ may satisfy some properties (e.g. Matroid). We define $\Phi$ is a polynomial-time oralce which de...
We consider the NP-complete $CLIQUE$ problem. Let furthermore $MST^*$ be the minimum spanning tree problem. Assume that $P \ne NP$ and explain whether the following assertions hold: $MST^* \le_{P} CLIQUE$ $CLIQUE \le_{P} MST^*$ Definitions: $\le_{P}$ ... Karp reduction $MST^*$ ... Given is a weighted graph $G$ and ...
I have a query in solving the problem below: An automobile company has two factories. One factory has 400 cars (of a certain model) in stock and the other factory has 300 cars (of the model) in stock. Two customers order this car model. The first customer needs 200 cars, and the second customer needs 300 cars. The cost...
Can somebody help me with this recurrence please? $T(n)=4T(\sqrt{n}/3)+(\log n)^2$
I want to compute the amortize time of a type of dynamic array (inserting such that if i have no place to insert i am multipling the array by (1+a) (a is between 0 to 1). I need to compute the time with the accounting method. The answer is that i need for each insertion a 2 + $1/a$ coins. I can see why the answer is ri...
I have two related questions: What are the ways to prove that a certain problem is in $W[t]$ in the W-hierarchy for parametrized complexity, except using the straight definition of boolean circuits? I mean, is there a similar classification like for the FPT class, that if there exists an algorithm which runs in a cert...
Suppose that $w \in \{0; 1\}^*$ is a binary word. Let's denote the number of $0$-s in $w$ as $\#_0(w)$ and the number of $1$-s in $w$ as $\#_1(w)$. Now suppose that $q \in \mathbb{Q}$ is a positive rational number. Consider the language $L_q \subset \{0; 1\}^*$ of all words $w$, such that for any its prefix $p$ we have...
Assume $P \ne NP$, and $A$ is a problem in $P$ and $B$ is a problem which is $NP-complete$. Are the following assertions valid? $A \le_{P} B$ $B \le_{P} A$ My approach: $B \le_{P} A$ isn't valid, because if $B$ is reducible in poly-time to $A$, so $B$ has to be also in $P$. But thats not possible because $P \ne NP$...
I have to show that if G is an unambiguous CFG, the transformed grammar G' in CNF is also unambiguous. But couldn't come up with something concrete. I could only visualize the case where the grammar G is ambiguous, not necessarily G' will be.
I understand what is derivative-free optimization, and I am thinking a similar problem where the function $f$ we are optimizing is unknown and the only information we can acquire is the derivative. In other words, we can get $(x_1, \nabla f(x_1)), \cdots, (x_n, \nabla f(x_n)$ to optimize the unknown function. I know th...
The context: Consider the following optimization problem. Let $f_1,\dots,f_L:\mathbb{R}\to\mathbb{R}$ arbitrary (continous) functions for $L>1$ and $x_k\in\mathbb{R}$ evolve according to $$ x_{k+1} = f_{\sigma(k)}(x_k), $$ given $x_0$, where $\sigma_k \in\{1,\dots,L\}$. We want to find $\sigma(0),\dots,\sigma(N-1)$ to...
I have a problem where I'm asked to prove that if P is a pushdown automaton, then there exists another pushdown automaton P' with only two symbols in its stack alphabet that accepts the same language as P. I've tried to codify the stack alphabet of P in binary, using the same ammount of symbols for each representation...
Suppose a process does system call, hence it goes to kernel mode, the registers are saved. Now the system call will be running in process' allocated kernel stack. Can there be a context switch when a system call is processed? Is really the system call allocated process' kernel stack? If context switch is possible, thi...
Let $L\subseteq \Sigma^*$ such that $\{\epsilon\}\not\in L$. Then for any $S\subseteq \Sigma^*, S=SL\implies S=\emptyset$. So we suppose $S=SL$ and $S\ne\emptyset$. Then $\exists w\in S$ such that $0\le|w|\le |v|$ for some $v\in S$. Now $|w|\ne 0$, since $|w|=0\implies\{\epsilon\}=w\in S=SL\implies \{\epsilon\}=xy$...