instruction
stringlengths
35
29.1k
I am interested in experimenting with machine learning on the ASTs of programming langauges (e.g. some Java code). I would like to develop an algorithm that determines if a given AST satisfies some predicate. I have a training set of programs that do and do not satify the predicate. The machine learning techniques th...
I was reading in Papadimitriou's "Computational Complexity" book Chapter 14, about Oracle Machines. Papadimitriou defines, in definition 14.3, page 339-340, Oracle Turing Machines with oracle a language $A \subseteq \Sigma^*$: The computation of $M^{?}$ with oracle access $A$ in input $x$ is denoted $M^A(x)$. So far ...
First of; this is my first computer science problem, so bear with me. That said: I'm trying to create a planning application for my summer camp (sailing school) with the goal to put everyone with different people every day (when possible). Variables defaults Group size: 4 (max. people per boat) Total people: 20 Days: ...
Column S contains the check sums of the values given in columns R and Xc. Does anyone here have an idea about how to find the corresponding algorithm to calculate the check sums? Thanks in advance R Xc S 647 72 218 441 47 618 594 67 188 581 55 517 497 58 865 553 65 661...
I want to generate a random connected simple labeled graph with $n$ vertices and $m$ edges, selected uniformly over all connected graphs with such $n$ and $m$. I found this approach. It says: build a random spanning tree using a loop-erased random walk (also called Wilson's algorithm); then add remaining $m-n+1$ edges ...
What is the exact number of loop iterations here and how do you find out? def func(n): i = 4 while i < n: print(i) i = i + 1 The solution says max(n-4,0) which is theta(n), but I am confused about how they reached this. I see it starts from 4 and can guess that this relates to the n-4, but would like to be...
Of course, whenever the Pumping Lemma for Regular Languages (or CFLs) is applied to a language $L$, only a single string $w \in L$ and $|w| \ge p$ needs to be picked (to eventually show that $w$, when pumped, leaves the language). Is there a non-regular (or non-context-free) language $L$ for which every string $w \in L...
I'm taking an Advanced Computer Architecture course and I've come across the term "outstanding" a few times and I've searched online about what it means in the context of computer science/architecture but I can't find anything relevant. For example, on my notes there are some references such as: "IBM Power5 allows 8 o...
I am building an application (RoR framework) that can help to match a tutor and a student based on their subjects, budgets, locations and freetime. I have done the first three parts(subjects, budgets, locations). Now, I am getting stuck at the most difficult one which is freetime matching. The student's sample freetime...
In the proof of TQBF-complete, it says if the input size is i, then the TM for the input has at most 2^i numbers of configuration. Can someone explain why? The proof is from: http://zoo.cs.yale.edu/classes/cs468/fall12/TQBF-complete.pdf
This is a question related to a homework assignment so I guess I'm asking for hints, if that's ok? Basically, I'm wondering if there is some way to use Tarjan to compress the nodes in every SCC found into one single node, essentially producing a DAG. The problem I'm faced with is that every SCC is obtained as a set but...
as part of my homework assignment I have to proof that the following language is not regular using the pumping lemma: $L = \{w\in \{a,b,c\}^* \; | \enspace z(a,w) = z(b,w) + z(c,w)\}$ The function $z(x,w)$ denotes the number of symbols $x$ in word $w$. I started my proof by assuming that the language is regular. That m...
A few years ago Warren Buffett started offering $1 billion to anyone who could correctly predict the winner of every game in the NCAA men's basketball tournament. A 64 team (we won't count the first four play-in games) single-elimination tournament bracket like "March Madness" has 2^63 possible bracket combination, put...
I have noticed that some applications or algorithms that are built on a programming language, say C++/Rust run faster or snappier than those built on say, Java/Node.js, running on the same machine. I have a few question regarding this: Why does this happen? What governs the "speed" of a programming language? Has this ...
This question is motivated from the question $\mathrm{SPACE}(o(\log\log n)) = \mathrm{SPACE}(O(1))$. I am wondering, how is it possible to decide a language without reading the entire input. I have seen the similar situation in space complexity ( L and NL ,where we define new model of computation). My model of comput...
I want to solve the following problem (This is a homework problem. Not looking for definite or complete answers): Maximum One Third Cut: Input: An undirected graph G=(V,E) where V={1,2,...,n}, such that |V| is divisible by 3, and a positive integral weight function w:E to N (on edges). Goal: Fin a subset of vertices U...
Programmers prefer accessing a 2D array in Row-Major Order rather than Column-Major Order, Why? Are there some advantages/benefits of accessing a 2D array in row-major as compare to column-major? Like in C programming, programmers prefer row-major rather than column-major due to the way memory is being allocated to a 2...
I have a couple of Python scripts that calculate various network measures. Given a graph (G), the first script calculates the average shortest path from each node to all other nodes and stores this in an Nx1 matrix (L). An implemntation of Djikstra's algorithm from the NetworkX Python library is used for this: for i in...
I need to prove the following asymptotic relation for the purpose of cacluating a recurrence relation: $$n^3log^4n=O(n^4)$$ I tried and failed to do it with induction, which, if possible using basic Calculus 1 level math, I would like you to help me with. I am not required to do it with induciton or anything, I just wo...
The project I'm working on has a number of objects arranged in overlapping sets. I need to classify them by whether they have a trait or not, using pre-classified objects that they are connected to (through shared set membership). I.e., the objects within the same set are likely to share whether they have that trait. T...
I am trying to align two objects based on the notion of points and their correspondence, but struggling to find a solution. I have two objects A and B. However, they are rotated in a different direction, and therefore I would like them to align. I have a notion of some correspondence between the points in object A and ...
I know that the lanuguage of all strings of odd length {a,b} can be expressed as: (a+b)((a+b)(a+b))^*. But what about an odd length over (a,b,c}?
The above is an MCQ from an online quiz given by my Algorithm lecturer. The available options are 6secs, 4secs, 12secs and 20secs. The answer I selected was 12secs and it was rejected. The lecturer said the answer should be 4secs and then I started to prove that the answer is greater than or equal to 8secs in the follo...
I'm working through a few chapters on algorithms from the Discrete Math text by Rosen. In the solutions manual there is an algorithm (specified in pseudocode) for finding the mode within a list of non-decreasing integers. Here is the algorithm: procedure find a mode(a_1, a_2, ... , a_n : non-decreasing integers) modeco...
For the worst case of a red-black tree, what would a tree with 10 nodes look like?Since there can not be 2 consecutive red nodes and there is rotation is it safe to say that it balances out the trees leveling it I tried this attempt at creating a tree with 10 nodes:
Is there a Turing-Complete-ish programming language without runtime errors? Like segmentation faults, memory leaks, race conditions, deadlock/livelock/starvation, etc.? With strongly typed languages, the compiler can detect null pointer exceptions and refuse to compile code. How much can we statically check? Everything...
I've been working on a developing a product selection network for my workplace. I work with lots of chemicals and the clients don't always know what they want/need so most of the time I have to ask a bunch of question, collect useful/ignore useless information, then make a selection from there. Discussions take place o...
I have 10,000 sequentially numbered items I wish to characterize. For each item, I created a list of the other items I think might have a similar characteristic. i.e. Item 1: [2,4,7,8,9,...,9489] (list contains 250 items) Item 2: [1,4,13,23,...,9424] (list contains 12 items) Item 3: [1,2,4,7,...,9489] (list contains 1...
How would you go about proving that this Language is Context free. I'm having issues with drawing the PDA for this. I need to prove Prove that the language L = {w | number of 11s in w is more than the number of 010s} is context free. I so far assume that when a string of 11s occur add x to the stack and when 010s add ...
Breadth first graph search adds states that have already been visited to an explored set to avoid getting stuck in loops and cycles. This is fine since breadth first search needs exponential space to keep all the nodes in memory. One of the main reasons for using iterative deepening depth first search is to avoid the e...
I would like to construct a LL(1) context-free grammar for a formal language $A$ = "strings where the amount of character b is exactly triple compared to the amount of character a" for $\Sigma = \{a,b\}$. I've tried to figure it out so that if we consider a string $w$ to have one a, then the acceptable presentations fo...
Consider the following problem. The input is a Directed Acyclic Graph. Each vertex $v_i$ may have exactly 0 or 2 incoming edges with associated vertices $v_{i1}$ and $v_{i2}$. If it has 0 incoming edges, it is considered an input vertex. The input of the problem specifies with each input vertex exactly two numbers out ...
I want to ask the acceptance problem: Whether a particular deterministic finite automaton accepts a given string can be expressed as a language, $A_{DFA}$. Show $A_{DFA}$ is decidable. The proof in the textbook (Siper page 195) uses two steps: $M$ = “On input $\langle B,w\rangle$, where $B$ is a DFA and $w$ is a strin...
Find $f\colon \Bbb{N}\to\Bbb{N}$ such that $f = n^{o(1)}$ and for every $c\in\Bbb{N}$, $f(n)=\omega(\log^c n)$. It looks like I need to find a very small growing function $g$ that will satisfy $$\lim_{n\to{\infty}} \frac{1}{g} = 0 $$ and also $$\lim_{n\to{\infty}} \frac{\log^cn}{n^{\frac{1}{g}}} = 0 $$ My first attem...
I just read an article "Statistical approach for figurative sentiment analysis on Social Networking Services: a case study on Twitter", which provide an algorithm to analyze tweets, and this article includes 2 formulas which I don't really understand. Link to the article I hope maybe someone here can help me. The fir...
I'm working on a paper about model checking on cryptographic protocols and many of the papers I have read, base their approaches in the Needham-Schroeder protocol. I undestand this was one of the earliest security protocols for authentication and that Lowe's findings makes it an interesting protocol to talk about, I ge...
By abstract machines I mean things like the SECD machine, Krivine's machine or more generally machines with states/memory/registers/stack/accumulator... According to Wikipedia page of the Curry-Howard isomorphism, we have a correspondence with the Sequent Calculus where the left/right introductions rule matches with th...
In Girard's Proofs and Types we can read : From an algorithmic viewpoint, the sequent calculus has no Curry-Howard isomorphism, because of the multitude of ways of writing the same proof. This prevents us from using it as a typed $\lambda$-calculus, although we glimpse some deep structure of this kind, probably ...
Below is a question based on CLRS, about using an algorithm to reach a balance between a group of friends. I figured the best way to do this, is through the use of a DFS algorithm. Below the question is some psuedocode I wrote using the formal algorithm of a DFS search. My question is, how do I get the algorithm to bal...
Do networking ports come from "port-mapped I/O"? I was watching a hardware basic video by Brian Will: https://www.youtube.com/watch?v=9-KUm9YpPm0 And they brought up this concept at 18:15 Initially, I thought it makes sense that networking ports come from the implementation of port-mapped I/O, but it's strange that the...
I'm trying to implement L-BFGS but I can't quite figure out how to do step sizes. I tried small fixed step sizes, but for some reason the iterates always explode whenever memory < variable size (which is kind of the whole point). So I thought I'd try some back tracking line search. My issue is, I don't want to re-evalu...
There are possibly several min-cuts for the source and target nodes of a graph. I think I can determine the same min-cut for the same graph by putting the following restriction "if there are several min-cuts, then I select the min-cut consisting of edges closer to the source atom. By saying close to source atom, I mea...
I am trying to solve a string matching problem using Rabin-karp algorithm. I made use of Horner's method for calculating hash function, but I forgot to use modulo operator. It's like this now. (this is for starting pattern length of the big string) 1 for(i=0;i<l1;i++) 2 { 3 unsigned long long int ...
I was given this function: $T(N) = 3N\log^2 N + 5N^2\log N + \log N + 17N + 2$ and was asked to find the average Big O complexity. If the Big(O) deals with an upper bound, would this algorithm be $O(N^2\log N)$ on average? But, because Big O is an upper bound, couldn't this also be $O(N^3)$, $O(N^4)$, etc.? Basically, ...
There is the following theoretical computer science, namely: For a particular monotone formula $M$ of size $n$, there's an equivalent formula of depth $\text{O}(\text{ln}\,n)$. (I am reading the original paper in my library, if I have time later I will scan it and add scans of it to this post. My apologies for being ...
I have to prove that the language $L=\{a^ib^j:2i=3j+1\}$ and the CFG G with the following rewrite rules: $S\rightarrow a^2Tb$ $T\rightarrow a^3Tb^2 |\epsilon$ are equivalent to each other. I'm going to prove this by saying $L(G)\subseteq L$ and $L \subseteq L(G)$. I was able to prove the first one. I should be able to ...
What is Architecture, microarchitecture and ISA in processor. How do they relate to each other and what is the difference between them. Elucidate their differences with examples so that it is clarified. Also, clarify, do the word computer architecture and processor architecture mean the same thing?
If I have m lists with n elements each, how would I go about finding duplicates in them (i.e. an element is in more than one of the lists)? My idea is to use hashing on the elements inside the list, which involves a O(1) hashing call on each of the elements and checking for collisions inside the buckets. However, on to...
Got this question in an exam. In a graph where all edge weights are positive, if a subset S of the edges connects all vertices and has minimum total weight, then the edges in S form a tree? True or false? This seems to be the definition of a MST, but since it doesn't state anything about cycles I'm not 100% sure.
From my basic understanding of computer architecture, a computer understands instructions and a computer program written in a high level language is converted to a set of such instructions for the computer to understand. Also, that given a set of rules are satisfied, any programming language can do what any other can ...
Please help me find the time-complexity of below recursive algo. I have guessed for first two return statements.Please correct me if I am wrong. But I can't find time-complexity of third return statement because it will loop till we get a factorial of NUM contining 0 and 7. public class Check { static long N...
Suppose that in an enterprise there is a section specialized in data prediction problems, and to make easier the software maintainance, the next decision is taken: it will be used only one algorithm and only one class of functions to approach solutions for any future problems. Will this decision benefit the enterprise?...
The problem is IV-3 of this pdf: potential function. Defining a potential function as $\Phi(i) = 2i - 2^{\lfloor{\log_2i}\rfloor+1} + 1$ The solution states that if $i$ is not an exact power of $2$, we have: $$\Phi(i) = 2i - i + 1 .$$ This means that $2^{\lfloor{\log_2i}\rfloor+1} = i$. I'm having some trouble underst...
There is a program, BEATRIX, that can understand textbook physics problems specified by a combination of English text and a diagram. The result of the understanding process is a unified internal model that represents information derived from both the text and the diagram. Here is a diagram problem and the diagram that ...
I need to describe by a graph a turing machine that can accept the language: A = {0^(3^n ) |n≥0} = { 0 , 000 , 0^9 , 0^27 , ... }. zeros in powers of 3 This here is a turing machine that can accept the language: A = {0^(2^n ) |n≥0} If that helps somehow..
I'm reading Wadler's paper called "How to make adhoc polymorphism less ad hoc". I'm trying to understand the given rules for function overload (over and inst) and I want to create a small example of a proof tree using them. All deductions rules are in Figure 9 and Figure 10. I decided to proof the following expression/...
I'm working on simulating a network architecture. I'm representing every node and their connections as a connected graph with no directional edges. I need some help with my reasoning. Every node in network is connected to exactly 3 others. Is it possible for me to prove that every two nodes have a path of length O(n/3)...
I've often heard that the C declarator syntax described as "an experiment that failed." I've seen claims that this sentiment is also shared by its creator Dennis Ritchie. Does anybody have an actual citation for this? I'm doing a related project and writing the documentation for it and it would be nice to have said cit...
How can I find the lexicographicaly smallest string that doesn't start with a given prefix AND is lexicographicaly bigger than the given prefix? Example: prefix : cat; next string : cau prefix : cazz next string; cb
I am a software engineer and after a discussion with some colleagues, I realized I do not have a good grasp of the concept serialization. As I understand, serialization is the process of converting some entity, such as an object in OOP, to a sequence of bytes, so that the said entity can be stored or transmitted for su...
To prove that $P \subseteq P_{\ poly}$ [see book by Arora and Barak, chapter 6, page no 105] Proof : Let $M$ be an oblivious TM and running time is $T(n)$, let $x \in \{0,1\}^* $ be some input for $M$ and define the transcript of $M$'s execution on $x$ to be the sequence $z_1,z_2,..z_{T(n)}$ of snapshots (the machine...
I'm trying to implement the Hindley-Milner type system, following Milner 1978, "A Theory of Type Polymorphism in Programming" (link). In the Hindley-Milner system, a polymorphic let-bound expression may take on a different type each time it is referenced. For example, we can have let id = (λx · x) in (id 3, id true) wh...
Its well known that Lomuto's partitioning algorithm results in too many unnecessary swaps. Can we modify the algorithm in this way: Initialize a pointer a that points to the first position in the array, and initialize b to a. While the element at b is lesser than the pivot, Move B by 1. Set a = b. WHILE b doesn't reac...
This question is not asking for a solution, but rather as a check / validation of my thought process. Given the form: $W = \forall X.((\forall Y.\exists Z. R(X,Y,Z)) \land \forall S. \exists T. R(X, S,T))$ The algorithm I learnt states, that I have to 1th bring $W$ into prenex form. Doing so I bring all quantors to t...
The following table shows a possible set of Huffman codes to be used for lossless compression of a text consisting only of the eight letters shown: e t o h l p w z 10 01 111 110 0001 0000 0011 0010 The codes will have been chosen ...
The minimum vertex cover problem is $NP$-hard for the planar graph of degree at most $3$. However, the minimum vertex cover can be easily found in some certain types of planar graph, given the planar representation. For example, the planar graph that every face boundary is a cycle of even length. Is there any proof th...
This algorithm runs natively in O(V * E^2). The description states that The running time of O(V * E^2) is found by showing that each augmenting path can be found in O(E) time, that every time at least one of the E edges becomes saturated (an edge which has the maximum possible flow), [...] My graph has the property ...
We have an uncertain graph $G$ where each edge $(u,v)$ exists with a probability $p_{(u,v)} \in (0, 1]$. We want to assign a score in $[0, 1]$ to each pair of vertices $u$ and $v$ which represents the likelihood that they lie in the same connected component. If the only possible scores were discrete $0$ and $1$, then t...
What does it mean that the bound $2n^2 = O(n^2)$ is asymptotically tight while $2n = O(n^2)$ is not? We use the o-notation to denote an upper bound that is not asymptotically tight. The definitions of O-notation and o-notation are similar. The main difference is that in $f(n) = O(g(n))$, the bound $0 \leq f(n) \leq cg...
As per my understanding, a program can take a different amount of time to run on different machines because it is dependent on hardware. So we use big O notation which is independent of hardware to compare the performance of two algorithms as the input grows. I am working on an algorithm which has a complexity of $O( X...
I am currently working in solving Conway's Game Of Life problem for a Parallel and Distributed Computing course. The problem is a little bit different form the original, in the sense that instead of having a 2D representation of the cells we have a 3D one, each cell is represented by three ints. When considering neighb...
Consider the following bipartite graph: Each node in red color represents a warehouse $w = \{ 1,2,3\} $. For this example we have three warehouses located at different locations. Each warehouse has a cost of opening ${c_w} = \{ 7,8,10\} $ for all $w$. In addition to that, each warehouse provides different resources ${...
I was watching the AI Stop Button Problem from Computerphile, and was very confused on the difference between two approaches. Background: there is a barebones general intelligence running in the form of some robotic device. The device acts in accordance to optimize some utility function. The GI is asked to make tea, an...
In this lecture note, The average-case running time is defined by the expected value, over all inputs $X$ of a certain size, of the algorithm's running time for $X$: $$T_{\text{average-case}}(n) = E_{|X| = n}[T(X)] = \sum_{|X| = n} T(X) \cdot Pr[X].$$ This wiki article (Quicksort) gives an average-case time comple...
What is the intuition behind the Geometric Burrows-Wheeler Transform? And how can I use a GBWT with blocking factor $d$ to match a given pattern $P$ of length $|P| = m$ with $m \ge d$ $m < d$ What benefits does it have over the standard BWT used with backward search?
I studied methods for inserting new nodes into Red-black trees for the first time this month. In doing so, I read a lot of pages on the internet and found that ( if I'm not mistaken ) there are many, many, many accepted algorithms for inserting nodes into red-black trees. Furthermore, I noticed that it is possible to h...
In other words, are they equally powerful? (for word automata the answer is "yes"; this question is about tree automata). (i am talking about tree automata that work on $in$finite trees)
How can I use divide and conquer to improve the running time of this algorithm? input: A sorted array of length n output: the # of elements such that abs(A[i]) <= k
Consider the follow operations on a stack of size at most $k$. Push - insert element in the stack - actual cost 1 Pop - remove top element from the stack - actual cost 1 Copy - copy whole stack (but maintain the number of elements) - actual cost is the number of elements in the stack Prove using the potential method th...
Assume a proper and complete binary tree $T$ with $n>1$ nodes. Let $E(T)$ represent the sum of the depths of all external nodes in $T$, and $I(T)$ represent the sum of the depths of all internal nodes in $T$. Prove that: $E(T) = O(n⋅\log n)$ To prove this that it is equal to $E(T)$, do I just go plug in numbers till ...
Is there a term for programming languages that read like written sentences? I'm thinking of languages like Python, where you can almost read the code aloud as a sentence, as opposed to C++ which is really arcane. For example, in Python if 'pizza' not in animals is very clear when read aloud. Seems like maybe there's a ...
Input : Adjacency-list representation of Directed acyclic graph (Boolean circuit). see Complexity theory by Arora and bark, page no- 104 Find : Adjacency matrix representation of DAG (Boolean circuit). My attempt : Let us assume that DAG has $n$ vertices. First of all create a $n \times n $ table for adjacency mat...
Is there a concise/existing way to denote the expressive power of "lambda calc without using parentheses/tree-of-expressions/application-order-restructuring anywhere"? Can you do without them/reinvent them? Does it break completely (i.e, even with a naive no-more-parentheses, you're using them implicitly, like when na...
I'm taking a course about submodular functions and their applications towards influence maximization in a network. We've been discussing a greedy algorithm for selecting $k$ initial nodes to maximize influence and I'm confused about a statement made in class. Let $O = \{o_1, . . . , o_l\}$, and $o_{\max}$ be the elemen...
Let $G=(V,E)$ be an undirected graph in which $V = \{v_1,v_2,\dots,v_n\}$. I need to describe a reduction from the 2-coloring problem to the 2-SAT problem (in polynomial time). I thought of splitting each vertex $v_i$ into $v_i^*$ and $v_i^{**}$, one for each color. Then I was thinking about making for each edge $(u,v)...
I would like to make a program which finds similar packets (there might be more then one class of similarity) in packet list (which is updated all the time). Are there any efficient algorithems to find these similarities? By similarities I mean that they have the same size, type and payload. I thought about using tree...
Suppose that a valid lottery ticket consists of a sequence of 7 numbers drawn from the set $\{1,2,\ldots,59\}$. Given a string like "$12345678$", I want to efficiently print all the lottery sequences using every digit in the input string. In the example above, a couple of possible sequences are: ${1,2,3,4,56,7,8}$ or ...
Let $M$ be a variant of Turing machine with no working tape but with several heads on input word. Prove that these machines accept exactly the languages in $L$. Please hint me how to start.
I have a question about the Euclid's Algorithm for finding greatest common divisors. gcd(p,q) where p > q and q is a n-bit integer. I'm trying to follow a time complexity analysis on the algorithm (input is n-bits as above) gcd(p,q) if (p == q) return q if (p < q) gcd(q,p) while (q != 0) ...
Oftentimes I find myself wanting to use integer programming to find a solution to a particular problem, without caring about optimizing a certain variable at all. I've found that most packages that offer integer programming do not provide this feature. Is it then correct to assume that maximizing/minimizing a solution ...
The following problem is from CLRS (31.1-13, Page 933, 3rd edition): Give an efficient algorithm to convert a given $\beta$-bit (binary) integer to a decimal representation. Argue that if multiplication or division of integers whose length is at most $\beta$ takes time $M(\beta)$, then we can convert binary to decimal...
There is a display of NxN (N<=90) pixels with some blocked pixels and a snake of width = 1 pixel and variable length and two players A and B play a game. The game proceeds as follows - Both players take alternate turns. In each turn, the player has to extend the length of the snake by moving it's head in either of th...
Here is a context free grammar that I have been given for practice: Grammar $G = (V,\Sigma,R,S)$ where $V$ is $\{S,A,B,a,b,c\}$ and $\Sigma$ is $\{a,b,c\}$. $R$ has the following rules: $$\begin{align}S &\to A\\ A &\to BB\\ S &\to bS\\ S &\to cS\\ A &\to a\end{align}$$ I am fairly sure that it is not ambiguous, since f...
I implement my data sets with a tree data-structure. The tree data-structure has a method named MakeSet which creates a set with one node. The tree data-structure has also a method named Merge(i,j) which merges trees of set i and set j in this way: the set with smaller depth becomes a child of the root of the set with ...
I have an algorithm that I think its complexity is O(n^2). However, our teacher insists that the algorithm takes O(n) time. How can it be? Here is the pseudo-code of the algorithm: // A is the input array. // |A| is the size of the input array. i = 1 j = 1 m = 0 c = 0 while i < |A| { if A[i] == A[j] c = c ...
I read somewhere that the Apollo Guidance Computer was designed in such a way, that, although it is hugely less powerful than the average smartphone, it was dependable to the point that it "never crashed". My questions pertaining to this were: Is designing such a digital system possible, even in the '60's ? What are t...
I'm looking for an application of the dining philosophers problem. Is there some real life system that faces the concurrency problem of "the dining philosophers problem" and implements a solution? I've been searching for over an hour. It would be even better if the implemented solution is Tanenbaum's solution described...
Let $$R = \{\langle M \rangle \mid L(M) \text{ is decidable}\}.$$ Is $R$ recursively enumerable or co-recursively enumerable?
I need an algorithm to convert a green hackenbush graph to it's equivalent tree so that I can find the Grundy value of the Graph using colon principle. I thought of finding the bridges in the given graph and compressing cycles into one node using the fusion principle but I fail to implement it when there are cycles wit...
We have a directed graph $G=(V,A)$ with $V=\{1,2,...,n\}$ where for each $(i,j)$ the distance $l(i,j)\in A$ is known. We want to find a pyramidal tour that has minimal length and that includes all points exactly once. A tour is pyramidal if it is of the form: $(n\rightarrow 1 \rightarrow n)$ such that all points in $n...