instruction stringlengths 0 29.8k ⌀ |
|---|
null |
We know that finding the size of the maximal independent set of a planar graph is NP-complete. I'm curious about whether it remains NP-complete for maximal planar graphs, i.e., the graphs in which adding any edge will destroy its planarity, or equivalently, all edges of whose faces are bounded by three edges.
I've a... |
null |
There is no common standard because for languages of any kind (both in theoretical CS, i.e. more abstract languages like lambda calculus; as well as in practical programming languages used to write actual code) there always is a preferred mode of usage, or a type of problem where using a particular language would make ... |
This is the given question-
**Construct a DFA over the alphabet {0,1} such that it accepts all strings containing
even number of 0's ***OR*** the number of 1's divisible by 3.**
The very first problem I've encountered was the 'or' mentioned in the question. Does this mean i just '+' the RegEx for -'accepts all... |
Constructing a deterministic finite automaton from a particular regular expression |
null |
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/x8cu5.png
I have several lines that are shown in different colours, do not know which are connected to each other in advance. I want to do path planning only using these lines, i.e., route planning. If I am able to construct a graph usin... |
Route planning on line segments which can be connected or not |
|algorithms|graphs|shortest-path|graph-traversal| |
**Hint:**
Possible first steps are binarization, then thinning.
[![enter image description here][1]][1]
After that, it is no big deal to find the junctions and to follow the edges between them.
[1]: https://i.stack.imgur.com/54JgX.png |
**Hint:**
Possible first steps are binarization, then thinning.
[![enter image description here][1]][1]
After that, it is no big deal to find the junctions and to follow the edges between them.
----------
A piece of caution: thinning tends to turn the lane crossings to double junction points instead of a... |
From this link <https://cs.stackexchange.com/questions/2712/does-npnp-np>
I learned that if $NP^{NP} = NP$, then the polynomial hierarchy collapses to it's first level.
But how to prove it? |
If $NP^{NP} = NP$, then the polynomial hierarchy collapses to it's first level. How to prove it? |
|complexity-theory|np-complete|np| |
null |
I had an assignment in which I had to design a pushdown automata that recognizes the language ${w \in [a,b,c]^*|w }$ have the same number of "ab" and "ba".
Tried to make a pushdown automata that if reads first ab pushes 1 to the stack and then if finds "ba" then pops it (and again reads "ab" and then "ba" , push / p... |
Pushdown Automata Construction |
|automata|pushdown-automata| |
This seems like it should be a "textbook"/standard problem but I wasn't able to find anything about it, so I'd like to know if anyone else has seen something like it before or can suggest more keywords I could search for / perspectives I could view it from:
### Informal problem statement
Informally, the situation... |
Determine bijective mapping using minimal number of lookups in subset mapping - standard problem / perspectives? |
|algorithms| |
As others note, there won't be any one universal standard for pseudocode.
That said, Rosen's _Discrete Mathematics_ has a particularly well-defined system for pseudocode (in Appendix 3), and if you were looking for a particular grammar, then it could be a good model. |
Given a multivariate polynomial of degree 4 on $v$ (real) variables such that there are $N$ terms in the polynomial. Is there an efficient algorithm to verify if it has a solution?
Not aware of any algorithm for this problem. Can someone please comment.
I think the solution itself can be calculated by Newton Ra... |
The existence of solution of a multivariate polynomial |
|algorithms| |
The word you are looking for is **pseudocode.** :) There is no official standard, but as you have observed, there are general conventions that most people follow. Partly this is dictated by popular LaTeX packages (see, for example, [this guide](https://www.overleaf.com/learn/latex/Algorithms)).
It's worth noting tha... |
This seems like it should be a "textbook"/standard problem but I wasn't able to find anything about it, so I'd like to know if anyone else has seen something like it before or can suggest more keywords I could search for / perspectives I could view it from:
### Informal problem statement
Informally, the situation... |
No. The problem is NP-hard.
It is NP-hard to test whether a system of quadratic equations has any solution. See https://cs.stackexchange.com/q/150339/755, https://cs.stackexchange.com/q/146258/755 (related: https://cs.stackexchange.com/q/77985/755).
Let $f_1(x)=0$, ..., $f_k(x)=0$ be a system of quadratic equat... |
This seems like it should be a "textbook"/standard problem but I wasn't able to find anything about it, so I'd like to know if anyone else has seen something like it before or can suggest more keywords I could search for / perspectives I could view it from:
### Informal problem statement
Informally, the situation... |
Recently, I’ve been interested in the console of the Source game engine, more specifically, its `alias` command, which allows one command to invoke others. It may allow recursion (i.e. running `alias freeze freeze` will cause inputting `freeze` to freeze the engine), but does not allow parameters (i.e. running "`alias ... |
An algorithm
============
I have never seen this problem before, but I can suggest a randomized algorithm for this problem.
- Create a bipartite graph, with left vertices $X$ and right vertices $Y$, and initially containing all edges $X \times Y$.
- Repeat the following until the algorithm terminates:
... |
I want to generate a set of X int numbers, both positive and negative that add up to target value.
The numbers are between -6 and 4 and there needs to be at least 2 negative numbers, and up to half of the numbers can be negative.
I have seen posts about this being done for all positive numbers but I haven't figured... |
Generate a set of X int numbers positive and negative that add up to target value |
|algorithms| |
To see what goes wrong with your approach, it's best to scale down a bit.
As you've defined it, the string $aba$ lies in the language. You should try to come up with a way to make your automata accept this string. |
I have found multiple definitions of what a heuristic is, and I have found multiple computer science-related definitions.
In my university course, the lectures cite the [Nielson Norman Group][1] defining a heuristic as an area of measurement. On [Wikipedia][2], a heuristic is defined as a problem-solving technique. ... |
What is a heuristic in human computer interaction? |
|terminology|heuristics|definitions|user-interface|human-computing| |
Prove that $\Sigma_i^P = NP$ for $i \ge 2$ by induction on $i$.
The base case is $i=2$ and is trivial since, by hypothesis, $\Sigma_2^P = NP^{NP} = NP$. For the inductive step, suppose that $\Sigma_i^P = NP$ and notice that $\Sigma_{i+1}^P = NP^{\Sigma_i^P} = NP^{NP}= NP$.
Now, for $i \ge 2$, you can observe that ... |
Like [this person on Google Groups](https://groups.google.com/g/comp.compilers/c/DW4_ESTikec/m/Z0JHsGoQoYAJ), I'm trying to understand how to write a grammar involving Wolfram Language's low-precedence unary `&` operator.
The operator [works like this](https://wolfram.com/xid/0giru6-gz5):
g[#, #^2] & /@ {x, y... |
How to write a grammar with a low-precedence unary postfix operator? |
|formal-languages|context-free|parsers| |
I am trying to research handling a specific type of possible subgraph in directed acyclic graphs.
However, I am struggling to find the correct term to use.
If we consider the subgraph S to be in a DAG G. Where S is made up of 2 paths, starting at a common node and ending at a common node. Thus forming a "diamond" ... |
Correct Term for describing "diamond" subgraphs in a Directed Acyclic Graph |
|graphs|graph-traversal|dag| |
Everyone will know what you mean by "diamond", in computer science, if you define it up front. See, for example: [multiple inheritance][1].
I don't think there is a standard name for this structure. But also, the term "diamond" doesn't always refer to this, even in mathematical objects that can be represented as dir... |
> It seems to me that it is not simply one huge neural network, but has access to some additional programs like a calculator
I'd add to [D.W.](https://cs.stackexchange.com/users/755/d-w)'s answer that OpenAI's CEO [explicitly mentioned](https://www.youtube.com/live/outcGtbnMuQ?feature=share&t=1317) today in the GPT... |
null |
Mainly there are two methods, estimation of Eigenvalues of a matrix is the command method we use.
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <Eigen/Dense>
#include <unsupported/Eigen/Polynomials>
#include <cmath>
#includ... |
you might aswell ask this qustion over at https://ux.stackexchange.com/.
But you are a CS guy so you probably didn't touch that UX part yet.
Heuristics as defined by Nielson et al. can be used to evaluate the usability of a user interface. They describe common-sense approaches to identify usability issues with user... |
null |
ChaGPT's own words:
"The cosine of 2.325 radians is approximately equal to -0.695206961.
You can use a calculator to find the value or use the cosine formula:
cos(2.325) = cos(2.3 + 0.025) = cos(2.3)cos(0.025) - sin(2.3)sin(0.025)
Using a calculator, we can find that cos(0.025) ≈ 0.999687. Also, from the pr... |
null |
ChaGPT's own words:
"The cosine of 2.325 radians is approximately equal to -0.695206961.
You can use a calculator to find the value or use the cosine formula:
cos(2.325) = cos(2.3 + 0.025) = cos(2.3)cos(0.025) - sin(2.3)sin(0.025)
Using a calculator, we can find that cos(0.025) ≈ 0.999687. Also, from the pr... |
ChaGPT's own words:
"The cosine of 2.325 radians is approximately equal to -0.695206961.
You can use a calculator to find the value or use the cosine formula:
cos(2.325) = cos(2.3 + 0.025) = cos(2.3)cos(0.025) - sin(2.3)sin(0.025)
Using a calculator, we can find that cos(0.025) ≈ 0.999687. Also, from the pre... |
The title of the paper that introduced type classes is "How to make *ad-hoc* polymorphism less *ad hoc*".
It seems the type classes approach is being compared to how OOP does ad-hoc polymorphism.
As far as I can tell, the paper never explains *how* type classes are less ad hoc than OOP techniques like V-tables or... |
The title of the paper that introduced type classes is "How to make *ad-hoc* polymorphism less *ad hoc*".
It seems the type classes approach is being compared to how OOP does ad-hoc polymorphism.
As far as I can tell, the paper never explains *how* type classes are less ad hoc than OOP techniques like V-tables or... |
The paper is valuable but does not show how to make ad-hoc polymorphism less ad-hoc.
I'll review the terminology and then apply it
## Terminology
For the definition of "ad-hoc" polymorphism, the reader is pointed to [Strachey's Fundamental Concepts in Programming Languages of 1967](https://www.ics.uci.edu/~jaj... |
The paper is valuable but does not show how to make ad-hoc polymorphism less ad-hoc.
I'll review the terminology and then apply it
## Terminology
For the definition of "ad-hoc" polymorphism, the reader is pointed to [Strachey's Fundamental Concepts in Programming Languages of 1967](https://www.ics.uci.edu/~jaj... |
The paper is valuable but does not show how to make ad-hoc polymorphism less ad-hoc.
I'll review the terminology and then apply it
## Terminology
For the definition of "ad-hoc" polymorphism, the reader is pointed to [Strachey's Fundamental Concepts in Programming Languages of 1967](https://www.ics.uci.edu/~jaj... |
The paper is valuable but does not show how to make ad-hoc polymorphism less ad-hoc.
I'll review the terminology and then apply it
## Terminology
For the definition of "ad-hoc" polymorphism, the reader is pointed to [Strachey's Fundamental Concepts in Programming Languages of 1967](https://www.ics.uci.edu/~jaj... |
null |
No parameterised reduction for a problem indicates FPT or not? |
Placed exactly the code and the explanation of the book : [Introduction to Algorithms Third Edition][1]
> In order to move subtrees around within the binary search tree, we
> define a subroutine TRANSPLANT, which replaces one subtree as a child
> of its parent with another subtree. When TRANSPLANT replaces the
> ... |
Deletion of a node form a BST |
|algorithms|binary-search-trees| |
Let $n=m^2$.
$$
\sum_{j=1}^1 j + 2\sum_{j=1}^2j + 3\sum_{j=1}^3 j +...+ m \sum_{j=1}^{m} j
\\=1 + 2\cdot3 + 3\cdot6 +...+ m \frac{m(m+1)}2\\\sim\frac{m^4}8=\Theta(m^4)=\Theta(n^2)
$$
by Faulhaber.
----------
More precisely,
$$\frac{3m^4+10m^3+9m^2+2m}{24}=\frac{m(3m+1)(m+1)(m+2)}{24}.$$ |
|graphs|terminology|graph-traversal|dag| |
Placed exactly the code and the explanation of the book : [Introduction to Algorithms Third Edition][1]
> In order to move subtrees around within the binary search tree, we
> define a subroutine TRANSPLANT, which replaces one subtree as a child
> of its parent with another subtree. When TRANSPLANT replaces the
> ... |
null |
I have a homework assignment that requires me to create CFG for
> L(G) = {w | (∃i, j, k)w = a^i b^(i+j+k) c^j d^k with Σ = {a, b, c, d}
so that it can accept words like ab, aaabbbbd, abbbcd, but it should not accept abba, aabbbbbc, or abc since the number of b must be the number of a+c+d.
I need CFG of L(G)... |
Need to create CFG that requires sum of other letters |
|finite-automata|context-free|pushdown-automata| |
null |
Generally speaking, things like orders are not confirmed until some trace of them is recorded in the database.
Database disks are usually mirrored at the hardware level (with transactional guarantees of mirroring provided by the disk array controller), and the database may be completely replicated across machines or... |
I'm learning about strict functions in Haskell.\
A function f is strict if f ⊥ = ⊥ \
Some functions are strict only in the first argument (for e.g. const), others are strict in the second (for e.g. map).\
I'm trying to think of a function which is strict in only both arguments at the same time, so\
f x ⊥ is not bot... |
Strictness in both arguments but not in each individually |
|lambda-calculus|functional-programming|haskell| |
The paper is valuable but does not show how to make ad-hoc polymorphism less ad hoc.
I'll review the terminology and then apply it
## Terminology
For the definition of "ad-hoc" polymorphism, the reader is pointed to [Strachey's Fundamental Concepts in Programming Languages of 1967](https://www.ics.uci.edu/~jaj... |
That's a very good question! It turns out the answer is both yes and no.
A classic example of a function we'd like to write is [Plotkin's parallel or](https://homepages.inf.ed.ac.uk/gdp/publications/LCF.pdf). We know from basic boolean logic that both `or True _` and `or _ True` are always true, regardless of the va... |
Use the [nesting structure][1] of the language to obtain a context-free grammar.
$a^i\, b^{i+j+k}\, c^j d^k = a^i b^i\, b^k b^j c^j d^k $
[1]: https://cs.stackexchange.com/a/26159/4287 |
Recently, I’ve been interested in the console of the Source game engine, more specifically, its `alias` command, which allows one command to invoke others. It may allow recursion (i.e. running `alias freeze freeze` will cause inputting `freeze` to freeze the engine), but does not allow parameters (i.e. running "`alias ... |
null |
Placed exactly the code and the explanation of the book : [Introduction to Algorithms Third Edition][1]
> In order to move subtrees around within the binary search tree, we
> define a subroutine TRANSPLANT, which replaces one subtree as a child
> of its parent with another subtree. When TRANSPLANT replaces the
> ... |
I want to generate a set of X int numbers, were 4 <= X <= 100, both positive and negative that add up to target value.
The numbers are between -6 and 4 and there needs to be at least 2 negative numbers, and up to half of the numbers can be negative.
I have seen posts about this being done for all positive numbers b... |
Deletion of a node from a BST |
null |
For example, if X = 100 then obviously the smallest number is -300 (50 times -6 and 50 times 0) and the largest is 390 (2 times -1 and 98 times 4). An algorithm to pick the numbers for each target is quite trivial. |
Use the [nesting structure][1] of the language to obtain a context-free grammar.
$a^i\, b^{i+j+k}\, c^j d^k = a^i b^i\, b^k b^j c^j d^k $
We can see that the language is the concatenation of
strings of the form
$a^i\, b^i $
and strings of the form
$b^{j+k}\, c^j d^k$
which each separately form context-free... |
Consider the following nonrigorous argument that $P \neq NP$ implies $avgP \neq distNP$. (For those unfamiliar with the latter complexity classes, they deal with average case hardness.)
Suppose A is the algorithm that solves some NP complete problem (say 3-SAT) with the fastest average case complexity possible and s... |
Non rigorous argument that $P \ne NP$ implies $avgP \ne distNP$ |
|complexity-theory|np-complete| |
null |
There is no official standard, but I would argue that algorithm pseudocode conventionally follows much of the syntax of Dijkstra's [Guarded Command Language](https://en.wikipedia.org/wiki/Guarded_Command_Language), with influence from other structured programming syntaxes of the late seventies and early eighties, and o... |
null |
This can be done. Let's say that a list of numbers is a *solution* if it satisfies all of your conditions. Then, it is possible to sample uniformly at random from the set of solutions.
The core technique is that we'll construct an algorithm count the number of solutions. In fact, we'll define an ordering on all ... |
This can be done. Let's say that a list of numbers is a *solution* if it satisfies all of your conditions. Then, it is possible to sample uniformly at random from the set of solutions.
The core technique is that we'll construct an algorithm count the number of solutions. In fact, we'll define an ordering on all ... |
The type of pseudocode I’ve most commonly seen is loosely based on ALGOL, sometimes falling back to natural language or algebraic notation.
For example, compare this sample (from Wikipedia) of Algol-60:
```lang-none
BEGIN
INTEGER p, q;
y := 0; i := k := 1;
for p := 1 step 1 until n do
for q := ... |
I have a homework assignment that requires me to create CFG for
> L(G) = {w | (∃i, j, k)w = a^i b^(i+j+k) c^j d^k with Σ = {a, b, c, d}
so that it can accept words like ab, aaabbbbd, abbbcd, but it should not accept abba, aabbbbbc, or abc since the number of b must be the number of a+c+d.
I need CFG of L(G)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.