instruction
stringlengths
35
29.1k
I am trying to learn how to construct an NFA state diagram. $$M = \{q0, q1, q2\}, \{a,b\}, \delta, q0 , \{q2\}$$ $δ(q0,a) = q0; \delta(q0,b) = {q0,q1}; \delta(q1,a)= {q0, q2}; \delta(q1,b) = {q1}; \delta(q2,b) = {q1}$ From the above notation, I drew the state diagram below. Is this diagram correct? In state $q1$ I do...
I don't know how to state it elegantly, but basically, I want to implement a brute force search algorithm, but there are many different ways that I could enumerate through the search space. This might be naive of me, but I imagine that how I choose to enumerate through the search space could greatly affect whether or ...
I have a graph with V vertices and E edges. Each edge is a road that takes fuel F to travel. I have a gas tank of capacity K, and want to find the fewest number of refills needed to go from any vertex to any other vertex. If I choose to refuel, I can fill the tank completely. My thought is to modify the Floyd - Warsha...
INPUT: weighted undirected graph in the form of adjacency list OUTPUT: adjacency list without the edge e Naive approach is: for(int i = 0; i < adj.get(e.s).size(); i++) { // loop through adjacent of s if(adj.get(e.s).get(i).v == e.t) { // find t and remove it adj.get(e.s).remove(i); break; } } fo...
Elementary cellular automata show different systems and fractals like rule 30, rule 90, and rule 110. I want to know if there is another classification or type which shows similar structures just like in elementary cellular automata (ECA). For example what other systems can show structures similar to Sierpinski triang...
Given the language $L = \{w \in \{a,b\}^* \, | \, |w| = n \cdot \sqrt{n} \text{ and } n \geq 42\}$ and the assignement to proof that $L \notin CFL$ with the Pumping lemma. Assuming $L \in CFL$, would it be possible to start with defining a language $L' := L \cap a^+$ which has to be context-free since $CFL$ is closed ...
I am an undergraduate student in Computer Engineering and going through one of the textbook examples, I am asked to prove that $T(n)$ is $O(\log{}n)$ Where $T(n)= 5\log_{2} 2n +7$. I understand that this means that I must prove that $5\log_{2} 2n +7 \leq\lambda log(n)$ For some in n in a neighborhood of infinity. How ...
I've been reading book on Operating System, in which author writes : Somewhat surprisingly, it(Best fit) also results in more wasted memory than first fit or next fit because it tends to fill up memory with tiny, useless holes. First fit generates larger holes on average. I want to understand how generating larger ho...
I am currently learning about caches in Systems class, and I had a few doubts about what exactly happens when a Computer reads a PDF. This is the sequence that happens in my mind: The CPU checks if the pages of the PDF I want to read are there in cache. It is not, so we keep going down the Cache hierarchy until we get...
I'm still new to CFG and CNF and have trouble sometimes understanding the concepts. I'm trying to convert this CFG into Chomsky Normal Form: G: S -> aSbS | bSaS | epsilon I think the language generates all strings with same number of a and b, i.e. {a^n b^n |n>-0}. But to convert it into CNF, I've finished adding a ne...
I am working on this project where I am required to find the theoretical proof for following. I have a particular type of binary trees, where 1) each internal node will definitely have two children. 2) There are n leaf nodes and can be assumed in order 1 to n from left most to right most. Now this is clear that there a...
I had a test today, there was a question that was a bit confusing. Anyway I am asking the question, from memory, and explaining what I answered. It would be great if someone could explain if I did answer it correctly or not. The question is that assume a ring of 6 processes in an asynchronous system(each process runs ...
I am confused as to how this is true: O(n log n) + mO(log n) = O((m + n) log n) I understand that O(n) + O(m) = O(n + m). I'm mostly confused as to how to deal with the coefficient preceding O(log n).
In the question Matrix Chain Multiplication you are given a chain of Matrices and is required to find the optimal way to multiply the matrices together. Normally this is solved using Dynamic Programming but I have found a greedy approach to this problem. For example a chain of Matrices of the size of: A B ...
I'm studying my notes for a formal language course and it them it states The vast majority of languages over a finite alphabet cannot be represented by a finite specification. I don't understand this. What is meant by "specification"? It then goes on to show why this is true by showing some sets of the alphabet are...
Maximum directed cut: Given a directed graph $G = (V, E)$ with nonnegative edge costs, find a subset $S \subseteq V$ to maximize the total cost of edges out of $S$: $\mathrm{cost}( \{ (u \to v) \mid u \in S \text{ and } v \in \bar{S} \})$. I am trying to come up with a greedy algorithm for Maximum directed cut with fa...
Assuming we have two integers a and b, if we do bitwise operations like a & b or a | b, is the running time O(1) (constant) or is it O(b) where b is the number of bits in a and b? Thanks!
I am reading Sipsers. The book introduces halting problem and proves that is a turing recognisable language but not a turing decidable language. Thus giving a Turing machine which does not halt on some inputs. The language to be precise is $L=\{\langle M,w \rangle| \ M \text{is a turing machine and } w \text{ is a stri...
I just have general questions about sets and determining if they are regular languages. i) If A is regular, and A is a subset of B, then B must be regular. ii) If B is regular, and A is a subset of B, then A must be regular. iii) If A and AB are regular, than B must be regular iv) If Ai is an infinite family of regular...
Let's say I have a tree comprised of nodes where each node is of some type (T), where there is a known/fixed number of types (i.e. similar to attributes in an xml document), and where a node can only have one type. Let's also assume that our tree is somewhat balanced, and that there are far more nodes in the tree than ...
For a certain problem I am trying to solve given a list of integers, it is advantageous to me to first identify as many of the integers that are mutually coprime as possible. I'm having trouble thinking of a good general algorithm for this, and everything I've found online seems to relate to problems that are slightly ...
The question I'm faced with: Let $A[1], A[2], ...,A[n]$ be an array containing $n$ very large positive integers. Describe an efficient algorithm to find the minimum positive difference between any two integers in the array. What is the complexity of your algorithm? Explain. I would assume you apply a Merge Sort or Qu...
How can the maximum flow of a graph be computed when all nodes of the graph are connected to both sink and source nodes (two hypothetical nodes), and the maximum flow method should ignore such paths as $\text{source} \to \text{node} \to \text{sink}$, where $\to$ is a single edge? A valid path containing a positive flow...
Consider a static set $S$ of positive numbers from range $[1..10^9]$. Is there an efficient algorithm to answer queries of the form: "Given a number $d$ is there an element $x \in S$ such that $d | x$". Simple straightforward check takes $O(|S|)$ time per query and uses $O(|S|)$ memory. Storing all the divisors for ...
I am reading the paper Measuring the hardness of SAT instances by Ansótegui, Bonet, Levy and Manyà (Proc. 23rd AAAI Conf. on AI, pp. 222–228, 2008) (PDF). I am trying to understand the decision algorithm beame_pitassi described in the Figure 1 in paper and showed below. This algorithm searches for the space of an UNSAT...
Is it possible to test algorithmically whether the language of a given automaton is empty? If I have a language L, could I say that L intersection with the empty set is L?
I´ve been thinking about this particular computing/crypto/database problem for years and I just want to know if there are already solutions to it. To be honest I don´t even know what field this problem belongs to exactly. In a nutshell: person A has a list of data, another person (B) has an algorithm that gives each it...
Algorithm A divides the problem into 5 sub-problems of half the size. Solving each sub-problem then combining the solutions in linear time. Algorithm B solves problems of size n by dividing them into 9 sub-problems of size n/3, and recursively solving each sub-problem then combines solutions in 26*n^2 time. Algorithm C...
I was trying to calculate cosine series : cos x = 1 - x^2/2! + x^4/4! - x^8/8! .... , where x is in radians: include iostream include math.h using namespace std; long factorial (long num) { if (num >1) return num*factorial(num-1); else return 1; } int main() {int X,sum=0; cout<<"Enter value of x in radians : "; cin>...
A graph is almost Hamiltonian if it contains a cycle that visits every node at least once and at most twice. Is the problem of determining whether a graph is almost Hamiltonian NP-complete?
There are a set $A$ of trees. There is another set $B$ of trees that is the collection of all possible subtrees of the trees in $A$. I don't have $A$ but only have $B$, and I need to figure out the size of $A$. A brute-force way is making a graph of the trees. For each root node in $B$, find a tree that contains the no...
I am study this lecture The Complexity of Propositional Proofs. Here there is a term size of propositional formula (page 2), Every tautology $\tau$ on $n$ variables has an $F$-proof in which thera are at most $2^{O(n)}$ formulas, each of which has size polynomial in the size of $\tau$ but here doesn't define that te...
The standard usage cases for the Hadamard gate seem to be passing a pure $|0\rangle$ or $|1\rangle$ state in to get an even amplitude (probability) mixed state which has either matching or mismatching phase. The other use of course, is to take such an even amplitude mixed state, pass it through the Hadamard gate, and g...
I was looking over stephen wolfram's work mainly about Elementary Cellular Automata, i see that for all rules with N steps {i.e 200 steps} they show the same pattern {i,e rule 90 running on 20 steps and 100 steps are the same, like Here}. Unlike rule 110 which shows different behavior when N = 20, 100 or 200, i know th...
When looking at this question: How to apply a 1-qubit gate to a single qubit from an entangled pair? And other questions, it makes it seem like when you have a quantum circuit involving $N$ qubits, that when you want to peform a gate operation on a subset of the qubits, that you must still make a matrix that applies to...
Basically, the problem is: For a set $S$ of positive numbers, find a minimal number $d$ that is not a divisor of any element of $S$, i.e. $\forall x \in S,\ d \nmid x$. Denote $n = |S|$ and $C = \max(S) $. Consider the function $F(x) = $ the least prime number not dividing $x$. It is easy to see that $F(x) \leq \log x$...
I wanted to understand the Myhill-Nerode Theorem so I made up a small example to do so. L = (a $+$ b ) Clearly, this language is regular. So, I should be able to establish a finite number of equivalence classes by using this method. I start with a suffix of length 0, which is only $\lambda$: a$\lambda$ = a $\in$ L b...
According to the wikipedia page on homoiconicity: In a homoiconic language the primary representation of programs is also a data structure in a primitive type of the language itself. I was wondering if the lambda calculus was homoiconic (I assume not, because applications are not data (which, for the calculus, would ...
can graham scan algorithm work with convex hull vertices when vertices are not sorted? I am investigating a convex hull algorithm that involves sorting. In fact, its running time is limited by sorting, so it is $O(n \log n)$, where $n$ is the number of points on the plane. That algorithm first sorts the points by x-co...
Well this is general question. And if anyone want to make it implementation specific then I will prefer Unix related stuff. But first need to know following problems in generality: I read single process can have multiple threads. Multiple threads of same process does share things among them. I want to know what they sh...
I've read posts everywhere and watched videos but still I don't understand one part of it. How are they able to process all these operations in parallel. So based on the landscape example here. How would a quantum computer be able to check all those areas at once rather than the traditional algorithm to check random ar...
Imagine we have a random number generator where g(n+1) = f(g(n)), where f is some function (e.g linear recurrence). I'm trying to find a system where it's fast to find many steps in the future immediately, whereas it's hard or impossible to work out a previous state. for example, if I know state = X at time t, I wou...
I am having problem with solving the following recurrence relation. $A$ is a set, there are at most $k+1$ of this set and $|A|$ is at most $n/2$. $T(n) = O(n log k) + \sum_A T(|A|)$ I guess it can't be solved by the techniques presented in CLRS book (like master theorem), I also tried to solve it using induction on $n$...
I have been following the third edition of Introduction to Algorithms (by Cormen, Rivest, et al.), and have been studying the deletion algorithm for red-black trees. However, I am confounded at the moment while I am trying to delete a node from the tree. The algorithm could be found at Page No. 324, third edition, Intr...
I am studying the lecture The Complexity of Propositional Proofs. ​Here there is a definition together with a discussion (page 3). I don't understand that discussion. Let $F$ denote the set of propositional formulas over the connectives $\wedge$, $\vee$, $\rightarrow$ and $\lnot$, with a countably infinite supply of p...
Why is $\log(n!)=\Theta(n\log n)$? I tried: $\log(n!) = \log1 + \dots + \log n \leq n \log n \Rightarrow \log(n!) = O(n \log n)$. But how can we prove $\log(n!) = \Omega(n \log n)$ without Sterling's approximation?
Suppose that something is wrong with its configuration (ie topology), for example there are too few neurons in a certain layer, or not enough layers. I have an intuition that some neurons' "delta" ($\Delta$) values will be fluctuating wildly without settling down to fixed values. Is this a justifiable belief?
What are the fundamental differences between predictive modeling and clustering? according to literature, predictive modeling is a supervised learning with aim to construct models to predict the value of target attribute. On the other hand, clustering is a unsupervised method to split a data set to a couple of groups. ...
I am working on my cs project about AI & Turing machines, so i know that Artifical Intelligence is meant to implement different algorithms into the machine {the computer} to solve a problem or a set of problems together and i am getting AI as: (the machine is 'programmed' on a certain algorithms to solve problems or to...
How would I convert a 16K x 32 SRAM into a 64K x 8 SRAM? The 16K x 32 RAM module is a single unit that cannot be altered internally and is capable of address decoding, has tristate outputs, and read/write/and chip enable. Also only the memory read of the circuit has to be implemented.
The overarching theme of computer science seems to be that polynomial time or space or what-have-you for an algorithm is a success, and exponential is a failure. The definitions of P and NP revolve around this. This seems to be the case in OMBL (online mistake-bound learning) as well. On the other hand I heard from a r...
I am currently studying materials for my uni subject. There are two examples of Kleene algebras, but I don't see what is the difference between them. Class ${2^{\Sigma}}^{*}$ of all subsets of $\Sigma^{*}$ with constants $\emptyset$ and $\{\varepsilon\}$ and operations $\cup$, $\cdot$ and $*$. Class of all regular sub...
Considering only the alphabet $\Sigma = \{0,1\}$, the strings which can be given as input to the Turing machines are from the set $\Sigma^{*}$. But does it make sense for the input to be an infinite binary string ? For example if a Turing machine accepts all strings starting with a 0, does a binary string of infinite z...
In the context of signal processing and sparse representation of signals, there is a topic called dictionary learning which is basically about how to's of the selection of basis functions used for sparse representation. I am looking for sources explaining the topic with a section on dictionary learning algorithms and p...
I am writing a simple calculator in yacc / bison. The grammar for an expression looks somewhat like this: expr : NUM | expr '+' expr { $$ = $1 + $3; } | expr '-' expr { $$ = $1 - $3; } | expr '*' expr { $$ = $1 * $3; } | expr '/' expr { $$ = $1 / $3; } | '+' expr %prec '*' { $$ = $1; } | '-' expr %prec '*' { $$ = $1; ...
Sorry if the Question sounds a little trivial. Let A* be the set of all languages over A={a,b}. Then A can be written as {aUb}* which is a regular expression.So this is the set of all languages(actually set of all strings) regular.Am i thinking in the right direction.
I'm working on some compiler software, and I'm looking for information on canonical forms for expressing software, algorithms, mathematical expressions (including predicate logic), etc. I assume canonicalization is generally intractable, but NP algorithms and more-constrained problems (e.g. pure functions) are also int...
We are given one machine and $n$ jobs that we want to process. For the $n$ jobs we have the following data: $r_{1}, ... , r_{n}$ are the release times $p_{1}, ... , p_{n}$ are the processing times $d_{1}, ... , d_{n}$ are the deadlines/due dates $c_{1}, ... , c_{n}$ are the completion times(when the jobs are finished ...
I recently started self studying about algorithms and decision problem, so I don't have a firm grasp on this particular area. In this context I found myself thinking about the following . If $L_1$ is semidecidable and $L_2$ is decidable, what can one say about the language set defined by their difference $L_3 = L_1 \t...
Let's say that you have a 6 qubit system and you want to apply a Hadamard gate to qubits 2 and 4. How would you construct a matrix that did that, while leaving the state of the other qubits alone?
The problem in my book is T(n) = 16T(n/4) + n! I don't know how to get at the correct solution my book has, which says Θ(n!) here are pictures of the master theorem and the problem in my book.
I want to show that $L = \{a^n b^m a^{n+m} \mid n, m \geq 0\}$ is not regular. Can I say that the complement of $L$ intersected with $a^*b^*$ equals $\{a^n b^n \mid n \geq 0\}$ and since I know that $\{a^n b^n \mid n \geq 0\}$ is not regular, then $L$ is not regular? Or would I have to use the pumping lemma?
Say we have a $n \times n$ table which elements are sorted column-wise, for example: $$ \left( \begin{array}{ccc} 2 & 4 & 1 \\ 3 & 5 & 6 \\ 7 & 9 & 8 \end{array} \right) $$ I would like to prove that if we sort this table row-wise, it will be still sorted column-wise. This is one of the steps to prove the shell sort ...
The general form of my question would be, what is the most efficient way to compare the total values of two different arrays to see which one is greater? Would be as simple as prefix sum ($O(n)$) for both arrays? Or is there a more efficient method? The specific question I'm staring at is: Let $A$ and $B$ be two unsor...
I have a set of k n-dimensional points: P1(x11, x12, ..., x1n), P2(x21, x22, ..., x2n), ..., Pk(xk1, xk2, ..., xkn). A distance D(Pa, Pb) is defined between any two points, which satisfy usual properties: D(Pa, Pb) >= 0 D(Pa, Pb) = 0 <=> Pa = Pb D(Pa, Pb) = D(Pb, Pa) D(Pa, Pc) ≤ D(Pa, Pb) + D(Pb, Pc) What is the algo...
My tutor often says that proving membership of NP is the easy part of proving that a problem is NP-complete, and that this should only take a minute. What I don't understand is what exactly you're suppose to do at this step   I understand that you're suppose to verify the correctness of a solution but how do I do that?...
im looking for some guidance on how to get started with sorting an array of booleans so that the falses would be in front of the trues. so if given this: a = {true, true, false, true, false} it would return: a = {false, false, true, true, true} here is the exact question: Suppose you have an array of booleans of s...
By total-ordering I mean the following definition[0]: Total Event Ordering: Controller replicas should process events in the same order and subsequently all controller application instances should reach the same internal state. If my understanding is correct, there isn't any difference and the two words can be us...
I'm studying heap sort and was presented with the following question. What is the minimum number of items that must be exchanged during a remove the maximum operation in a heap of size N? Give a heap of size 15 for which the minimum is achieved. There should be at minimum two sorts for this problem which I understan...
Suppose that $Z = X \vee Y$, where $X$, $Y$ and $Z$ are 96-bit binary numbers. If I'm given the values of $Z$ and $Y$, is it possible to work out what $X$ is? I know this is possible with XOR but can it be done with OR?
Is word size, the size of a memory location? the size of the data bus? or the cpu register size? Suppose you have a computer, memory address #0 has byte AB memory address #1 has byte F3 memory address #2 has byte EA So each memory address stores one byte. And you have a data bus that can pick up 4 contiguous memory...
In the carryless multiplication of two polynomials in a 8-bit environment, is it possible to obtain the original 8-bit values from the result? As an example: $$\begin{align} (x^{11} + x^{10} + x^9 ) + (x^7 + x^5 + x^4 + x^3 + x^1) &= (x^6 + x^5 + x^1) \times (x^5 + x^3 + x^2 + x^0)\\ (x^{11} + x^{10}) + (x^6 + x^4 + x^...
So this problem is pretty nasty. I can easily find the number of iterations for each nested while loop. The first runs log_9(n) times and the second runs log_4(n) times. My problem that I do not know how to address is the initialization of i = n. I'm quite lost on this part so anything helps! function p(n) i = n...
I know that we can prove closure of two regular languages under operations like union, intersection, concatenation etc. by constructing NFAs for them but how to do the same thing using regular expressions, specifically proving that reversal of a regular language is closed using regular expression?
I have a problem that is NP-hard and even NP-hard to approximate within a factor $n^{1-\varepsilon}$ $\forall \varepsilon > 0$. I'm looking now just for approaches that can help me to design a "justifiable" solution. I don't need to improve the brute-force solution, I just want to design a heuristic that I can justify ...
I was reading on Complex Systems journal and found a paper where the author states that a cellular automaton can be viewed as a computer. In the introduction part: Cellular automata can be viewed as either computers or logical universes where computers may be embbed. What i am trying to understand is, is it always a...
I've been trying to investigate 3-SAT for variables appearing 3 times and so far I'm getting some mixed answers as to its complexity. For example, https://people.maths.ox.ac.uk/scott/Papers/restricted3sat.pdf says instances of 3-SAT in which every variable occurs three times are always satisfiable (this is an imme...
So Fibonacci heaps can perform insertions in amortized constant time, and I came up with a sequence of heap data structures $H_k$ such that insertions can be performed in amortized $O((\log n)^{1/k})$ time where $n$ is the size of the heap. If we didn't know insertions could be performed in constant time, then my resul...
I've been trying to find lists of graduate level CS classes that have had their lectures videotaped. There's a similar question on MathOverflow, which has compiled a fairly extensive list of stuff: Free online video lectures of mathematics courses. What I'm mostly interested in is finding links to materials like the fo...
I'm using a Raspberry Pi 2 which works with 900MHz. (Asked this question there and they think it belongs to cs) My question is: since it also runs an operating system in the background, I expect this would take some of the processing power. So, how significant is the speed reduction due to operating systems? If I run a...
I have the following homework exercise: We are given a network $N=(G,w,d)$, $G=(V,E)$ together with a designated source node s∈V and target node $t \in V$, where $w\colon E \to Z^+$ and $d\colon E \to Z^+$. The values $w_{i,j}$ correspond to arc weights, $d_{i,j}$ correspond to delays, i.e., using the arc $(i,j)...
A storage system has 6 hard drives set up as RAID 5, where HD 6 is the parity disk using odd parity. One day, the system crashes due to failure of HD4. During recovery, we find out that HD1 stores 11110000; HD2 contains 10011100; HD3 contains 00011000; HD5 contains 10101010 and the parity disk contains 11110111. What ...
I'm a bit confused about the definition of a Petri-Net. From Wikipedia (EN) I have this defintion: A Petri-Net is a 5-Tupel (P, T, F, W, s) P and T are disjoint finite sets of places and transitions, respectively. So the defintion says: $P \cap T = \emptyset $ & $P \cup T \neq \emptyset $ Let's say T is $ \emptyset ...
We have been studying the development of SLR parsers, and that now we have done the arithmetic expression grammar (the unambiguous version), I was curious to see if the same could be done to the if-then-else grammar which is pretty much ambiguous. So I started with the following rules ( as given in Principles of Compil...
I have a set of $n$ values,$v_i$ and want to insert them into a hash-table, $HT$, in a way that each bucket (or hash-table cell) has at most $d$ values. I set $k=\frac{n }{d}$, where $k$ is the number of buckets. Then, I use SHA hash function, $H$, to find the index a bucket in the hash-table and insert the values into...
I am wondering what is the true algorithm for the Shannon-Fano code? The the result I am getting based on the Algorithm in Wikipedia page contradicts the supposed/expected length of the produced code. According to the proof of Kraft's inequality, $l_i = \lceil \log_2{\frac{1}{P_i}} \rceil= \lceil -\log_2{P_i} \rceil$....
I am trying to come up with a mutual exclusion algorithm that is based only on atomic reads and atomic writes of shared memory (i.e. no compare-and-swap or similar). Apart from mutual exclusion and deadlock freedom, it needs to fulfill the following properties: It needs to be robust in the face of processes dying at a...
I have a tree. This tree has no particular root (free-tree). I want to find a path that visit all nodes. This path has to be the shortest possible. All edges are considered to have a distance of 1. My problem is not finding a Hamiltonian path, because I don't have any restriction on the number of times a node can be vi...
You are designing an elevator controller for a building with 25 floors. The controller has two inputs: UP and DOWN. It produces an output indicating the floor that the elevator is on. There is no floor 13. What is the minimum number of bits of state in the controller? Answer: The system has at least five bits of state ...
This grew out of a discussion of deliberately bad algorithms; credit to benneh on the xkcd forums for the pseudocode algorithm, which I've translated to Python so you can actually run it: def sort(list): if len(list) < 2: return list else: if list[0] <= minimum(list[1:]): return list...
I am looking for a method to categorize a given word into semantically into classes. A simple example would be: chair -> furniture The most reasonable way to do so that comes to my mind, would be to create a tree containing words, where chair is a predecessor of furniture. Then one could define a threshold that describ...
I have the following algorithm in ML: fun change(till,0,chg,chgs) = chg::chgs | change([],amt,chg,chgs) = chgs | change(c::till,amt,chg,chgs) = if amt<0 then chgs else change(c::till, amt-c,c::chg, change(till,amt,chg,chgs)); The algorithm takes a list of currency denominations as till and returns all the combinat...
This may get slightly philosophical, but consider the following program: bool lampState = false; TimeSpan timeout = 1; while (true) { lampState = !lampState; Thread.Sleep(timeout); timeout = timeout / 2; } DotNet Fiddle link for C# code This is obviously an implementation of Thomsons lamp in C#. So the que...
I know there is a stack based approach with O(N) complexity and O(N) space. Can B be created using O(1) space? Such as in place using a single loop or even some sorting algorithm ? If so, can you please provide a high level description of the algorithm ? I've been working on a solution for some time now and am unable ...
I am developing algorithm for solving following problem: Given a set of items with unknown feature(s) (but know distribution of feature(s)). Algorithm must choose what items to measure(every measure has some cost)). I use Value of information theory to find this measurements. After measurements are done algorithm cho...
When completing exercises on Codility.com you submit your code to a server for analysis. You then receive a report containing the detected algorithm complexity of the code. I was just wondering how it does this automatically - i.e. without any O(n) analysis?
Here's the problem I'm trying to solve: I have a bunch of widgets, whose weights vary over a small range. I would like to find the optimal grouping of them such that each group meets a minimum weight requirement, while maximizing the total number of groups I can form. Knowing a specific name for this class of problem w...
Good evening! I'm actually doing an internship at the Archives Nationales of France and I encountered a situation I wanted to solve using graphs... I. The dusty situation We want to optimize the arrangement of books of my library according to their height in order to minimize their archive cost. The height and thicknes...
This question is about Model Checking for Software Formal Verification How do you model the joint behavior of 2 independent and concurrent transition systems? Specifically, given the two independent and concurrent Transition Systems below; TS1 and TS2 (left to right). A tutor proposed that the resulting Interleaving ...
I have two opposing ideas. I think that all the instructions in a RISC take the same time what makes me believe RISC is associated with synchronous. At the same time i think that CISC should be synchronous and RISC should be asynchronous. Can you tell me if RISC is associated with asynchronous and CISC is associated wi...