instruction
stringlengths
35
29.1k
I receive a vector of varying length such as [0, 1, 2, 3, 2]. The value corresponds to the yield and its position to a time slot. Hence, at the first time slot the yield is zero, at the second period it is 1, etc. I need a procedure that can combine this vector with itself at varying periods in order to ensure that the...
I am considering the following problem: Input: 2 Graphs G=(V,E), H=(V',E'). G and H are directed multigraphs Question: Find a subgraph in G which is isomorphic to H Is there any algorithm available for checking subgraph isomorphism in Multigraphs (specifically for multiple edge types) ? If yes, what is the complexit...
We know that $L=\{0^{m^2}\mid m\geq 3 \}$ is not a regular language. However $L^*$ is regular because we can generate $0^{120}$ to $0^{128}$ by some concatenations and then any other power of $0$ can be generated just by concatenating $0^9$. Hence we can represent $L^*$ using a FSM. My Question : Here I got these num...
1) In Booth's bit-pair recording technique how to multiply a multiplicand with 2? 2) In booth's algorithm for multiplication/Booth's bit-pair recording of multipliers, the sign bit extension of the multiplicand i.e. we must extend the sign-bit value of the multiplicand to the left as far as the product will extend. No...
The following is a quote from Sipser's "Introduction to the theory of computation" A Turing machine $M$ accepts input $w$ if a sequence of configurations $C_{1}, C_{1}, \ldots , C_{k}$ exists, where $C_{1}$ is the start configuration of $M$ on input $w$, Each $C_{i}$ yields $C_{i+1}$ , and $C_{k}$ is an accepting ...
I feel like the answer is no but I'm not sure. I think it's commonly accepted that DFS runs in $O(|V| + |E|)$ time. I've read a few explanations and they all make sense if the neighbour traversal for any given vertex can be done in arbitrary order. But I've noticed a commonly suggested DFS behavior is to traverse the n...
From my homework: Consider a 2-way set-associative cache with eight 32-byte blocks. Instructions and operands are 32-bits. There are an 8- bit data bus and a 16-bit address bus. A sample code is run a program that is saved from 1000H to 10FFH address and repeated 20 times. Suppose the cache memory is empty before runn...
Locality sensitive hashing works well when matching is between vectors of scalars, but I now need to extend LSH to compare matrices. Each matrix is formed of n readings from m sensors forming a n by m matrix. Comparison between differing columns is inappropriate. I could turn the matrices into vectors of length n * m ...
Can someone help me giving a pseudo code to this problem : There are two groups of processes , A and B. Maximum 3 Processes from group A or group B(only from one group) can use the given resource . How can this be implemented using semaphores ? I'm thinking of something like this : Semaphore work = 1 semaphore nProcess...
Introduction: I'm using divergence here as to mean that the gradient is getting further and further from zero in stochastic gradient descent. I've written my own feed-forward neural network and tried to use it to solve several incredibly basic problems of binary classification such as: Being given two random real numb...
In this paper Walker presents an extension of STLC with linear and unrestricted types. The proof of type soundness is left as an exercise to the reader. I encountered difficulty when attempting to prove progress (in a theorem prover): $$ \vdash (S_1,e_1) ~\Rightarrow~ \textsf{value}{(e_1)} ~\lor~ \exists S_2 \exists e_...
Was wondering since all the types are spelled out constructively, and the constructions can all be reflected symbolically on a computer, if you can automatically parse expressions in a type?
So I am extremely confused with using bitwise shifts used to extract the bytes from an integer. I find that if I do something like this... int i = 512; i & 0xFF; // this gives me the first byte That must mean i & 0xFF gives me the first byte that is stored in memory. In other words, i & 0xFF is the first of the four ...
Maximum weight clique problem has some attention but i could not find any efficient approaches to this problem yet. I acknowledge that it is np-hard, but are there any known approximations? Given a fixed n and an undirected graph, the problem can be defined as finding n disjoint cliques which maximize the sum of the ve...
I was analyzing the time complexity for recursive algorithms like merge sort, but when I came across that recurrence, [I think that equation is called a recurrence right?] I couldn't differentiate between a which mean the number of subproblems and b which in my slides it says is the factor by which n is divided by.
I am not looking for the complexity of following algorithm but rather how to think about the problem and calculate complexity of a given solution? One way is to perhaps use The Master Method for recursive functions, but that hides the "how?" part. I am trying to get much better at calculating complexities of algorithms...
I've been looking into behavior trees, but I cannot find a lot about them. The Wikipedia page pretty much only mentions sequence and selector nodes. I have found implementations that also provide memory selector, memory sequence, and parallel sequence, as well as some decorators like inversion and repetition. I found s...
I have heard a colleague of mine giving the following statements to a student, but I am not quite sure if he is right. The statements were about Multi Layer Perceptron and the Backpropagation algorithm, he said that: It would be reasonable to check it up if the data to be input to a MLP should be checked first its degr...
I have a directed acyclic graph with a score on each edge. The score of a path is defined to be the sum of the scores on the edges along this path. The probability of a path is the score of such a path divided by the sum of the scores of all paths. I would like to compute the marginal probability of each edge; i.e., ...
How to prove that if the set and its complement are recursively enumerable, then this set and its complement are recursive? My idea is that we can make the characteristic function of recursively enumerable set to be a total function using characteristic function of the complement (we can compute both $\chi_A$ and $\chi...
I have a question on the node2vec algorithm described in this paper. Node2vec is a deep learning algorithm that word2vec to graphs to learn embeddings. The authors claim that it can help find nodes with similar "roles", or nodes whose connections have similar structure within the graph (structural equivalence), such as...
I'm talking about the ability to safely run a virtual machine on a physical device that is not trusted. It is necessary that the owner can not access the data that the virtual machine operates on. I am interested in what theoretical or practical implementations exist without special hardware. I know about homomorphic c...
Here are four tenets I cannot reconcile: Double exponential time algorithms run in $O(2^{2^{n^k}})$ time with $k \in \mathbb{N}$ constant Exponential time algorithms run in $O(2^{n^k})$ with $k \in \mathbb{N}$ constant The former bound grows stricly faster than the latter; i.e., there exist algorithms that run in doub...
How is it possible to prove that this assert is not true?
Computational complexity results are often explained in intuitive terms as statements about the possible efficiencies of algorithms to solve certain classes of problems. However, on a more formal level, all (many?) results actually build on the underlying notion of Turing machines, which provides a precise way to defin...
Say we have some complicated function that determines if a string matches an XSS attack string, and throws an error or does something else in that case. function somethingWithXSSVulnerability(x) { var regex = /<script(.*)>(.*)<\/script>/ if (x.match(regex)) { throw new Error('XSS') } else { return x } }...
I've been trying to theorize how to solve a certain type of problem for months now. Suppose you have a collection of $m$ pre-defined $(d+2)$-dimensional vectors like so: $$(v, s, m_1, \dots, m_{d})$$ In this case $v$ represents the primary objective value, $s$ is the size of each object, each $m_i$ represents addition...
Context, I have a geometric algorithm that is sensitive to collinear points and receives as input a list of points in 2D generated randomly. Suppose that I have a Boolean function nonCollinear(x,y,z) that given three points returns true if they are non collinear and false otherwise. Is there an efficient algorithm to g...
During an article I am writing, I encountered the following problem: Let $N=(G=(V,E),W,C)$ be a network with a graph $G$, a weight function $W:E\to R$ and an integer capacity function $C:E \to N$. Find a circulation $f$ with minimal cost $W(f)$ such that the number of edges used by the circulation (i.e., edges $e$ s.t...
We know if every language in $EXP$ has polysize circuits, then $P\neq NP$ and $EXP=PSPACE=\Sigma_2^P\cap\Pi_2^P$. If every language in $PSPACE$ has polysize circuits, then does it give anything (note if it gave does $P\neq PSPACE$ then this would give $P\neq PSPACE$ unconditionally since $P\subseteq P/poly$ and $P=PSP...
Why is primary needed in pBFT algo? Since many issues of viewchange etc. come up because primary may be faulty - is it possible to have a version of pBFT which doesn't have nodes assigned as primary? Or does having a primary node fulfill a function which is crucial?
Whenever we load a process (which consists of object code, static and global variables, stack and heap space) into main memory it would be of fixed size. But, the program doesn't know in advance how much heap memory is it gonna need? Is there some fixed stack and heap space given to each process of some size in advance...
I have the following language : $L=\{\langle C_1,C_2\rangle \text{ | } C_1 \text{ and } C_2 \text{ are two circuits that calculate different function}\}$. We can call this language SAT-2C. Prove that $L$ is NP-complete. 1) Proving that $L \in$ NP is pretty simple : given the values of $C_1$, $C_2$, it is possible to ve...
I came across problem asking whether given statement is true and false. The statement given was as follows: Every Type-2 grammar can generate regular language. I felt that Type-2 grammar means, its context free grammar and is generated by PDA. PDA is more powerful than FA which generate regular languages. Hence any T...
I'm trying to find a problem that is computable but not in NP. I checked and I havent found any duplicates(I hope so too). We were asked if there is a problem that exists that is computable yet doesnt lie in NP and we should name the problem and explain why is it so?
First, an example of a set of constraints which turned out not to be solvable (I don't think): b < 3 && c + a > 5 && a - b > 2 && c > 1 && b - c > 3 My procedure for solving this is roughly: Okay b is less than 3, and c > 1. 1 + a > 5, so a > 4 in that case. Try 4 - 2 > 2, no that doesn't work, so maybe a is 5, 5 - 2 ...
I am given an list of numbers and A number-s. I need to find out the collection(s) of numbers from the list of numbers whose sum corresponds to the given number s. for example - the given set is [2,8,3] and given integer 9 Then I can tell {3,3,3} or {3,2,2,2} can be the required sets. Unfortunately I cannot figure out...
When talking about the complexity of a given operation, say multiplication of numbers, one usually counts the number of "elementary operations" that are required. For example, a common argument says that multiplying two $n$-digit numbers with the schoolbook standard method takes $O(n^2)$ operations, while more sophisti...
Given $(n, k)$: What is the minimum number $x$ of (binary) strings such that all $n$-bit (binary) strings are within $k$ Hamming distance of some string? Is there an asymptotic expansion or lower bound, at least? A somewhat-trivial lower bound is as follows: There's $\sum_{i=0}^{k} {n \choose i}$ strings within di...
I have come across many definitions of the DPLL algorithm but haven't been able to follow them. The ones that are closest to making sense to me are the ones based on state-transition systems with transition rules such as defined here: $F$ is a CNF formula, $C$ is a clause, and $M$ is a model. A description of it is as...
Let's say I have an android app that frequently sends current GPS location of the user. If person is driving with bus, I can easily get GPS location of the bus and display it on the map and update it accordingly every 30 seconds. Let's say that instead of one bus there are 3 buses driving along same route. My problem i...
Imagine you have to solve this question (+ you have obstacles, i.e. walls), but you're allowed to move in any of 4 directions (not just 2: down and right). How can you solve it? I'm struggling to apply the same dynamic programming principle. EDIT: one more similar question.
I checked wikipedia PCB and its written that - Since PCB contains the critical information for the process, it must be kept in an area of memory protected from normal user access. In some operating systems the PCB is placed in the beginning of the kernel stack of the process since that is a convenient protected locati...
I have a square matrix M, which originally looked like this: 133 199 101 121 142 133 199 101 156 142 133 199 108 156 142 133 (so symmetric around the diagonal). Not only that, but each diagonal is constant, so M'[i, j] = M'[p, q] if i + j == p + q , however it has been shuffled both row-wise and column wise. The only...
Definitions Assume we have a Shopping List $L$ which is a list of pairs of Items and Quantities: $L = [(i_1, Q_1), (i_2, Q_2), (i_3, Q_3) ...$ We also have a Stock List $S$ which is a list of pairs of Containers and Prices: $S = [(C_1, p_1),(C_2, p_2), (C_3,p_3)...]$ Each container is a list of 3-tuples of Items, Quant...
My first question was a little too simplified in that it turned out to be an integer linear programming problem solvable with the Simplex Method. However, what I think I am wondering about is how to solve constraints across multiple theories, as with SMT solvers. To demonstrate, I have created a set of constraints usin...
According to Ryan Williams's answer $ALT\text{-}SPACE(a(n),\log n)\subseteq NSPACE(a(n)\log n)$. Does there exist any better bound (for example something like $ALT\text{-}SPACE(a(n),\log n)\subseteq NSPACE(\log (a(n))\log n)$), or is it tight or an open problem?
So i am given a system of 20 bits virtual addresses and 18 bits physical addresses using paging with pages size 4Kbytes. I am told to find the maximum number of virtual pages that a process can have and the maximum number of physical memory frames the system can have. So 2^12 page size makes 12 bits for offset and 8 bi...
For example, consider L* algorithm for learning a regular language, or A* search algorithm. What do these names - in particular, the star character - mean? It looks like it might be the case that the star is used in a way similar to the Kleene star - e.g. apparently, A* was preceded by A1 and A2.
I have a guess about the problem above. Suppose I have a binary search tree $T$ initially empty. Suppose I drawn $x_1,\ldots,x_k$ (from some real interval $[a,b]$) keys and I want to insert the keys in such order in $T$, what's the expected depth/height of this tree? My attempt is the following, suppose $x_1$ has been ...
I can do the very simple transitions but it gets difficult when you have transitions jumping over 1 or more states. I have this difficult DFA i need help converting to RE: using STATE ELIMINATION if you could explain ripping state q1 from the DFA it would help a lot
Let's take integer numbers from [1..36]. We can generate 376992 different (order is not important) five-number-combinations like (1,3,5,7,12), etc. Such five-number-combinations always have five distinct (unique) numbers. Each such five-number-combination always contains 5 four-number-combinations (like (1,3,12,7), etc...
On both Wikipedia and the paper it was introduced the randomized meldable heap uses the following procedure to meld two heaps: function Meld(Node Q1, Node Q2) if Q1 is nil => return Q2 if Q2 is nil => return Q1 if Q1 > Q2 => swap Q1 and Q2 if coin_toss is 0 => Q1.left = Meld(Q1.left, Q2) else Q1.right = Meld(Q1.ri...
In context-free grammar, are both the following grammars correct for the same language? $$L = \{a^mb^n : m, n \in N_0 \text{ and } m \ne n\}$$ (grammar one) $S \to S_1 | S_2$ $S_1 \to A_1B_1$ $A_1 \to aA_1 | a$ $B_1 \to aB_1b | \epsilon$ $S_2 \to A_2B_2$ $A_2 \to aA_2b | \epsilon$ $B_2 \to bB_2 | b$ (grammar two) $S \t...
I struggle to find this, suppose I apply any feature detection algorithm. From my references it seems to me it's not usually explained what kind of data structures would be suitable for storing such features. For example in opencv it seems to me that the Canny Edge detector will return a matrix (I assume the code/gray ...
Can artificial intelligence solve problems like Post correspondence problem?
When I read the book "A Practical approach to compiler construction" the chapter 4 "approaches to syntax analysis" and the section 4.2.3.3 Left Recursion, it says: "The left recursion has been removed at the cost of an extra non-terminal symbol" I have no idea why say that, since $A_1$ still contain recursion?
From what I understand data entropy controls the limit of data compression and it depends on the probability of the characters in the file. Assuming that we have a file of size 256 bytes containing 256 different symbols and we made a bigger file consisting of many copies of that file, And because the small file has the...
I'm reading Schrijver's Theory of Linear and Integer Programming, and I have a problem understanding cycling happens in the simplex method. The simplex is described as below: Solving $\max\{cx\mid x \geq 0; Ax \leq b\}$ At each stage a set $C_k$ is maintained, which consists of $n$ linearly independent equalities from ...
I have a set of tasks, and a LTL specification that describes which orders of the tasks are legal. I want to find a way to enumerate all permutations of the tasks that meet the specification. For example, suppose there are two tasks, A and B, and the LTL spec <>(A&<>B) is. This spec says that A should eventually be d...
Consider the set disjointness problem. Alice and Bob hold n-bit strings $a$ and $b$ respectively. They would like to compute the function $$ \text{Dis}(a,b) = \begin{cases} 0 &\text{if } \exists i : a_i = b_i = 1 \\ 1 & \text{Otherwise}\\ \end{cases} $$ It is well known that this problem has ...
I am studying binary trees and I am failing to see what numbers can be inserted into this specific node position. The values to pick from are : 16, 24, 36, 45, 49, 51, 58. I have tried values 24, 36, 45, and 16, 24, 36. I have tried these values because going from left to right, they go in increasing order. Though thi...
In an answer to this question, a sketch of the proof that total computable functions are not enumerable is made: Because of diagonalization. If $(f_e:e \in N)$ was a computable enumeration of all total computable functions from N to N, such that every $f_e$ was total, then $g(i)=f_i(i)+1$ would also be a total computa...
In an algorithm I'm designing, I need to do this cycle on a priority queue of constant size N many times, as quickly as possible: get $K$ highest priority elements (do on them some outside calculation) append $4K$ kind-of-sorted elements back into the priority queue, removing and ignoring the first $K$ elements from...
What is the point and application of recursive and recursive enumerable languages. Finite Automaton is used for pattern matching, designing computer architecture and protocols, CFG is used for designing compilers but what about Recursive and Recursive enumerable languages?
Assume that a full binary tree is layed out in memory recursively in the following way. First the Root followed by Tree representation of left subtree followed by tree representation of right subtree. Assume tree is complete and full. If a search path requires to go from array location $a[i]$ to $a[k]$, then its refer...
How does exactly 1 in 3 sat work given the variables Xi, Xy, Xz if one of the variables in the formula are negative. We know that the results are if they are all positive given that: R(Xi, Xy, Xz) = TFF FTF FFT How would the result look like if one or two of the variables were negative? R(-Xi, Xy, Xz) or R(-Xi, Xy, -X...
Why does set of all strings over the alphabet {0,1} is represented by (0+1)*? As per my understanding (0+1) means either 0 and 1 and * means 0 or more occurrence of the given string. Now when we do (0+1)* it looks like we have to select either 0 or 1 and do a * on that so the resulting should be something like $\{\eps...
Is $\Omega \left(\frac{n}{\log{n}} \right)\subset \tilde\Omega(n)$?
I have a sorted array $A$ of non-arbitrary elements. Now, I have another element $c$ and I want to find out where it belongs in the sorting of $A$. The cost of comparing $c$ to $A_i$ is $\Theta(i^2)$. I do not directly care about the number of comparisons, I just want to minimize the sum of the costs of the comparisons...
Given a set of points on a plane find the set of $n$ points that are closest to the origin. (Points are pairs of integers.) Input: list of points. Initialize a priority queue $Q$, where priority is measured according to the distance from origin (larger distance is higher priority). For each point $p$: Add $p$ ...
Assuming each node stores its depth, how can I achieve this? Note that I'm not talking about a binary search tree so I shouldn't need rotations. All I want is filling the tree from left to right.
There are $n$ jobs where each job $i$ has an arrival time $r_i$, a deadline $d_i$ and a cost $c_i$. The problem is to find a scheduling time $t_i$ (where $r_i\leq t_i\leq d_i$) for each job $i$ in order to minimize $$\sum_i\max_{j\in S_i}(c_j),$$ where $S_i$ is the set of jobs scheduled at time $t_i$. Can we solve this...
1D Pink noise, is easy enough to generate. See https://www.dsprelated.com/showarticle/908.php for example. What about higher-dimensional pink noise, such as 2D or 3D pink noise? Is there an algorithm to generate that? EDIT: One approach might be to simulate a natural process, since pink noise often arises in nature.
In the 1988 paper Rotation Distance, Triangulations, and Hyperbolic Geometry, Sleator, Tarjan and Thurston show that for any pair of $n$-node binary trees, the maximum rotation distance between them is $2n-6$ for all $n \ge 11$. They also claim that this bound is tight for sufficiently large $n$. I see how they achiev...
This is the definition of a handle: 1.A “handle” of a string is a substring that matches the RHS of a production. And 2.Whose reduction to the non-terminal (on the LHS of the production) represents one step along the reverse of a rightmost derivation toward reducing to the start symbol. I don't understand the second co...
So first off do the modern operating systems like windows and linux have a method for detecting starvation? if not, why? and if they do, then how are they going to detect starvation of a process? (this was a question in our exam) my take was this so correct me if this is not good or not possible: i said we should impl...
Suppose, we have two non-overlapping convex polygons $A$ and $B$. How can we draw one straight line which divides $A$ into two parts of equal area and also divides $B$ into two equal area parts? Also, can we do this in complexity $O(n^2)$ or better? ($n = |A| + |B|$)
I came across this implementation of PJW and it seems incorrect: h = ( h << 4 ) + ( k ); if( ( g = ( h & 0xf0000000 ) ) != 0 ) { h = ( h ^ ( g >> 24 ) ) ^ g; } In a more readable form: h = ( h << 4 ) + k; g = h & 0xf0000000; if( g != 0 ) h = h ^ ( g >> 24 ) ^ g; (Syntax: << and >> are bit shif...
Most of texts say VLIW, which is lack of hardware to detect hazards and schedule the instructions. But I haven't see any evaluation about how much VLIW can save area(h/w complexity) and power compared to matching superscalar. Any reliable source is welcomed. Please share with me.
At work we build large machines, these get deconstructed, placed i crates and shipped away to the client. Now we are just guessing how many trucks we need and how we lay the crates out to fit as many of them inside a truck. For example: We have a truck and want to load 8 crates of equal size into it. There are 2 possib...
I am trying to solve a two dimensional combinatorial problem. Hereis my input space {{RA1,RA2},{RB1,RB2},{RC1,RC2}} and i have to choose two out of three elements{A,B,C} and one out of two possible variations for each of these elements {1,2}. I have an objective function to maximize and i have some constraints. Based ...
Suppose we have a weighted tournament graph. (A directed graph in which every pair of distinct vertices is connected by a single directed edge.) The weights are constrained to be 0 and 1. I know that every tournament contains atleast one hamiltonian path and can be found in time complexity $O(n^2)$. However, I have t...
A device is generating 14-bit integer which is stored as int16 (short), a scaling process will then scale the data to value of order 10E-3. Does it then matter if I store these number with half float or single float? Suppose the scaling factors are just single float.
The Minimum Cardinality Exact Cover (MCEC) problem is just like set cover, but the output sets must be disjoint. Formally, given a collection of subsets $S$ of a finite set $U$, the problem asks for a subcollection $S'$ of $S$ of minimum cardinality such that the union of $S'$ is $U$, and $S_1 \cap S_2 = \emptyset$ fo...
I have recently created a sudoku solver using C#, which outputs the solution to a sudoku after a reasonable amount of time in many cases. I have used the basic sudoku SAT-reduction (i.e. x111 meaning this is true if column 1, row 1 is filled by 1). The method I have done this does not take in a large clause of variable...
I'm stuck with this problem: Given $L$ a CFL on the alphabet $\Sigma$. Prove that $L^r=\{x^r|x\in L\}$, where for each $a\in\Sigma$ and $y\in\Sigma^*$, $$\epsilon^r=\epsilon,$$ $$(ay)^r=y^ra,$$ is context free or not. Since I don't have the alphabet I cannot think of a grammar that generates this language, so I decide...
What does it mean that "replace the process's memory space with a new program"? So who's memory space will be replaced by whom?
I proposed a new sparse coding algorithm which has good results compared to the baselines, however, it has a non-convex optimization framework. I solved the problem using a general solver (e.g. Matlab), and although the solution is local optimum, it is still better than other relevant approaches. So how important is t...
I have an Excel with 40columns and 20k rows, and i have to store it in a database but i cant figure the best approach for it, the excel format is like this: This table has 30 columns for days, then 11 columns for the next 11 weeks and then 9 columns for the next 9 month, in resume the first month is in days the next 3 ...
I am confused how to solve this recurrence equn. after a particular step (step involving ? in the picture) (Plz help me solve the question with same method which I have used and correct if any of the steps are wrong!) Attached is what I have done so far..
I am studying data structures from Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein, and in the section of heapsort it talks about a data structure beneath the algorithm : a heap, that means, a binary tree with all of its levels complete except possibly the lowest, which is filled from the left up to ...
The question is pretty much explained in the title. I have the necessary discrete math background and would like to learn algorithms and data structures in the process (of coding) - so the book quoted in the title seems a good read. Since the author states clearly in the preface that the book is suitable for an advance...
I was going through the concepts of AVL tree and came across the definition of AVL tree from the wiki. In computer science, an AVL tree (named after inventors Adelson-Velsky and Landis) is a self-balancing binary search tree even most of the definition claims that AVL tree is BST, but is every AVL tree needs to be BS...
Suppose we have an $m \times n$ grid or table, with $m$ being the number of rows and $n$ being the number of columns. The user can select the number of colors (let's say $k$ colors) and how often each color is allowed to occur (i.e., we have a vector of numbers of occurrence of the colors $(i_1, i_2, \dots, i_k)$). The...
I thought about these languages: $$L_{1} = A_{TM} = \big\{ \langle M, w \rangle \mid M \text{ is TM and }M \text{ accepts } w \big\}$$ $$L_{2} = \overline{HALT_{TM}} = \big\{ \langle M, w \rangle \mid M \text{ is TM and }M \text{ doesn't halt on input } w \big\}$$ Their intersection: $$L_{1}\cap L_{2} = \big\{ \langle...
For problem explanation: https://www.geeksforgeeks.org/tug-of-war/ I know the exponential solution to the problem, but can it be improved by greedy or DP approach. If yes then please explain the ideology of the solution. Also please mention if there are exceptions to this greedy or DP solution where it may not apply.
I was just solving an exercise when the answer of this suprised me : We have a memory hierarchy built with 2 levels of caches and a main memory, the access time of the L1 is 1 cycle, for L2 it's 10 and the main memory can be accessed in 100 cycles. We are then asked to calculate the AMAT of this memory. The miss rate o...
Is that a "thread" consists of both "user thread" and "kernel thread" as two parts? And when I create a "thread", is that I create a "user thread" and another "kernel thread" is created "in the background" by OS also? I'm confused because of the second picture. The book I'm reading is "Operating System Concepts, 9th ed...
I need to design a data structure to which I can efficiently add new words(Strings) and search for an existing word. Also, the search word can contain . in it which can match any character. For eg. if I add strings "abcd" and "abed" then search for "ab.d" should return me both of them. I tried to tackle this using pref...