instruction
stringlengths
35
29.1k
Treesort sorts input by putting input into a binary search tree and then flattening the tree. In some cases the tree can become unbalanced and so a self-balancing tree is required. There is no requirement for a self-balancing tree if the input is first randomly jumbled up first. However, one cannot shuffle a stream of ...
I know that the intersection of a regular language and a context free language is a context free language. I've seen this fact proven on here and other websites. However, after spending hours reading through proofs, I don't really understand the general idea of the proof itself. I'm not looking for a formal proof, but ...
I recently came across this blog post by Brian McKenna explaining row polymorphism. This seemed like a wonderful idea to me, but then I realized it smells an awful lot like bounded parametric polymorphism: With row-polymorphism: sum: {x: int, y: int | rho} -> int function sum r = r.x + r.y With bounded parametric poly...
Are there scaling concepts regarding the number of components needed and minimum program length needed to solve a problem of some complexity? For example, problems are characterized by O(.) measures of time and space complexity. Space complexity tells me the amount of memory needed but not the number of computational c...
I am trying to understand some notes regarding the A-star algorithm. The example used is to show how the algorithm can be used as a (more efficient) alternative to Dijkstra's algorithm for finding shortest path. I am reading about A* search starting page 71 of the UK GCE Computing textbook, Rouse to find shortest path....
Suppose we want to sort an array that contains $n$ different integers in the range $[1,2n]$. It is known that this requires $\Theta(n\log n)$ comparisons. But comparing integers which might be as large as $n$ might requires time $\Theta(\log n)$ since we have to compare them bitwise. So, apparently the runtime complexi...
An optimisation problem that allows to solve a NPC decision problem through a polynomial reduction is called NP-hard. For these optimisation problems no polynomial algorithm is known. Symmetrically, is there a standard name for all those optimisation problems for which a polynomial algorithm is known?
I have to evaluate my information extraction program. I have to evaluate it by the expectation-driven way. I don't know what that means. I would appreciate if you could help me. Thx.
In "Multiple View Geometry in Computer Vision" Chapter 12. Structure Computation, page 310-313, triangulation is used for point 3D reconstruction. There are three methods mentioned: Midpoint method that "finds the midpoint of the common perpendicular to the two rays in space". Linear triangulation methods that uses SV...
What is the difference between a memetic algorithm and a cultural algorithm? I mean they're both evolutionary algorithms where they select a subset of the population to apply some local search logic. And I think that even their metaphor is pretty similar.
I'm trying to find if the following CFG is ambiguous. \begin{align*} M &\to 0R \mid 1R\\ R &\to 1RR \mid 0 \mid 0M\\ P &\to 0PP \mid 1 \mid 1M\,. \end{align*} When doing the parse tree, do I treat $0R$ as two separate things or as one? If I treat all those things as separate, when I get to $0M$, do I go b...
I have a series of line segments $l_i=(a_i,b_i)$ with $i=1,2,3...n$ $a_i$ and $b_i$ are their starting and ending points coordinates in $x$ axis. The question is how to find a algorithm that is strictly cheaper than $O(n^2)$ and it yields number of pairs $i,j$ such that $l_j$ completely contains $l_i$ and $j>i$. I kn...
I'm trying to prove L={w∈{0,1}∗:w contains more 00 substrings than 11 substrings} is a non regular language using Myhill-Nerode theorem. I'm a bit lost and not sure what to do. Thanks
I have an n-ary tree and I want to get all possible representations of the tree that "cover" (for lack of a better term) the tree. Here's what I mean by cover: Suppose we have the following tree 1 / \ 2 3 / \ /|\ 4 6 5 7 8 | 9 I want to somehow obtain the following: 1 2...
Input : Two matrices $A$ and $B$ of size $n$ X $n$. Compute : Matrix product $A$ X $B$. Some of the known results about matrix multiplication are given below. Brute Force : $O(n^3)$. Nader H. Bshouty : at least $2.5$ $n^2 -$$o( n^2 )$ [over binary field] multiplications. A lower bound for matrix multiplication A paper ...
Is there an algorithm that fills the area outside the edges? e.g.: From this to this
I'm trying to find a regular expression for the following language: $$L=\{x0y : \text{$x$ contains same number of 0's as $y$ contains 1's}\}. $$
Ok. You'll have to bear with me because I'm new to this. I have an idea for a research project. It involves trying to predict a path that someone might take in an indoor environment. My idea is to use smartphones to gather various sensor readings(accelerometer, gyroscope, magnetometer...) while the person walks his nor...
Let $\Sigma = \{0,1\}$, with $w \in \Sigma^* $ and $value(w)$ the not negative integer value of $w$. $w$ is seen as binary string, with its first index being the least significant bit: $$value(w_1 w_2 ... w_n) =  \Sigma_{i=i}^n 2^{i-1} w_i$$ The languages is defined as: $$L = \{a_1b_1a_2b_2 ... a_nb_n \ \in \ \Sigma^* ...
Usually, in MR images one hypothesis research communities are making is, " the spatial intensity distribution is piecewise constant and that each tissue corresponds to a unique grayscale level. Based on that hypothesis, a valid correction method should lessen the standard deviation in intensity for each tissue."(Paper ...
Nodes have values. Node n's value is denoted n.val. Two or more nodes can have the same value. A node n is a category 0 node or more simply a '0' node iff n.val % 4 == 0. A node n is a 1 node iff n.val % 4 == 1. A node n is a 2 node iff n.val % 4 == 2. A node n is a 3 node iff n.val % 4 == 3. Nodes can be matched as...
Given a randomly generated maze of dimensions n x n, with the entrance point always being the top left corner (0,0) and the exit point always being the bottom right corner (n,n) what is the theoretical worst-case running time of finding a path through this maze? The maze has a density of d (for example, if d = 0.5, th...
i just want to double check with what i concluded from this parse trees. A / \ / \ B C / \ / \ 0 D D E | | 0 1 from the above tree i get right derivation to be A -> C C -> D|E E -> 1 D -> 0 and the left derivation as A -> B B -> 0|D D -> 0 i just ...
I'm studying B+trees and I'm trying to understand how actual data can be stored in a physical file and still allow fast lookups. None of it would be in memory, all of the pointers would be "seeks" to different portions of the file. Specifically I'm trying to figure out a way to do text searches. Hence the leaf nodes wo...
this may be a shot in the dark, but I am trying to teach myself more machine learning concepts. I have found a textbook and am trying to work through the exercises in it. Could anyone help me with this example? Example: Use genetic algorithm to solve the following optimization problem, including the initialize populati...
Given a $3\mathsf{SAT}$ form to decide satisfiability takes exponential time. Any boolean function has an unique polynomial representation. So decide $3\mathsf{SAT}$ satisfiability reduces to whether a given polynomial is identically $0$. However deciding $\mathsf{PIT}$ is believed to be in $\mathsf{P}$ since we think ...
I want to come up with a good algorithm that takes as input an undirected graph $G$ and checks which vertices to include in an output graph $G'$, such that each vertex in $G'$ has degree at least 3. I've thought about traversing the graph once to eliminate any vertex with degree less than 3 since none of these can be i...
Using the fact that the satisfiability problem is NP Complete, demonstrate that the 3-Dimensional Matching problem is NP Complete. I am currently in need of clarification of the proof of the above statement as given in the Combinatorial Optimization text by Papadimitriou and Steiglitz. I am a graduate student in mat...
Can a deterministic finite state transducer output ϵ (epsilon) ? A Deterministic Finite-state Transducer (DFT) is a device much like a DFA, except that its purpose is not to accept strings or languages but to transform input strings into output strings. Informally, it starts in a designated initial state & moves...
I need to construct a finite automata which accept a language $L = L_1 \cap L_2$, where $L_1$ and $L_2$ are given below. $L_1 = \{ w \mid w $ is divisible by 2 } $L_1 = \{ w \mid w $ is divisible by 3 } I know how to design a finite automata for a single number but how do I combine the automatons which check divisi...
I need to find N! (mod 232-5) such that 0 ≤ N ≤ 264 for i cases, 0 ≤ i ≤ 1000 in 1 sec. Credits: https://dmoj.ca/problem/factorial2 I am aware that I only have to handle 0 ≤ N ≤ 2 ≤ 232-6 because once N ≥ 232-5, N!≡0 (mod 232-5) . A naive solution would take O((232-6)*1000). I have also tried using Wilson’s Theorem an...
I have a directed acyclic graph whose vertices are either red or black. I want to perform edge contraction between pairs of red vertices only, and avoid introducing cycles. The goal is to have the fewest number of red vertices remaining (and no cycles. Note that after edge contraction, the resulting self-loop is remove...
Given a DFA, A, let L(A) denote the number of words A accepts. I think it's easy to calculate L(A): Translate the encoding of A into a regular expression. If the Kleene star appears anywhere in the expression - the language is infinite. Else: Go through and count all the combinations of words that are possible to make...
A language $L$ is definite if there is some $k> 0$ such that for any string $w$, whether $w \in L$ depends on the last $k$ symbols of $w$. How can I prove that every definite language is accepted by a finite automaton?
I am confused how to check if an algorithm I made is asymptotically optimal. At the very least, the running time is constant at O(4). This is because you will need to check at least 4 names. At the very most, the running time is linear at O(n). This is from n + n + n/2 + n/2 + n/4 + n/4 + .... = 2n * (1 + 1/2 +...) <...
There's a concept I've used frequently where I create an O(n) operation for finding the sum of all subsets ai...ai+L where L is the length of a subset. i ← 0 j ← i - length of subsets subsetTotal ← 0 while i < length of a   subsetTotal ← subsetTotal + ai   if j ≥ 0     Save subsetTotal to a collection     subse...
I was looking for a StackExchange site that would be the best for this question, so if this isn't the best place, please feel free to redirect me elsewhere. I have worked as a Freelancer somewhat out of concern that I would flop on the quote coding interview unquote. I ran across a book called the self-taught programm...
I found an algorithm which sorts the digits of a number to its smallest form. IE 54321 ==> 12345. The algorithm looks like: int main() { int x = 0; cin >> x; for ( int l = 0; l < 10; ++l ) { int rem = x % 10; int tx = x / 10; while ( rem || tx ) { if ( rem ==...
How can a polynomial such as $x^3 + 1$ be converted to its binary form of $1001$. Likewise, $10100001 = x^7 + x^5 + 1.$
Let's say that I'm given a $n\times n$ ($n\leq 1000$) grid (more of like a table) and I color the grid with $n^2$ rectangles, each of a different color (let's say they have colors 1 to $n^2$ for simplicity). The color of the rectangle that is colored the latest on a cell will remain that color. For example, I could hav...
As the functions are of 2 type:1.Pre-defined/library functions,2.User defined functions. What type of function is main() function? This doubt comes in my mind while writing a program we define the main() function as we do the others. Please help!!!
How can we prove that the following problem $A$ is NP complete? Given a set of integers $S={a_1, ..., a_n}$ and a number $D$, is it possible to find disjoint sets $S_1, S_2, S_3, S_4$ such that $S_1 \cup S_2 \cup S_3 \cup S_4=S$ and $$ -\sum_{j=1}^{4}\frac{\sum_{a_i \in S_j}a_i}{\sum_{a_i \in S}a_i}\log_2(\frac{\sum_{a...
My attempt is We can fairly easily build an expression containing no a, one a, or one aa: (b+c)(€+a+aa)(b+c) but if we want to repeat this, we need to be sure to have at least one non-a between repetitions: (b+c)*(€+a+aa)(b+c)*((b+c)(b+c)*(€+a+aa)(b+c)*)* Therefore the final answer is (b+c)*(€+a+aa)(b+c)*((b+c)(b+c)*...
I need to train SVM with 2 different features..the problem is one feature is the HOG with length 144 and other an RGB value with length 3.. Can i combine these two features to train SVM and test using the same? the code iam using is X1=xlsread('train1.xlsx'); Y1=xlsread('CLASS1.xlsx'); svmStruct1=svmtrain(X1,Y1); cl...
I'm currently working with this grammar: $S \to aSBC$ $S \to aBC$ $CB \to BC$ $aB \to ab$ $bB \to bb$ $bC \to bc$ $cC \to cc$ It is supposed to define the language $$ L = \{a^nb^nc^n : n \geq 1\}. $$ I need to know how to get through the grammar rules to end up with $L$. So I started with the first two rules which e...
I was recently asked this problem in an interview and I couldn't solve it. Need some help on how to solve this problem. Given a K-ary tree with N nodes (N <= 2000 and K <= 12) you need to assign some colour to each node. Also, each node has a value associated with it which is equal to the number of units of paint requi...
Suppose that we have been given a regular expression $L$ and then we are asked to calculate the minimum number of states in the minimum sized DFA? How can we go about solving such questions? What I thought is that first we need to convert the given regular expression to The DFA and then minimise it. Is there any bette...
While going through bubble_down implementation for min-heap in The Algorithm Design Manual By Steven Skiena, since routine pq_young_child gives the index for youngest child which can be replaced with the parent I feel the lines 10 - 13 are useless or maybe I am not able to identify the cases it handles. Here is the imp...
I would like to classify data coming from a sensor. In the literature Hidden Markov Model and SVM are used, but I would like to improve results with another methods.The picture how data and classes are as follows; x is time axis and y is sensor outputs axis. The yellow is how signal looks like and it randomly changes ...
folks. Hope you all doing well. I have a question regarding to the topic Equivalence of NFA and DFAs. While converting from NFA to DFA why we always say we'll have 2^n states, and should it be always 2^n ? Thanks in advance.
I'm taking Andrew Ng's machine learning course and week 5 covers the training of neural networks. The modified cost function for neural network training is derived from the logistic regression cost function, and is described as follows: $$\begin{gather*} J(\Theta) = - \frac{1}{m} \sum_{i=1}^m \sum_{k=1}^K \left[y^{(i)}...
I need to prove that if $L1,L2$ is regular languages $L=\left\{ a_{1}b_{1}a_{2}b_{2}\cdot\cdot\cdot a_{k}b_{k}\mid a_{1}\cdot\cdot\cdot a_{k}\in L_{1},b_{1}\cdot\cdot\cdot b_{k}\in L_{2}\right\} $ will be regular as well. My approuch is : There is $A_{1}=\left\langle Q_{1},\Sigma,\delta_{2},q_{0_{1}},F_{1}\right\rangl...
Are there useful programs that don't take inputs from a user, environment etc. such as key input, or the current time? A program that computed/printed out predefined data could be turned into a file, right?
When you insert a new item in a B+tree leaf node, and the node is full, two new nodes are created and they're both filled halfway and the values get re-distributed accordingly. Before the insertion: After inserting 6: Problem that I'm having is that this leaves lots of empty spots across my nodes. I could even end up...
The algorithms I've seen for building an LL(1) parse table involve calculating first and follow sets such that: predict(nonterminal, production) == if epsilon in FIRST(production): first(production) union follow(nonterminal) else: first(production) where production is a sequence of symbols...
I'm having a hard time understanding the following. Assuming we have a complete graph with $n$ vertices, where initially, one of those has an information. At this point, all we care about is that in each time $t$ a node that has the information chooses randomly one of it's neighboors and sends it the info, only if the ...
I need help with my CS homework, and I don't quite know what to do.. The problem is to define a function and return a string as shown as: 1111 2222 3333 I wrote my function as: def steps(): for i in range (1,4): string = str(i) * 4 print(string) How do I put in the little spacings? I k...
Problem: I am trying to solve the $N$-Queens problem using Constraint Satisfaction and Heuristic Repair (also known as Min-Conflicts). I wrote a program to do this for any given $N$ queens and $N * N$ board. I observed that a solution should be found in $N$ passes or less (since we need to find $N$ non-conflicting loca...
In this article : Kinodynamic Motion Planning B. Donald, P. Xavier, J. Canny, J. Reif https://www.cs.duke.edu/brd/papers/src-papers/jacm-final.pdf The authors present a PTAS algorithm that can compute a safe, close to optimal trajectory from a point A (having a certain speed vector) to a point B (having a certain spee...
I am a musician/producer and very interested in the way humans are able to identify sounds. I am interested in a way to have an algorithm identifying different instruments that were originally mastered as stereo or mono. Maybe computers would be able in future to isolate different instrument tracks and remaster them. ...
We have a DFA $A = (Q,\Sigma, \delta, q_0, F)$. States $p, q$ $\in Q$ are equivalent, $p \sim q$ if $ \forall w \in \Sigma ^ \ast$ $ \delta^*(p,w) \in F \iff \delta^*(q,w) \in F$ States $p,q$ are equivalent after $i$ steps, $p \sim ^i q$, if $ \forall w \in \Sigma ^ \ast$ such that $|w|\le i$ $ \delta^*(p,w) \in F \if...
I'm writing an algorithm that, given a limit N, and given a list of elements of value V, find all the possible combinations so that the sum of the elements is equal to N. Note that several elements can have the same value. A simple example to demonstrate this, if N=16, and that we have 3 elements, a, with a value of 3,...
I have a DAG with $n$ nodes and $n-1$ edges. The edges in DAG (fixed) are defined as follows: For every node $i$, $1 \le i \le n-1$ is connected to node $i+1$. The lengths of the $n-1$ edges are given as input. I need to compute the sum of all of the distances between all pairs of different vertices, i.e., to compute...
Is there a numbering (not Gödel numbering) of all computable functions $U(p, x)$, such that the set of numbers of functions defined in zero is exactly the set of even numbers. More formally: $I = \{p,\ |\ U(p, 0)\ \mathrm{defined}\} = 2\mathbb{N}$. My guess that it's true. But I'm not sure how to prove it. Ideas: We c...
I'm trying to understand functional dependencies in databases. Let's say, there are 3 tuples in an instance of a certain relation S as shown below. I'm trying to determine if a certain functional dependency will hold over S. Please correct me if I'm wrong. 1) A -> B should hold because no 2 similar value of a give 2 d...
I'm having trouble with this problem. Can't find a CFG. Someone an idea? $$L=\{a^n b c^n | n \ge0\}$$
Let $s = \{x_1, x_2, \ldots, x_n\}$ be a set of $n$ random non-negative integers where $\sum_i x_i = n$. And let $\{y_1, y_2, \ldots, y_{\sqrt{n}}\}$ denote a subset of size $\sqrt{n}$ of $s$, chosen uniformly at random. Defining $y$ to be $\sum_i y_i$ I am interested in calculating the value of $y$. By linearity of ex...
I am trying to do automated programming research: business software generation from the knowledge base that is implemented as Scheme (Lisp dialect) code (in the framework of http://opencog.org/ Atomspace). My question is - how to generate Java source code in academically acceptable way? I know or I can imagine several ...
In my CS class, we've discussed two ways of dealing with the temporary array required for the merging phase of mergesort. One of them is to pass a full-size temporary array as a parameter, e.g. merge(array, tempArray, first, last), and another is to create a temporary array of appropriate size (or two half-sized arrays...
Why is big omega of finding a peak in an unsorted array Omega(lg n), not Omega(1)? I understand that peak finding is O(lg n), because in the worst case, we find a peak in the last possible step, so when drawing a decision tree, the height of the tree (lg n) would be the worst case situation. However, in the best case, ...
Does affinity propagation work well for for multidimensional data? While I was reading about it I couldn't find much information on this topic and all the examples I've seen we about 2D data. Could it be that Affinity propagation is still good for 3D and 4D data but is bad for 10+ dimensions? I am quite sorry for askin...
I have noticed that while doing research in computer science you come across many weak but negative results. Now, not every negative result deserves a paper of its own. So I was wondering, is there a website where people can dump their weak results? If so, how do I look about on this website? For example, recently we s...
I am trying to understand quantum computing concepts and have gone through alot of websites and books such as: Quantum Computing by Mikio and https://people.eecs.berkeley.edu/~vazirani/f04quantum/notes/lecture1.pdf So I do understand conceptually how to make measurements but I have enclosed images of a circuit i devise...
Let $G$ be a DAG with $v \in V$. Suppose that there exists some $i$ such that for all topological orderings $v_1, \ldots, v_n$ we have $v_i = v$. What's a set of necessary and sufficient conditions about $v$ for this to occur?
I am learning OS from Silberschatz book. I read the Valid-invalid bit in a process page table also. But I could not understand why valid-invalid bit is required. The pagetable is dynamically built as pages are mapped to frames. So all the entries in page-table are valid. thanks
I see that most definitions of what it is to be Turing-complete are tautological to a degree. For example if you Google "what does being Turing complete mean", you get: A computer is Turing complete if it can solve any problem that a Turing machine can... While it is very well defined whether different systems are Tu...
I have a problem at work where I have set of hyperrectangles, in no particular order, that do not overlap and when unioned create a hyperrectangle with no gaps. At the moment I am looking for a way to efficiently figure out which hyperrectangle a given coordinate is within. I do not always have too many hyperrectangle...
For example, many reductions from $A_{TM}$ will often have the lines: Simulate M on w: if M accepts ... else But: a reduction is a computable function, right? So why are we allowed to say "if M accepts"? Also, I can take the same logic and reduce $A_{TM}$ to a deciable language: Let L be the empty lang...
I am working on a proof of the theorem that every LEFT-RESET Turing machine has an equivalent conventional, single tape Turing machine. The transitions for the LEFT-RESET Turing machine are {Right, RESET}, and the transitions for the conventional Turing machine are {Left, Right}. Here is the general outline of my proof...
I am going through the book operating system principles by Hansen . Hansen begins the third chapter on concurrent programming by discussing interleaving of the machine instructions of processes being run at the same time . Then it begins with providing the language notation for multiprogramming and writes the followin...
Reading this wikipedia article on B Trees, I have implemented the algorithm. I got to the section on Initial construction and ran my algorithm implementation and it differed. With 8 being the root index. Am I right in thinking, that when you bulk load your leafs are going to full, but when you add the indexes individua...
I want to figure out how two languages are different. If we have TM M and TM N, how would I figure out if the languages are different? My intuition is that if a M accepts an input a and N does not then that would prove the languages are different, right? I'm not too sure if I'm thinking of this correctly.
So, I'm refreshing my undecidablility knowledge, and I came across this statement reading about Post's Correspondence Problem on Wikipedia: A simple variant is to fix n, the number of tiles. This problem is decidable if n ≤ 2, but remains undecidable for n ≥ 5. It is unknown whether the problem is decidable for 3 ≤ n ...
Let be $k\ge1\in \mathbb{N}$. Is there a deterministic automata graph that recognizes the language $L_k=\{w|w \mbox{ contains an a within the k last chars}\}$ ? The language is $\{a,b\}$. Reformulation : the question is like : How to construct an automata that does $L_k=\Sigma^*(\Sigma^k\mbox\ b^k)$. (I'm not sure...
I am currently running my head around to understand if i am actually getting it correct or not? A memory chip with 1 byte cell size has 12 address lines. How many data lines does the chip have? What is the memory size of the chip in Mbytes? 12 address lines means it has 2^12 cells in the memory, right? Then what is MBy...
We have $A_{TM}=\{(M,w)|M$ is a TM, $w\in \Sigma^*_{TM},M$ accepts $w\}$ We intend to show that $HALT(M,w)\leq_T A_{TM}$ i.e. if we are given a machine for $A_{TM}$, we can decide whether $M$ halts on $w$ using it. So, if $M$ accepts $w$, machine halts and we are done. But if $A_{TM}$ says rejected how to know if $M$ h...
For proving a language is not CF, I was wondering when we split up the string to 5 pieces are we allowed to proportion it anyway as long as we satisfy the following conditions : \begin{align} |vwx| &\le p \text{ (pumping length)}\\ |vx| &> 0 \end{align} Could I possibly make the $u$ value take on a majority of the str...
I read a paper which mentioned routine induction many times. But when I google it, there are nothing showed up. I think routine induction means the induction on the structure, analyzing possible cases in proofs. am I right? Just to make sure, I am asking it here.
I am a little bit confused about the emptiness problem of the linear bounded automaton (LBA). I know that this problem is undecidable. However if we assume that is decidable, what could be wrong if we reduce it to the acceptance problem of LBA?
Are Interrupts really just an abstracted form of polling? I saw a system-file-watcher library that stated it used polling, as opposed to listening for events. Is the .NET framework SystemFileWatcher class just an abstraction of polling? In a computer, interrupts are stacked, and the CPU checks the interrupt stack after...
$L$ is the class of languages that are decideable in logarithmic space on a deterministic Turing machine. In other words, L = SPACE$( \log n)$ But why $\log n$, instead of $\log^2 n$ or $\sqrt n$. This is what, I find out in the Theory of computation book by Michael Sipser Theory of computation book by Michael Sipser...
The general question, as the title suggests, is: What is the difference between DS and OR/optimization. On a conceptual level I understand that DS tries to extract knowledge from the available data and uses mostly Statistical, Machine Learning techniques. On the other hand, OR uses the data in order to make decisions...
Is there any difference in between these two declaration: (1). char ch; (2). char ch[2] Actually the thing because of which this question arrived in my mind is the ending with '\0' i.e. null character so one of the 2 characters of the array ch[2] is null character hence only one character can be input in this. Please...
This was adapted from Quantum Mechanichs for Computer Scientists. On this equation, we have $I$ representing the identity operator, with $Z$ being defined for 1 bit as: $$ Z|0⟩ = |0⟩, \quad Z|1⟩ = -|1⟩\,.$$ The operation $\frac 12{(I+Z_1Z_0)}$ acts as the identity for the two-bit states $|00⟩$ and $|11⟩$ while returni...
Given an NFA, to decide if it accepts a word w, one could use the following algorithm: Transform the NFA into a DFA. Then, run w on the DFA and accept/reject if the DFA accepts/rejects. Could this be done on a linear bounded automata? How do I know for sure that the encoding of the DFA won't go over the input space?
Knowledge bases and expert systems are usually production rules systems and as such they lack expressive means for expressing modalities like "agent believes in statement", "agent has duty to perform action", "agent has permission to perform action". Modalities are usualy written as modal operators (diamond and square ...
I have the following 2-bit binary multiplier (source: wikimedia.org) How can I modify this 2-bit binary multiplier to make it a 3-bit binary multiplier? I notice that there are 2 half-adders, and there are a bunch of ANDs to begin with. It is tricky to see a pattern here, I would normally use a truth table but there w...
What does it mean if I'm given a description of a TM? Does that mean, that since I'm given I know exactly what M will accept/reject/loop? Not sure exactly of what to think
Texts on microprocessors use lines like the following ones : "The instructions in an instruction set of a microprocessors have their own address " "In the first clock cycle the instruction is fetched from its address and then the operands (variables) "It was a breakthrough to realize that both the instructions and vari...
I am working on $\lambda$-terms and trying to prove the $=$ is an equivalence relation on $\lambda$-terms. My problem is proving reflexive relation. $\frac{}{\theta \vdash x = x}$ $\frac{ \theta,x \# N, y \# M \vdash M = [y := x]N } { \theta \vdash \texttt{$\lambda x.M$ $=$ $\lambda y.N$} } $ $\frac...