instruction
stringlengths
35
29.1k
Given a graph G, we say C a cycle of G such that however we take two nodes a and b of C, there is NOT a path between a and b in G\edges(C) (that is the graph G less the edges of C). Is C a minimal cycle of G? If it's not, what is the name of such a cycle?
i want to learn about the structure of a .blk file but the problem is I don't know where to look for detailed information of this sort, most of the google searches I made gave me links to viewers.
Given $\sigma_1 \dots \sigma_n$ a sequence or word of length $n$ over $\{0,1\}$ I was wondering if there is a computable function to calculate $\sigma_m$ in $\log(P(n))$ time where $P(n)$ is some polynomial of degree $Q(n)$ for some other polynomial $Q$ and with $\log(P(n))$ space with regard to some global endocing us...
I am learning some basics in computer. In that in ASCII I read if 65 is A . When we pressing key A what is happening next? Is the electric signal is passing as on & off & reaching to decimal part 65 (or) directly converted to binary? If it is reaching 65 then which location character map (or) encoding is available? P...
Suppose there exist deterministic turing machine $M$ that could solve SAT in polynomial time. How can we construct a deterministic TM $N$ ,by using SAT solver $M$, that take as input a non-deterministic TM for language $L$ and output a deterministic TM for $L$. I know we can convert NTM to TM but im looking for a way w...
The following is exercise 3.8 from the first edition of Mitzenmacher and Upfal's Probability and Computing: Randomized Algorithms and Probabilistic Analysis. Suppose that we have an algorithm that takes as input a string of $n$ bits. We are told that the expected running time is $O(n^2)$ if the input bits are chosen i...
int *numPtr; double num; numPtr = # This code shows an error as pointer points to data of different datatype. But why does it show the error? Why doesn't the compiler typecast the pointer and remove the error? Just like a character becomes an integer as it is implicitly typecasted. (int a = 'a';) It should do simi...
It is known that the computational complexity of deciding whether an LTL specification is realizable in a safety game is 2EXP-complete (that is, you receive an LTL formula, where some variables belong to the environment and some to the system, and you ask if it's possible for the system to always satisfy the specificat...
Here's a problem of CLRS: Use the following ideas to develop a nonrecursive, linear-time algorithm for the maximum-subarray problem. Start at the left end of the array, and progress toward the right, keeping track of the maximum subarray seen so far. Knowing a maximum subarray of $A[1..j]$, extend the answer to find a ...
This is a problem of CLRS: What is the largest $k$ such that if you can multiply $3 \times 3$ matrices using $k$ multiplications (not assuming commutativity of multiplication), then you can multiply $n \times n$ matrices in time $o(n^{log(7)})$? What would the running time of this algorithm be? Solution: We assume that...
I was reading about the halting problem recently, but I couldn't quite figure something out. We take $H(x,y)$ to be a program which works out if program $x$ with input $y$ halts, and $H_2(x,y)$ to be a program which works out $H(x,y)$ and then does the opposite (if $x$ halts, $H_2$ loops, else $H_2$ ends). The halting ...
If instead of saying there exists some $C \in \mathbb{R}^{+}$ and $N \in \mathbb{N}$ such that for any $n \geq N$ we have $f(n) \leq Cg(n)$ we say that there is some $C \in \mathbb{R}^{+}$ and some subsequence $(f(n_{k}))_{k \in \mathbb{N}}$ with $(n_{k})_{k \in \mathbb{N}}$ strictly increasing such that for any $k \in...
Can anyone give an intuitive explanation to why IP = PSPACE, or at least one direction of it? I looked at many research papers but its very hard to understand the formalism unless you have a solid background in Turing machines and complexity theory. I'm an undergraduate.
I would like to prove that the grammar $G$ with the rules $$ S \to SS \mid aSb \mid bSa \mid a \mid \varepsilon $$ generates the language $L = \{w \mid \text{$w$ has at least as many $a$'s as $b$'s}\}$. Question My proof is below, but it feels rather clunky and unintuitive. Does anyone have an alternative proof and/or ...
I was trying to get started with a small project but I quickly realized I had to do more research on the subject. Suppose, when creating a site, in production, there's a certain structure how the backend and front end are maintained for scalability. Suppose, you're node application is containerized, deployed inside a E...
I am reading Nancy Lynch's Distributed Algorithms. In page 103, there is the FloodSet algorithm. Can anyone please explain what Uj mean in W := W U Uj xj (line 3 of transition function)?
What is an example of an algorithm that requires synchronised clocks? Synchronised in an absolute sense, not just synchronised clock rates. For more background, I've read Barbra Lisksov's 1993 paper 'Practical Uses of Synchronized Clocks in Distributed Systems' and also some content on Cloud Spanner and TrueTime. I'm...
I have encountered a structure that looks like a monad with a one-sided inverse and some additional properties. I am not sure which properties of this structure are essential and which are accidental, so I will follow a simple example in my description. I have a base type a which consists of sorted strings (e.g "aacdee...
I have been wondering about the following question for quite some time: You are given an array $x$. Define f(x) as the prefix sums of this array. For example, f([1,0,1]) = [1,1,2] and f(f([1,0,1])) = [1,2,4]. Define $k$ to be the recursive depths of a series of f(x) (how many times it is nested). For example, f(f(x)) h...
I have a sparse $60000\times10000$ matrix where each element is either a $1$ or $0$ as follows. $$M=\begin{bmatrix}1 & 0 & 1 & \cdots & 1 \\1 & 1 & 0 & \cdots & 1 \\0 & 1 & 0 & \cdots & 1 \\\vdots & \vdots & \vdots & \ddots & \vdots \\0 & 0 & 0 & \cdots & 0 \end{bmatrix}$$ Each row represents a different point in time ...
I have a sparse $60000\times10000$ matrix where each element is either a $1$ or $0$ as follows. $$M=\begin{bmatrix}1 & 0 & 1 & \cdots & 1 \\1 & 1 & 0 & \cdots & 1 \\0 & 1 & 0 & \cdots & 1 \\\vdots & \vdots & \vdots & \ddots & \vdots \\0 & 0 & 0 & \cdots & 0 \end{bmatrix}$$ Each row represents a different point in time ...
My notes on P vs NP say the following: Every problem x in the NP-hard class has the following properties: – There is no known polynomial-time algorithm for x. – The only known algorithms take exponential time. – If you could solve x in polynomial-time, then you could solve them all in polynomial-time. The last point ...
In Sipser's Introduction to the Theory of Computation, the author explains that two strings can be compared by “zigzagging” back and forth between them and “crossing off” one symbol at a time (i.e., replacing them with a symbol such as $x$). This process is displayed in the following figure (from Sipser): However, thi...
I've read through a few definitions of a partially observable environment/MDP, and I need confirmation whether the partial observability is really a generalization of a MDP (misnomer) and not a required feature, just like when we call nondeterministic automata the union of a) deterministic automata and b) (what I like ...
(moved from stackoverflow to here) I'm trying to understand dataflow stuff for program analysis. Transfer functions move lattice elements up (towards top ⊤) and down (towards bottom ⊥). Sometimes the direction confuses me a bit (I'd do it in the other direction), so do the top and bottom elements of a lattice have any...
If a Turing machine halts for all rejects of L but might accept/loop otherwise, how is L's recognizability classified? Recognizability Decidability ${\langle L\rangle}$ ${\langle \overline{L}\rangle}$ Turing-Unrecognizable Undecidable loop or reject loop or reject Turing-Recognizable Undecidable accept reject...
I read this site example 12 that {${xww|x,w∈(a+b)^*}$} the set of strings generated by language $L$ is {${ϵ,a,b,aa,ab,ba,bb,aaa,…}$} by taking always $w$ as $\epsilon$ and $x$∈$(a+b)^∗$. But my question is why they taking always $w$ as $\epsilon$ to prove it is regular. In that same logic why $ww$ isn't regular by t...
I currently have an algorithm that uses brute force/exhaustive search to find all of the cliques of size exactly k in a graph G. My algorithm is as follows: Generate all subgraphs of size k, and check each one to determine if it is a valid clique. I'm trying to find the time complexity of my algorithm, but I'm stuck on...
I have noted that in several very unrelated human natural languages, people often confuse the term "virtual" with "digital". As for Computer Science, is it correct to categorize all software whatsoever to "digital" or "analogue" (by means of how programs work)?
Shor's algorithm uses the Quantum Fourier Transform to find the period the function a^x mod N with "a" being a constant integer less than N and N being a semiprime. This function is periodic and has both a domain and image of all integers from 2 to N. What is the fastest classical algorithm that could be used in place ...
Union of two REL is closed under union. I don't understand how is it closed. I followed this link. The have stated: Here the trick is to simulate both M1 and M2 “simultaneously”. In other words, we design a machine that executes one step of M1, followed by one step of M2, then again one step of M1 and so on. My quest...
If a primary server's UTC source fails, then it can become a stratum 2 secondary server. If a secondary server's normal source of synchronization fails or becomes unreachable, then it may synchronize with another server. I have made a picture based on what I understood. I don't understand how will synchronization be ...
I saw two different definitions of time constructible functions. In Sipser (third edt), Definition 9.8, defines $t(n)$ is time constructible if $t(n)\geq O(n \log n)$ and maps $1^n$ to the binary representation of $t(n)$ in time $O(t(n))$. In arora, there is a lower bound $t(n) \geq n$ instead of $t(n) \geq O(n \log n)...
Notation: Let $t$ and $u$ be terms in the $\lambda$-calculus, and $x$ be a variable name. Let $[x\mapsto u]t$ be the substitution in $t$ of free variable $x$ for the term $u$. Specifically, I'm using the algorithm given in Functional Pearls: α-conversion is easy. Let $t^\phi$ be the de Bruijn index–representation of...
How to notice the type of algorithm whether it is polynomial or fully polynomial time approximation from the resulting running time ( execution time) of the program? Is there any other way to decide?
I ran into this problem while trying to create a procedural texture algorithm. I ended up using a greedy approximation and shuffling it to hide the bias, but I was wondering if there was a way to find a uniform solution. The Problem Divide a wall of a height $H$ into a layers whose individual sizes range from $L_{min}$...
I have a confusion on understanding the relation between: The input n ,The relative error and The running time of the program In both PTAS and FPTAS. In "The running time of PTAS must be polynomial in terms of n, however, it can be exponential in terms of ε. In PTAS algorithms, the exponent of the polynomial can increa...
I have asked 1 type of question but I have asked that in many questions. So bear with me. My question is about 1 topic, I just didn't find it right to create separate questions for each of these questions so I am asking like this-: The Lamport logical clock algorithm is-: at pi : before each event Li= Li + 1 when pi ...
$G$ is a strongly connected graph with nodes $V$ and edges $E$. Each node $v_i$ receives a sample $x_i$ from a Gaussian $\mathcal{N}(\mu,\sigma^2)$ with unknown mean and variance. The objective is for all nodes in the graph to find Maximum Likelihood estimates for $\mu$ and $\sigma^2$. To do this, nodes are allowed to ...
Is there a class of recurrence relations that can't be solved using the substitution method? Let me explain the motivation behind this question by an example. Consider the recurrence relation $T(n) = 2T(n/2) + n$. It's obvious that $T$ is in $\Theta(n \log n)$. To verify that $T(n)$ is in $O(n\log n)$, one could use th...
I've been able to form a recurrence relation with memoization in a recursive approach for most problems but the online coding rounds exceed the time limit or stack overflow occurs in all these problems. An iterative approach seems to be the only way out. But coming up with logic for filling the DP table is frustrating ...
Calculating the factorial n! by the algorithm that defines it is of O(n) complexity because it requires n-1 multiplications to find the solution. Is there an algorithm that is any faster than that?
I’m having trouble coming up with a good adversary strategy for this problem: Input: a graph G Output: the maximum size of any clique in G Where the algorithm asks each time, “are vertices x and y adjacent?” and it could ask about any random pair of vertices in the graph. So, I need an adversary strategy to force the a...
I have the following problem. We have a boolean function $f$ that is expensive to compute for a given input. We need to find the smallest positive integer $n$ such that $f(n)$ is true. We don't know anything about $f$, i.e., there could be multiple inputs that produce true. We only know that $n < M$, where $M$ is some ...
I'm following a university course based on these slides, and I have a question about structural operational semantics. As you can see at page 7 (4-th slide), a structural rule is interpreted logically as: ∀(antecedent ∧ side-condition ⊃ consequent). Then it says that "The structural rules define inductively a relation,...
I've proven that $n\log_{2}\log_{2}n = \Omega (n\log_{3}\log_{3}n)$ but is $n\log_{2}\log_{2}n = O(n\log_{3}\log_{3}n)$ also true? Looks like it's not and actually $n\log_{2}\log_{2}n = \omega(n\log_{3}\log_{3}n)$. A problem of CLRS led me ask this.
The emptiness problem for Context Free Grammars is decidable. Does the same hold for Parsing Expression Grammars (PEGs)? That is, is it decidable given a PEG $G$ to find whether $L(G) = \emptyset$ or not. My intuition says no, as PEGs are closed under intersection, allowing one to construct hard instances of intersecti...
I am a beginner, but I think I understand how to do Montgomery multiplication. Also, there are online calculators (for dummies like me)... But I have a paper in front of me, that is all about how to compute $28510 · 38762\; \text{mod}\; 36057 = 23831$ Am I taking crazy pills? Isn't it $29684$ that they were supposed to...
I am writing a small x86-64 OS. I am trying to make sense of how Linux loads modules at runtime by linking them into the kernel. I understand that Linux builds a symbol lookup table. Basically, a module is compiled with a special utility which keeps all the symbols intact. Then, the Linux kernel will read the symbols a...
From what I can see, the proof of the undecidability of the Halting Problem relies on a fairly basic self-referential paradox, the simplified version being (from Wikipedia): def g(): if halts(g): loop_forever() Obviously, in this case there can not be any output for halts(g) as the output of g itself depe...
The data I have is a group of points with their position (x,y) known: It is known that all these red dots are situated exactly on the lines which form a grid system like following: My object is to find such a grid system that these dots are sitting on. A few assumptions that help solve the problem: These blue lines ...
I recently got onto the following problem: we consider the following array: A = [2, 3, 6, 1, 6, 4, 12, 24] we need to count the number of times these two conditions are satisfied within the array: A[i] * A[j] * A[k] = A[l] so that 0 <= i < j < k < l < len(A) for this example the result should be 8. example of satisfi...
There many many ways to code binary search, but one of the main distinctions I've seen in people's code is one group of people use while(l < r) and another uses while(l <= r). I personally use the latter. Is there any advantages/disadvantages to using either? I've never used while(l < r), so when I see it, it's not alw...
I've been looking for an algorithm to tell the number of non-zero rows (or columns) in a row reduces matrix $A\in \mathbb{R}^{m\times n}$. A simple approach would be to check it, row by row, which would take $O(m\cdot n)$ time and I believe would be linear. It seems to be the lower bound, but I am not sure, could there...
Problem Statement: You are given a string s and two integers x and y. You can perform two types of operations any number of times. Remove substring "ab" and gain x points. For example, when removing "ab" from "cabxbae" it becomes "cxbae". Remove substring "ba" and gain y points. For example, when removing "ba" from "ca...
I'm currently solving some problems over at kattis, in particular the Add 'Em Up task. A quick summarizing: You are given an array with $1 \leq n \leq 100000 $ elements and an integer $2 \leq s \leq 200 000000$. You want if there exists two elements $x_i,x_j, i \neq j, $ in the array such that $x_i + x_j = s$. However,...
30 buses are used to transport 2000 passengers. Each bus has 80 seats and each passenger will occupy exactly one seat. Consider the following statement: At least X buses will carry at least 67 passengers and at least Y buses will have at least 14 vacant seats. Assuming that this statement is always true irrespective of...
I suspect this is a standard problem, but I was unable to find any literature on it -- my question is, what is the canonical formulation (and ideally solution) to the following: Given a set $S$ of $K$-colored graphs $\{G_i\}$, find the smallest graph $G$ by number of nodes that contains all $G_i \in S$ as subgraphs. ...
of course there is a theory that how many recursive calling the same system to solve problems, this theory is "recursion theory", If i know correctly. and recursion theory is computability theory. but where is the theory that deals with infinitely many calling or endless self-reference, so that one can identify such bl...
Generally we will say there is A DFA for a language if we give a string to that DFA and after processing it it will reach to DFA and DFA more or less stops at final state,so then we say there is a DFA, and if that string does not reach final state we say there is no DFA In Contrast When it is case for Recursively enu...
If you have a tree, where nodes can be either selected or not selected, and you wanted to describe which nodes were selected or not you could either List all the selected nodes and infer the others are not selected. Say a node and all it's children are selected or deselected then apply these rules to build up the tree...
If all programming languages more or less compile down to the same machine code. Have there been attempts at, or is there a "field" around the concept of even more modular programming languages, where it can be built-up based on exactly what is needed? If arrays aren't handled, the language to simplify writing a progra...
If I have points on a line at positions (0), (1), (3), and (7) the set of intervals between any two points is the set of integers (1,2,3,4,6,7). In-general, a set of N unique integers can be represented by approximately log(N) points on a line. However, I want to represent a contiguous set of integers (1 to N) this way...
I have a problem that I have an unsatisfactory answer to and I would be interested in knowing if there is a better solution I am missing. The problem is as follows: Compute a series of build and move actions a player can take that will construct a pixel structure. A player can move to blocks to their left or right that...
I don't know where else to ask this. And I don't know when or if I'll get reply at all if I comment on that answer. I was reading this answer on a text of CLRS and in the last line got confused. I understand with $c \lg n$ we can represent decimal numbers up to $n^c$. Does "index up to $n^c$" mean being able to store o...
The Bowyer-Watson algorithm for Delaunay triangulation is known to run in $O(n^2)$ according to the authors, where $n$ is the number of data points in $\mathbb R^d$. In addition, the algorithm (for example, as is written in Bowyer's paper, at stage 5 of the algorithm), runs over all the simplexes, (also runs over simpl...
Given $N$ vertices and $K$ components what is the maximum number of edges that may exists ? I just got gut instinct that it will be maximum if we take one set with $k-1$ vertices and this will have no edges. And other set with $N-K+1$ vertices which will be a complete graph. And yes it is the right answer $(N-k+1)(N-k)...
The posting in the website Embedding SATISFIABILITY into 3-DIMENSIONAL MATCHING seeks $3SAT$ as a $3$ dimensional matching instance. I am looking to solve the converse problem. How to solve three dimensional matching using SAT solvers? I know 3dm is NP complete and so can be solved by SAT. How do you embed 3DM as a SAT...
I have seen this statement in my studies and I cannot figure out why it is true. We know that $P_{HALT} \leq_T \overline{P_{HALT}}$, but $P_{HALT} \leq_m \overline{P_{HALT}}$ does not hold. I know, that If the many-one-reduction was possible, then both problems were semi-decidable, which makes the Halting problem decid...
Alphabet = {a,b} should null string be the part of this language? L ={^,a,b,aa,bb,abba ......} I have seen on different sources not including null string. Is null string a part of this language or not?
With regular numbers it is always possible to convert them from one (integer) base to another. But what happens if we consider numbers for which their magnitude is not known in advance, or in other words, what if we are only allowed to work on a stream of digits (bits in case of base 2)? Then, by observaion: base 16 a...
Given a 2SAT instance can we convert into bipartite perfect matching in parsimonious reduction?
Given 3 decision problems in $NP$: $A,B,C$. Consider that there are $2$ reduction algorithms, one is $A\le_p B$ (with run-time $n^{10}$) and the other is $B\le_p C$ (with run-time $n^5$). If $B$ is $NP-complete$, is it valid to say that $A$ and $C$ are also $NP-complete$?
Suppose you're given $x,y$ integers s.t. $x \leq y$. I want to find all values $\in [x, y]$ (inclusive) that are a power of $2$. There's a $O(\log y)$ approach, where you just start at $1$, and keeping multiplying by $2$ until you get to the first value that is $\geq x$. Then you can start storing these values until yo...
Fair warning: I don't actually know a functional language so I'm doing all the pseudocode in Python I'm trying to understand why functional languages disallow variable reassignment, e.g. x = x + 1. Referential transparency, pure functions, and the dangers of side effects are all mentioned, but the examples tend to go f...
I am studying the book "Understanding Machine Learning: From Theory to Algorithms". I am struggling to understand the solution to exercise 3 (2) on page 41. Exercise: An axis aligned rectangle classifier in the plane is a classifier that assigns 1 to a point if and only if it is inside a certain rectangle. Formally, g...
According to Wikipedia, given a randomized algorithm $\mathcal{A}$, two neighboring datasets $D_1, D_2$, a real number $\epsilon > 0$, $\mathcal{A}$ provides $\epsilon$-differential privacy, if $$ \frac{\mathbb{P}[\mathcal{A}(D_1) \in S]}{\mathbb{P}[\mathcal{A}(D_2) \in S]} \leq e^\epsilon $$ for all subsets $S$ of $\m...
Playing nandgate to learn logical gates. Is the design below the simplest xor gate that can be built using the relays available? Seems like crossover relays allow a much simpler xor gate but don't have those there.
If I have as set N of n unique elements, is there a known algorithm that can return every possible way in which they can form groups of size k? Eg: If N = { A, B, C, D} and k = 2, then the algorithm should return [[(A, B), (C, D)], [(A, C), (B, D)], [(A, D), (B, C)]] Here it's safe for me to assume that n is always ...
https://www.nature.com/articles/s41467-020-17419-7 I am a medical school graduate and I really want to learn AI/ML for computer-aided diagnosis. I was building a symptom checker and I found the material. It clarifies the drawbacks of associative models which are performing differential diagnosis. And it suggests counte...
Given a directed graph G=(V,E) how can I check to see if it is strongly connected i.e. every vertex is reachable from every other vertex. what's a good algorithm to check for this that runs in O(m) time? (the number of edges) where we assume that n < m. (there are always more edges than vertices in the graph)
Given n elements (boxes) I have to output the max number of boxes that can fit one into another. Each box has width (x), height (y) and depth (z). One box j can hold another box k if: j.x > k.x and j.y > k.y and j.z > k.z. Rotation is not allowed. Searching some approaches on the net, I found this can be a way: organiz...
Edit: Here's maybe a clearer presentation of my question. In a Boolean formula, all the gates have fan-out 1, and the graph representing the formula is a tree. In a Boolean circuit, the gates can have multiple outputs. What can be said about formula size as compared to circuit size? I am learning some basics about clas...
I have a recurring task which finished just now. I schedule it to run every ten minutes; the task will reoccur $10n$ minutes from now for all positive $n$. If instead I choose 50/50 between ten minutes and ten minutes plus one second, eventually all offsets (in seconds) relative to the start of a ten-minute period bec...
When a value $x$ is a power of $2$, that is, $x = 2^n$ for some nonnegative integer n, we can readily write $x$ in hexadecimal form by remembering that the binary representation of $x$ is simply $1$ followed by $n$ zeros. The hexadecimal digit $0$ represents $4$ binary zeros. So, for $n$ written in the form $i + 4j$ , ...
I'm currently doing a small-time project where I have to deliver a model which can classify specific elements on a web-page using the HTML code. For this, I have considered using the HTML tags for each specific element (which I can extract using some other code) and then transforming it to a vector to give a neural net...
Consider an adjacency matrix $A$ with elements $[A]_{ij}=1$ if one can reach state $i$ from state $j$ in one timestep, and $0$ otherwise. The matrix $[A^k]_{ij}$ represents the number of paths that lead from state $j$ to $i$ in $k$ timesteps. Derive an algorithm that will find the minimum number of step to get from sta...
There are two problems in CLRS about implementing stacks and queues with singly linked lists. I know the solutions, I know how STACK-EMPTY and PUSH and POP and QUEUE-EMPTY and ENQUEUE and DEQUEUE are defined. But can we define STACK-FULL and QUEUE-FULL with worst-case $\Theta(1)$ time? One idea is to set a counter and ...
I am reading "Bayesian Reasoning and Machine Learning By David Barber". I am not completely sure how to do question 19 on page 23: Show that for a connected graph that is singly-connected, the number of edges $E$ must be equal to the number of vertices minus $1$, $E=V-1$. Give an example graph with $E=V-1$ that is not ...
This is a real world algorithms problem I came across while coding an application for excel. The background: In excel, we have to write color information to the sheet one cell at a time - there are no array methods. Moreover the act of adding a fill color to a cell is computationally slow. The one exception to this is ...
The pseudocode for the pivot function for the Median of Medians algorithm is given in https://en.wikipedia.org/wiki/Median_of_medians. On the last line, there is a mutual recursion call to the select function and you can see that the median of the subarray of medians is passed in as parameter n in the select function. ...
The 3-SAT problem, i.e. the problem whether a given Boolean formula consisting of clauses of at most 3 literals is known to be NP-complete. Then it’s complement, i.e. whether such a formula is unsatisfiable, is coNP-complete, right?
In question (e), I have to prove: A ≡ (KB ⊭ S) and (KB ⊭ ¬S) is satisfiable, where KB and S are propositional variables. I am not able to follow the solution given in the image above as to why it is replacing S with another propositional variable P. Even if we do take P, one of (KB ⊭ P) and (KB ⊭ ¬P) becomes true and ...
I understand that the title might be confusing so I'll lead with an example. I have the following set (actually a map): { "ab": 2, "ac": 1, "ad": 3, "ae": 4, "abc": 6, "b": 2, "ba": 4, "bc": 4, "bd": 3, "bde": 4, "c": 2, "cb": 3, "cde": 5, "d": 4, "e": 4 } I want to find a subset of entri...
All sources I have seen list taking two operands from the stack once we encounter an operator. Why? What if not all of my operators are binary (taking two arguments)? What if I have custom unary and ternary operators?
$6983776800$ in binary has 33 bits but has $2034$ positive divisors. If a list of divisors were to be logarithmic in N, it needs to take less than 33 bits. I believe there is an infinite amount of numbers with more divisors than the bits used to represent them. Thus it is not possible for any algorithm to create a list...
Given a set (i.e., a collection of distinct elements), how would you find a minimal sequence where every subset of that set can be found as the elements in some contiguous subsequences? The order of elements in a contiguous subsequence does not matter when they are considered as a set. For example, such a minimal seque...
I was searching whether a bipartite graph can have a vertex with 0 degree. I found this, but the answer there says it is possible. Wouldn't that make a graph tripartite? Also, if a vertex with zero degree exists that will make König's theorem wrong. For example let bipartite graph edges be $(1,a),(2,b),(3,b)$ and $4$ w...
I am new to automata theory and have a problem that I want to solve. We have to design an NFA that starts with "ab". I have the solution and it is given by: However, my problem is: If the string does not start with $a$ then the machine will die out in such a case and will not read other letters in the given string, is...
I'm facing a (possibly simple) problem while proving a theorem. I need to show that under several (true) assumptions, some element is not in a set. Such assumptions are all met and there is are lemmata that can be employed to reach the conclusion. The problem comes from the fact that the lemma for doing so must be appl...