instruction
stringlengths
35
29.1k
I designed an algorithm where, at some point, I need to compute the product of a list of integers $n_1,\dots,n_m$ (possibly, there are repetitions in the list). The integers themselves do not depend on $m$ but can be, somehow, arbitrarily large. EDIT: right now, I'm using a naive for loop: prod=1 for n_i in list: p...
if we have $f(n)=f(n-7)$ and $f(2)=3$ can we conclude that $f(n) \in \theta(1)$? what if we also have $f(1)=2$?
Is an infinite set of RE languages create a language that is also RE? I think it's true, and my first intuition is to try induction to prove this statement. Am I on the right way? Thanks!
This is a real world problem, which due to some specific aspects of it I am having a hard time finding relevant literature for it. I am looking for either an algorithm, or a pointer to relevant paper(s) describing a solution. I'm assuming one was already published, but I am just fumbling with my search terms. Problem s...
I'm finding it difficult to understand why due to the pigeonhole principle, 2 distinct words must go to the same state in a DFA. Is it that if there are n words and m states, where there are more words than states (n > m), that 2 words must end up in the same state? Is this somewhere along the right path?
Right now i am looking at the following statement, but i cant grasp why it is correct. Can somebody help? "If we look at F0 uniformly distributed (and, say, pairwise independent) elements of [0, 1], we expect about t of them to be smaller than t/F0." Kind Regards, Ilian
What is the complexity class of: given a graph G, is the graph has a maximal clique of size k? k is integer less than or equal the number of graph vertices. A related question, Given a Graph G, Find a maximal clique of size k. This is np because it is polynomially verifiable. Right? The essential question if the above ...
I'm working on a resource allocation problem, where there are $n$ different Items and $m$ different tasks ($n\geq m$). Also, The profit of assigning subset $I=\,(\, |I|\leq n)$ of items to task $j$ is calculated by $f(I;j)$. If no item is assigned to task $j$, then the profit is calculated as $f(\emptyset;j)$. The obje...
consider the following function $$ \begin{align*} f(m,n) &= \begin{cases} k & \text{if program $m$ halts on input $n$ after $k$ steps} \\ m & \text{if program $m$ loops on input $n$} \\ \end{cases} \end{align*} $$ can you find an algorithm for this function?
As part of a college project, I need to compare the speed of arithmetic operations directly in binary on different processors. Example: At what speed will binary addition be performed on an Intel Core I5-12400 processor? Initially, I had the idea to write a program myself that would perform the appropriate tests. The p...
I am a teacher of undergrad graph theory and we tend to invent some weird (and false) characterizations of trees and recently I stumbled upon this one. Is the following true? $G$ is a tree if and only if $G$ is connected and between each pair of vertices of same degree, there is an unique path connecting them. If we re...
For example, are there worst case Decidable(but non primitive recursive or other insane time complexity)problems that have a polynomial average case complexity? If so Are there undecidable worst case problems that have polynomial time average case algorithms? Is there a limit on the arithmetical hierarchy where there c...
I'm currently in need of the inverse operation of the concatenation of 2 regular languages. Formally, for 3 regular languages $A,B,C$ such that $A \cdot B = C$, only $A$ and $C$ are known, and $B$ is the smallest language that fulfills the equation (which implies $\forall w \in B: A \cdot (B \setminus \{w\}) \subset C$...
Let $A=\{$ M is a TM, $s\in \mathbb{N}$ and $\exists x\in\Sigma^*$ s.t M rejects $x$ in at most $s$ steps $\}$. I want to define its complement, so how do I negate "$\exists x\in\Sigma^*$ s.t M rejects $x$ in at most $s$ steps"? Is it: $\forall x \in \Sigma^*$ M accepts $x$ in at most $s$ steps? Thanks a lot!
We know that there are basically 3 fundamental parts of a processor namely : Control Unit (CU) Arithmetical Logic Unit (ALU) Clock Also we know that they maintain several important and different functions of the processor. However, if we had to arrange them according to their importance/priority , then which one shou...
In a B-Tree, one of the rules is: Every node (except the root) is at least half full But then, in a 4-way B-Tree, we have the following case. Suppose we want to insert $10,20,30,40$ to the tree. After inserting the 3 first element we get the following root: [10 20 30] After adding the 40, we split as follows: ...
Im trying to understand the following question. Suppose $h,f:\{-1,1\}^n\rightarrow \{-1,1\}$ satisfy $\sum_x h(x)f(x)\leq 0.5$, then one can rewrite this as $\textsf{Pr}_x [h(x)=f(x)]\leq 3/4$. Can we use this statement to show: there exists $i\in [n]$ such that $\sum_i h(x)f(x)h(x^i)f(x^i)$ is small (where small here ...
Consider the following game: You are given a set $S$ and a fixed list $q_1$, $q_2$, ..., $q_n$ of yes or no questions about the elements of $S$. Your opponent chooses an element of $S$ without telling you which. You then ask a series of questions taken from the list and your opponent truthfully answers "yes" or "no" to...
Can CYK algorithm be used for ambiguous context free grammar?
Does the answer depend on the number of bytes requested? If it is forced to keep a buffer due to some unknown device/diver, can it optimize and skip the buffer if it's going to be a disk read? I'm looking for any insight beyond "It's implementation dependent". How I got here: C++ implementations of POSIX compliant syst...
Let $L\in R, L_2\in RE$ and $n\in N$. Define $L_n=${$w|w\in L \vee (w\in L_2 \wedge |w|\leq )$} Find a decider for $L_n$ For the right hand side, I thought I could check the length of and then simulate the recognizer that recognizes $L_2$ until it accepts. I don't know how many steps it'll take the machine to halt and...
This article from IBM (link) talks about Memory hierarchy in its actual hardware parts. NUMA While operating systems present memory to the running applications as a unified space, modern large systems have memory organized in a hierarchy, by core, chip, module, socket, node, and chassis/central processor complex (CPC)...
I'm researching static recompilation but there doesn't seem to be too much information about the subject. I've heard that dynamic recompilation (emulation) can be up to 6 times slower than native assembly, but I'm curious why we aren't able to translate to a different architecture ahead of time. Even though some instru...
Assuming this set of instructions: declare variable 'A' which has value 5 declare variable 'B' which has value 2 From what I've understood, those instructions are loaded into RAM an then read by CPU, they are composed by OPCODE + Data. So, lets assume that the opcode to set a value for a specific RAM address is (0001...
Given doubly linked list $L$ that contains $n$ elements of numbers. Between QuickSort, and MergeSort and InsertionSort, which algorithm preferred to sorting $L$ by just swapping links of $L$? I think the InsertionSort is better option but I have no any idea to show that that minimize number of changing pointers. Any h...
I know that there are many techniques to represent graphs. Suppose I have a directed massive 3D graph with 100,000 nodes at maximum. Suppose the graph looks somewhat like the following: Suppose each node of the graph has three pieces of information: A 30-character string as a label floating point values as coordinate...
In Cormen's Introduction to Algorithms, he states the the LP relaxation for the minimum vertex cover approximation problem is $ \begin{align*} &\sum\limits_{v \in V}w(v)x(v) \tag{35.15} \\ x(u) + x(v) &\geq 1 \text{ for each } u, v \in E \tag{35.16} \\ x(v) & \leq 1 \text{ for...
An arithmetic circuit relates to calculating the value of a polynomial given some inputs. But is it still considered a circuit if the DAG corresponds to the evaluation of multiple polynomials that share nodes? Consider $f(x, y) = 3x^4 * y^3$ and $g(x, y) = 3x^4 * y^2 + x^2$. $f$ and $g$ share the node corresponding to ...
I am currently struggling with figuring out the following problem: Given decidable languages L1, L2, L3, L4, ... Is the infinite union of Languages L1, ...... decidable? I have an intution that it is not, but I cannot find an example against that thesis. Thank you in advance
Apologies if this question exists somewhere. I'm sure it's been asked, but I don't know how to search for it. This is not a homework question but rather a scientific problem I ran into. If this is a standard CS exercise, just mark it as duplicate and point me where I need to go. Problem statement: Consider an undirecte...
I'm working on understanding graphs and graph algorithms. The problem is from: https://courses.engr.illinois.edu/cs374/fa2020/labs/sol/lab_12_b_sol.pdf (Q 1.D) Describe an efficient algorithm to update the minimum spanning tree $T$ of a weighted undirected graph G when the weight of one edge $e \notin T$ is decreased....
I'm sure this question has been asked before, but I have no clue what I'm trying to achieve is called and couldn't find anything helpful. I'm trying to find the name of an algorithm that starts at a point and rotates around a "board" in either clockwise or anti-clockwise rotation. I'll draw some examples to shown what ...
Consider L1 = Any language generated by a machine M1 L2 = Any language generated by a machine M2 Machine can be – FA, PDA, LBA, or TM Assuming Machine M2 is more powerful than M1 Let L3 = L1 $\cap$ L2 Now can we always say that L3 can be generated by Machine M2 ? For eg: L1 = Any Context Free Language (i.e Generated ...
in here they claim: "there is an algorithm deciding almost all instances of [halting problem]" so I'm wonder whether there is a computable function $h':\mathbb{N}\to\{0,1\}$ such that the following turing machine is a halting decider (for TMs running on blank input) except for itself $$ \begin{align*} M(m) &= \begin...
I am trying to understand Circuit Complexity's relation to classical Time Complexity. Here is what wiki mentions: "If a certain language, ${\displaystyle A}$, belongs to the time-complexity class ${\displaystyle {\text{TIME}}(t(n))}$ for some function ${\displaystyle t:\mathbb {N} \to \mathbb {N} }$, then ${\displaysty...
Is CFL $\cap$ DCFL = CFL, always true? CFL - Any Context Free Language DCFL - Any Deterministic Context Free Language
This question is in the context of quicksort. Consider that a subarray of distinct elements of size $k$ is sampled from the input array of size $n$, and then we choose a pivot from the sampled subarray. We want to compute and bound the probability that the element of rank $s$ in the original array lies in the middle th...
The COIN-CHANGING problem is NP-complete, but I am having difficulty finding a proof for its NP-hardness in the form of a reduction from another NP-complete problem to COIN-CHANGING. Apparently, a reduction from SUBSET-SUM to COIN-CHANGING is possible according to this (hopefully old enough) algorithms assignment from ...
I need to prove that $T(n)$ is $\mathcal O(n\log n)$ with the substitution method. $$ T(n)\leq 3\log n + n + \frac{6}{n}\sum^{2n/3}_{n/3}T(i).$$ This is my attempt: I assume $T(n) \leq c n \log n$ and then \begin{align*} T(n) &\leq 3 \log n + n + \frac{6c}{n}\int^{2n/3}_{n/3}x\log x dx\\ &\leq3 \log n + n + \frac{6c}{...
In section 30.2 of CLRS (third edition), they given an algorithm for computing the fast Fourier transform of a vector represented as an $n$ dimensional array when $n$ is a power of $2$. They say that an algorithm for general $n$ is beyond the scope. Is generalizing the algorithm to any $n$ very tricky? Any references w...
I need to prove that the following expression is $\mathcal O(n \log n)$ with the substitution method: $$ T(n) \leq 3\log n + n + \frac{6}{n}\sum^{n - \frac{\log n}{3}}_{i=\frac{\log n}{3}} T(i)$$ This is my attempt, assumming $T(n) \leq c n \log n$: \begin{align*} T(n) &\leq 3\log n + n + \frac{6c}{n}\int^{n - \frac{\l...
Are the following two stat rules equivalant? stat : 'if' expr 'then' stat ('else' stat)? ; stat : 'if' expr 'then' stat // with higher priority | 'if' expr 'then' stat 'else' stat ; That is, does ANTLR 4 always put the alternative without the optional part before the one with the optional part, or vice v...
I'm trying to implement self-organizing lists DS to publish as a public module. Over the course of Algorithms, we learnt that if you add a new element to the list, it should still do the huriectics. For example, in Move-To-Front, when you do insert(2) it will add 2 to the end of the list and then move it to the front r...
Suppose we have a minimization ILP. Denote its value by $OPT$. Let $PER$ be the solution to its LP relaxation. Given a real number $t$, we would like to decide whether $OPT \leq (1+t) \cdot PER$, in time polynomial in the problem size and $1/t$. Denote by FPTAD, the class of ILPs for which this is doable in polynomial ...
Suppose Alice has a verifiable (message, signature) pair from Cedric, who would not cooperate and routinely uses an algo (ecdsa, eddsa, rsa, or insert yours here) to sign messages. Alice wants to interactively prove to Bob she has that (message, signature) pair with the valid signature, obviously. It doesn't have to be...
It is common to have proofs that use contradiction to show that some language is undecidable in computability theory. An example proof can be seen in 4.2 Undecidability “Introduction to the Theory of Computation” by Sipser proving 4.11 the undecidability of A_tm. Basically, these proofs assume the existence of a decide...
I'm trying to understand how problems in NP-hardness reduce to one another. As I understand it now, if X reduces to Y, Y is at least as hard as X. What I think that means, and would like confirmed or denied, is the following: Any category can reduce to itself. Ex: P can reduce to P. NP can reduce to NP, NP-Complete ca...
I've encountered many examples which its format is like: a^n b^n. For this I understand that w = 2n and is pretty straightforward, but what happens in my case? Is w = 1 + 2n? And in this case would |xy| be a subword of just a, or a subword of a b^n? I'm struggling to pump the language in any meaningful way to get my pr...
I am studying theoretical computer science and I am in the part about resolution in propositional calculus. I was reading a theorem (and its proof) that propositional resolution is refutation complete, but I could not fill a particular detail. The theorem is: Refutational Completeness of Propositional Resolution. The ...
I'm reading Operating System Concepts by Silberschatz and in chapter 5, there is this text: 1. CPU-scheduling decisions may take place under the following four circumstances: When a process switches from the running state to the waiting state (for example, as the result of an I/O request or an invocation of wait() fo...
The problem is described as such: Given $n$ tasks $\{J_1, \ldots , J_n\}$where each task has a deadline and a ‘profit’. So for some $i \in \{1,\ldots , n\}$, $J_i=\{t_i,p_i\}$ where $t_i$ is the deadline to complete the task, and $p_i$ is the expected profit. It is given that: starting time is $0$ each task takes $1$ ...
While i was going thru my course in Computer System Architecture (book taken Morris Mano) , I saw a question on KMaps can be solved in either of the ways but couldn't get which one to use when :- I’m taking for an example kmaps for 3 var A’B’ A’B AB AB’ C’ 0 1 3 2 C 4 5 7 6 ...
I have a very big set of non-empty arrays of possibly repeated numbers sorted in a weakly-decreasing order where each number belongs to the interval $[1, 55]$ and the sum of the elements of each array is always $\leq 55$. For example, the array $A=[5, 5, 3, 3, 3, 3, 1, 1, 1]$ contains 9 elements and its sum is $25$. I ...
I need to determine for what range of n the algorithm that costs $1000n^3$ is faster than one that costs $2^n$, now I solved it on wolfram alpha and I know the answer is >= 24. The issue is I have to prove it with using the math only and I don't understand the "W" thing in the solution (nor at this class (Data Structur...
Given strings $S,T$ such that $n=|T|>|S|$ , I'd like an algorithm to count number of occurrences of $S$ in $T$ (as a subsequence), not necessarily contiguous. Example: if $T=aababc, S=abc$, the algorithm should return $5$. I've tried taking a suffix tree/ suffix array approach, only to realize that these tools are good...
I am taking my first network class and I came across a question I just cant wrap my head around. We have an external machine that has a public IP address from using NAT, the external machine want to contact one other machines but using their local IP address no the one public provided by NAT. How can initiate the conne...
Although not an assignment, just out of curiosity; I am trying to compare a two cases A scenario where I pick a tree out of the set of possible binary search trees on the keys $1,2,\ldots,n$, with each tree equally likely (with a probability say, $p(T)$) and\ Generating a binary search tree by inserting the numbers $1...
I know that if I have $n$ different values in an array of size $m$ (where $m>n$) under simple uniform hashing, the average probability of the total number of collisions is: $$\sum_{i=1}^{n-1}\frac{i}{m}=\frac{n(n-1)}{2m}$$ Since it is known that the probability of no collision is $$1\cdot\left(1-\frac{1}{m}\right)\cdot...
In the normal case of a chord ring the big O notation of the look up is O(logn) because of long haul pointers of the Finger Table (or Routing Table). In this question what if the Finger Table has a limit of size 3 (1) I would like to ask the Big O notation of the look up AND (2) I would like to know the formula for the...
A CTL* formula EFG p is equivalent to mu-calculus formula Y.(<>Y | νZ.(<>Z & p)). In this formula, the alternation depths are ad(Y)=ad(Z)=1. Is there a CTL* formula that translates into YνZ(...) with alternation depths 2,1 for Y,Z? And a similar question: Is there a CTL* formula that translates into νXYνZ(...) with alt...
Executable: Sat prog Definition: The exit status of "Sat prog" is 1 iff there exists an instance prog arg which runs in P-time and the exit status is 1. From the definition, Sat computes a ℕℙ problem. If ℕℙ=ℙ, then, an executable f exists that "Sat f" should run in P-time: // C source of executable f #include <...
I am reading the book "Automata, Formal Languages, and Automata" written by Dr. Emre Sermutlu and in page 153, it is stated that the following grammars are not in Chomsky Normal Definition (CNF): $G_1$ : $S\rightarrow TT\mid a$ $T\rightarrow ST \mid b$ $G_2$ : $S \rightarrow TT \mid a$ $T \rightarrow a \mid b \mi...
For what example would Maekawa's algorithm allow out of timestamp order access to the critical section. It is mentioned that ordering is not satisfied in Maekawa's algorithm. But in what scenario would this be true? From my understanding, we will always have the queue at each process that follows FIFO and will ensure t...
I'm trying to prove that $f \in \mathcal{O}(\lfloor f \rfloor)$ given that $\forall m \in \mathbb{N}, f(m) \geq 1$ Here's what I've thought of so far, we can set C = 10 and k = 1 and somehow prove that this would eventually dominate the function? Not sure how I can prove this without a concrete function defined for $f$...
I trying to learn about virtual memory at the moment and one of the explanations I've look at has a diagram like below. You can see that 32 bit virtual addresses are used so the virtual address space is 2^32 addresses and the computer must have RAM of a capacity 4GiB or smaller. You can see the physical addresses in th...
Given $A$ a countable set of numbers and $\min$ the function returning the minimum of a set (if exists). Is $\min(A)$ computable? My first try is thinking $A$ as infinite list $A = [a_0, a_1, a_2,...]$ such that $a_i < a_j$ for every $i < j$ and write a simple while program $P$ such that $P(A) = a_0$. Is that correct? ...
I try to wrap my head around the Floyd-Warshall algorithm, and I don't understand why the shortest path is guaranteed to be found since we check only the alternative connections up to one hop deep. For example, let's consider the following graph with four vertices: A B C D A 0 5 -1 x B x x x x C x x...
How can we design a data structure (storing ordered data) that gives the best worst-case lookup complexity possible, under the constraint that we require the worst-case insertion complexity to be at most $\mathcal O(\log\log n)$? (For clarity, I am considering equality == and inequality < tests to be the only "costly" ...
I am currently reading nearest Neighbour search problem where given a set of points, preprocess it so that given a query point one can find a nearest neighbor. There are two phases, preprocessing phase and query phase. I am trying to design a parallel algorithm for nearest neighbor search problem, but I am confused bet...
L1, L2, and L are not finite. We're given that L and L2 are regular. However, L1 ∩ L2 is empty, since L2 is the complement of L1. Is L1 regular under the property that regular languages are closed under union? I have been going back and forth about this for a while and any help would be appreciated. Thank you!
Given a sparse undirected graph $G=(V,E)$ where $|E|=O(|V|)$, a one-hop path between a pair of vertices $(u,v)$ is a path in $G$ connecting $(u,v)$ where there is exactly one intermediate vertex between the vertices i.e. $u \leftrightarrow t \leftrightarrow v$ where $t$ is the intermediate vertex, $(u,t,v)$ are distinc...
How would someone create a Turing machine that computes ceil(sqrt(n))? n = 1, 2, 3, 4, 5, 6, 7, 8, 9, ... => f(n) = 1, 2, 2, 2, 3, 3, 3, 3, 3 .... And that I want the input tape to have n 1's in it to represent the number i.e. 5 would be #11111 How would the turning machine with transition table for this be created?
I'm struggling in finding a correct way to approach this, I'm aware that this problem is solvable using dynamic programming, and this problem somehow relates to the "max non-contiguous subarray" problem, yet I cannot make the connection. Given an array of integers, $A=(a_1,\ldots , a_n)$ for which $\sum_{i=1}^{n}a_i<0$...
Given a set of points, and a convex d-dimensional polytope represented only by a set of its' vertices, I need to query in order to check for each point if it's inside the polytope. I know of the O(log(n)) solution in 2D (like the answer to https://stackoverflow.com/questions/36135978/show-that-given-a-query-point-q-it-...
How do I show the correctness proof of Dijkstra’s algorithm for negative edge weight $\textbf{indicating the point in the proof where it breaks or does not hold}?$ I tried proving it like this, but i know that i'm not correct. Set $d[s] = 0$ (where $s$ is our source). Set $d[v] = \infty$ for all $v \ne s$,$v \in V$. R...
Given a permutation on the array of integers 1 through n, I want to find the index of the permutation in a list of all possible permutations of those integers, sorted in lexicographic order. For example, given the permutation {1, 3, 2} with n=3, I want the program to return 1, because the array has 6 permutations ({{1,...
Merge sort and FFT are both divide and conquer algorithms that split the input in two repeatedly. While merge sort can be applied to any $n$, the FFT algorithm given in CLRS (section 30.2, third edition) only applies when $n$ is a power of $2$. How come we can forge ahead with any $n$ for merge sort, but not quite for ...
If javascript's object is just associative array, what makes it non-primitive as they have labeled it? It is certainly already built in. Its not like I'm creating my own concrete implementation of associative array before i begin coding on it. According to wiki's quote: Primitive data types or built-in data types are ...
From tutorials point: Subtract micro-operation are using minus operator we create 1's complement and add 1 to the register which obtains subtracted, i.e R1 - R2 is similar to R3 → R1 + R2' + 1 $$ R2'= 0011 $$ $$ R3=R1+R2'+1 \\\Rightarrow R3 = 1011+0011+1 \\\Rightarrow R3 = 1111 $$ This is obviously not the right ans...
I have a group with n members. These are distributed members. It is basically a group chat. A new member is added to the group and the existing members are informed about this. Now I want the new member to obtain some information about the group that the existing members all know. This could be the name of the group. T...
Let $L=\{<M> | M$ is a TM, $L(M)\ne \emptyset$ and $\forall x\in L(M), \overline{x} \notin L(M) \}$ While $\overline{x}$ is the bit flip of $x$. I want to show a mapping reduction to prove that this language is either in R / RE / coRE or none of them. My intuition is that this language does not belong to any of the cla...
I need a perfect hash function that maps 2 integers into one integer twice the size (i.e. $(Int64, Int64) \rightarrow Int128$). The function preserves sum of leading zero bits: $(0, 0) \rightarrow 0$ - good mapping, as each argument has $64$ leading zeros and that transformed into $128$ leading zeros of the output $(0...
There are a ton of resources on the web devoted to proving some esoteric language is Turing complete by simulating arbitrary turing machines. I have an esoteric language I want to prove is complete, but I'm pretty sure the easier way to do it would be to prove that you can express any untyped lambda calculus term in i...
In mathematics and philosophy there are some unsolvable problems like Russell's paradox or the liar's paradox that are usually said to be undecidable... There are also other "impossibilities" such as finding positive integers to divide a prime number other than the number itself and 1. However, could we use some kind o...
There's a famous classical circuit complexity result by Shannon that says almost all languages require exponential circuits [[1]], proven by comparing the number of distinct circuits of $n$ variables versus the number of boolean functions of $n$ variables. Similarly, there's a result that "almost all" languages are und...
Is there any dynamic way of solving this problem? I would thank any help, I know the Subset sum Problem, but for solving it dynamically u have to create a matrix but here is not posible as the colums may not to be integers.
The Brouwer fixpoint theorem states that any continuous mapping $f$, from a convex, compact set to itself will contain a fixpoint. The Brouwer algorithm finds these (approximate) fixpoints. But how is a continuous function inputted into this algorithm? Is it as a black box? If so, would changing this to a discrete set ...
During diverse double-compiling, they say that it is proof that either all the compilers are subverted, or none of them, but they cannot say which one is subverted. In my studies of the technique I tried to draw a figure how we can compile three rounds and after that, knowing exactly which one is compromised. But do yo...
As the title hints, I'm looking for a dynamic programming/greedy approach to find the diameter of a N-ary tree graph. This must be done in linear time. The problem states that the graph is undirected when passed to the algorithm, yet there is a way to transform it into a rooted directed tree graph in linear time. All t...
Upfront, I'm not a computer science or mathematics graduate. I am a dabbler/recreational programmer and I find some problem/solution scenarios intellectually stimulating to attempt. Sometimes (frequently, actually), this lack of formal training limits my ability to formulate a good solution to a problem. I can pretty...
Good Evening, So I am trying to solve this exercise which is a paticular case of maximum flow algorithm. Here the graph must have all even edges and 1 odd edge and it must have a maximum flow that is odd. Now I need to prove the following two points which state that the single odd edge must have a flow $>1$ and/or that...
Most of the proofs of such properties that I see involve informally using algorithms or invoking Turing machines as needed. But it's not clear to me how are we using set operations on instances of decision problems? Moreover, it is not intuitively clear to me how we can use different instances of decision problems for ...
I am trying to build the logic behind a divide and conquer algorithm that will find the majority element in a matrix $A$ with $n$ elements in $\mathcal{O}(nlogn)$ time. I thought that in order to make it divide and conquer, I'd need to split the array in two parts. By definition the majority element would be the one th...
I faced the following claim on wikiepdia about interval graphs (https://en.wikipedia.org/wiki/Interval_graph): The pathwidth of an interval graph is one less than the size of its maximum clique. I have thought a while about it, but don't come up with any argument/proof why the pathwidth is bounded by the size of the ...
In computational creativity, how do you measure how creative something is? Let's say you have to compare a piece of music written by Bach and then compare it to Chopin, how would you evaluate how creative they are and compare them both by giving them scores? How would the model work, are there existing models, and how ...
I've wondered this for some years now. As near as I can figure, if individual files were tagged with each of the components in a typical path (e.g. each of ['C:', 'Program Files', 'Mathematica'], or ['var', 'log'], etc.), you would be able to uniquely refer to files if desired, while gaining a lot of flexibility in org...
For amortized analysis (aggregate method), dynamic table insertion cost can be divided into: if no expansion, then cost = 1 if we expand the table, then cost = i (if i-1 is an exact power of 2) then the total cost is I don't understand how to get 2n from the part that I circle below
Suppose you have a dependency graph of "packages" registered in the ecosystem of a given programming language. We can model each package as a tuple (name, version) where name is the package name (like Plots) and version is a semantic version number (like 1.2.3). Each package has a set of dependencies, which may include...
I'm preparing for my exam and I got stuck on the following problem: The gardening problem: We have access to a set of different types of seeds and a number of plant pots.For each plant pot, there is a limit to how many seeds can be planted in that particular pot. In addition, there are seeds that cannot be planted in ...
Recently I came across with a question about Von Newman architecture (which is usually used) and whether the following statement is true or not? In Von Neumann architecture data are stored in disk and instructions are stored in state registers. Answer to this is false. Why? Now my questions is: -> What are state regist...