629 questions
Advice
0
votes
3
replies
150
views
Turing Machine for {a^i b^j | j is divisible by i, i ≥ 2, j ≥ 2}
I designed Turing machine that accepts the input over the language:
{a^i b^j | j is divisible by i, i ≥ 2, j ≥ 2}
This Turing machine should accept and reject the stings as following:
aabbbb | ...
2
votes
0
answers
94
views
How to apply regular expressions to practical non-text state machine logic? [closed]
I'm trying to implement some logic within a system of microcontroller IRQs and event callbacks, that fundamentally require the use of a complex state machine in order to behave correctly.
Regular ...
1
vote
1
answer
1k
views
Turing Machine - Finding k-th element and move it to the front of the tape
I am trying to solve the following Turing machine challenge:
The number choice function
The number choice function is defined as follows.
INPUT: a sequence 𝑘, 𝑥1, 𝑥2,..., 𝑥𝑛 where
𝑘 is a ...
1
vote
1
answer
87
views
NPM Version Range Grammar not regular?
When specifying required versions of a dependency in npm, we can specify ranges of versions. For example:
1.2.7 || >=1.2.9 <2.0.0
Specification:
https://github.com/npm/node-semver?tab=readme-ov-...
0
votes
1
answer
131
views
Calculating Ranking on a large set of data(4000+) that changes depending on the date range selected and orderby
I have a large set of data, 4000 rows+. each row is associated with metric data that is collected daily. Metric table is at over 1.1 million rows.
for example:
Item table:
Id
Item
1
Hello
2
World
...
....
1
vote
1
answer
248
views
a challenging finite automata - what is the language?
I have this finite automata (FA) and want to write its language. I think its
L={x E {0,1} | {x with subset of 00 and ends in 1} and it would help to know what the type of FA it is.
I think it's a DFA ...
0
votes
0
answers
34
views
Optimization - Algorithm for finding load set combination that returns the maximum Von Mises stress
I recently stumbled upon an optimization problem while working on structural analysis. While I'm confident in my MATLAB skills as an aerospace engineer, I must admit my theoretical knowledge in ...
0
votes
1
answer
245
views
Unable to create an DPDA that accepts strings in binary notation multiples of 3
Just learned about DPDA's on my Theory of computation class. Professor gave us a semester task to create a deterministic pushdown automaton state diagram that is able to accept all strings multiples ...
1
vote
1
answer
98
views
how to find the grammar of this Language?
How to find the grammar of this language: La = {ww^r: w e {0,1}^*, w ends with 1} ?
r: is reverse
Here is my solution:
S -> 0S0|1S1| 0|1|E(epsilon)
What can I change here or is the solution the ...
0
votes
1
answer
179
views
Complexity/decidability of the "nested maze" problem?
In this Puzzling SE post, there's a maze with infinitely nested inside itself. Inspired by this, consider the following graph problem:
Setup:
A graph G with vertices V and undirected edges E
And ...
0
votes
2
answers
578
views
Maximum sum, min length subset
I am trying to solve this popular problem:
"Given an integer array, divide the array into two subsets, A and B, while respecting the following conditions.
the intersection of A and B is null.
...
2
votes
1
answer
5k
views
DFA for all binary strings having even number of 0's or contains exactly two 1's
I'm trying to solve this challenge:
Design a DFA for all binary strings having an even number of 0's or containing exactly two 1's
I'm a bit confused with this question. I had tried to come up with ...
0
votes
1
answer
622
views
Need a DFA for the alphabets {a,b} such that the language must contain equal and even numbers of a and b
The DFA for even numbers of and b is this DFA for even numbers of a and b but the DFA of even and equal number of a and b is not available
L={\epsilon,aabb,abab,baba,bbaa,aaaabbbb,aabbaabb,bbaabbaa,...
0
votes
0
answers
92
views
What is a functional model, sequential model, and concurrent model?
I’m doing research on the models of computation and how they work and what they are. I would like someone To help me understand what these are and help me find books or anything to research them.
I’...
-2
votes
1
answer
41
views
What is the flaw in the proof of the countability of the set of finite language?
Let FT be the class of all finite languages over {0,1}.
Suppose FL is countable, so we can enumerate all members of FL as
FL = {L_0, L_1, L_2, ...}
Meanwhile, we also enumerate all strings over the ...
-2
votes
1
answer
75
views
Does this DFA satisfy the complement of the given language?
I got this challenge:
Given 𝐿 = { 𝑤 ∊ {0, 1}* : 01 is a substring of 𝑤 }
Show 𝐿 compliment is regular.
My understanding is that a DFA for the compliment of this language would need to reject 01 ...
0
votes
1
answer
1k
views
Conversion of NFA having a missing transition for any input character on initial state to DFA
I was practicing NFA (Non-Deterministic-Finite-Automata) designing and converting them to DFA.
Then suddenly I got a doubt, as all the examples I have seen for conversion had NFA's initial state with ...
0
votes
1
answer
139
views
Is there a mathematical proof of the effectiveness of the target network trailing in Deep Q learning?
It seems to be common practice in Deep Q-learning to have the target network trailing the main network, and syncing them every 100 or so steps, but I am not clear as to why that is.
The best ...
0
votes
1
answer
233
views
how to prove that regular language is closed under concatenation using DFA?
We've learned how to use NFA to prove that closure property, but how could we do that without any help of using the conception of NFA? How to construct a DFA that could solve this problem?
(so ...
3
votes
1
answer
192
views
Searching Algorithm: Product Knapsack Problem with goal to find lowest product above a certain threshold?
I'm looking for people with some algorithmic knowledge who can help me out with this.
I'm currently programming a constrained tree search in java, where I want to have a certain amount of leaf nodes ...
0
votes
0
answers
33
views
Computational costs of typechanges/reassignments in python
In the past, I defined most often new names for new variables in python. Nevertheless, reusing names may sometimes come with cleaner code like in this example.
With new names:
this_path = "/home/...
0
votes
0
answers
31
views
Ned help drawing a dfa from this hypothesis?
This DFA accepts any string over the alphabet {a, b} where the number of 'b's, if present, is even. An example of strings it accept:
Accepted:
a
aa
bb
aaa
abb
bab
bba
aaa
abb
bab
bba
aaaa
aaab
aabab
...
-1
votes
1
answer
194
views
How do we show that the following language is undecidable
How do we show that the following language is undecidable.
(https://i.sstatic.net/In68J.png)
I am not really sure where to start for the proof. Probably using one of ATM, HALTTM, or ETM to help ...
0
votes
1
answer
134
views
Theory of Computation: How to determine what language a DFA accepts
dfa
So I have an assignment to find out which language this dfa accepts.
I found many different words that the DFA accepts for example:
w1=0
w2=101
w3=1111
w4=100011
w5=11001
So my problem is that I ...
0
votes
2
answers
144
views
Compare the computation speed of (a+b)*c and a*c+b*c
I've just learned that additive operation is faster than multiplicative operation in C. Therefore, I'm curious whether (a+b)*c would be calculated faster than a*c+b*c ?
0
votes
1
answer
303
views
Prove that the following problem is undecidable by a reduction from the halting problem:
Prove that the following problem is undecidable by a reduction from the halting problem:
“Does a given Turing Machine M accept any string of form a^2k for k ≥ 1?”
I'm having trouble understanding the ...
0
votes
0
answers
47
views
Why did I get that the relation between distance covered and number of steps for random motion is quadratic although it should be linear?
I was working on a problem, where I was proving that for someone taking random-sized steps in 2-D, the relation between the total distance covered and the square root of the number of steps is linear. ...
-2
votes
1
answer
41
views
Is it possible to write a program with thousand or fewer characters that can generate every possible 128-kilobyte file
I found this question in a German math textbook [Konkrete Mathematik (nicht nur)
für Informatiker].
I know that this is not possible but I can not come up with a convincing argument. I think there are ...
1
vote
1
answer
230
views
Counting the frequency of target element in an unsorted array using divide and conquer
Suppose I have an unsorted array A of n integers and an integer b. I want to write an algorithm to compute the frequency of b in A (i.e., count the number of times b appears in A) using divide and ...
0
votes
0
answers
104
views
Can you left factor this grammar, whose production bodies have no common prefixes?
The grammar is as follows:
R -> R + T | T
T -> T F | F
F -> F * | P
P -> a | b
Terminals: {+, *, a, b}
Non-terminals: {R, T, F, P}
My understanding is that as there are no common prefixes ...
-2
votes
1
answer
607
views
What is the industry standard for number of clusters for a development team in Databricks?
I am a part of a team of 5 developers that work with gathering data, transforming, analyzing and predicting data in Azure Databricks (basically a combination of Data Science and Data Engineering).
Up ...
2
votes
1
answer
462
views
Using string of set length with pumping lemma to prove irregularity
There is this proof that I thought of that I am not quite sure if it's valid or not.
Suppose you had to prove the nonregularity of the following language:
A = { 0^n 1^n 2^n | n>= 0 }
The proof I ...
2
votes
1
answer
685
views
Closure property of regular languages under concatenation and star operation
In our course of Theory of Computation, we have done the proof for closure of
regular languages(L1, L2) under intersection, union and complement. But their closure under concatenation(L1L2) and star(...
1
vote
1
answer
563
views
How to generate an Unrestricted grammar if a language defination is given
How to construct unrestricted grammar that generates L = {a^ib^j c^k^d^l : i not equal to k AND j not equal to l}.
a is to the power of i, 'b' raised to the power of j, 'c' raised to the power of k, '...
-1
votes
1
answer
611
views
Let L be a language over {a,b} that contains the same number of occurrences of a and b. Which of the following language is regular?
(https://i.sstatic.net/lU278.png)
Why option C is also not correct?
1
vote
1
answer
736
views
Why do we define equivalent turing machines as two turing machines with the same accepted languages?
From many textbooks about computability, I see how we define equivalent turing machines as follows:
Two turing machines TM1 and TM2 are equivalent <=> L(TM1) = (TM2)
where L(TM1) is the ...
2
votes
0
answers
231
views
Confusion on the Syntax of a Python Module named automata.pda.npda within automata -lib
I have been asked to construct a NPDA that accepts the following language L = {anb2n : n ≥ 1}. I have completed the written assignment portion and after testing it thoroughly i am sure that my NPDA is ...
0
votes
1
answer
3k
views
Pushdown Automata for the Language {wwR | w∈{0,1}*}
I am currently enrolled in the undergraduate version of Theory of Computation at my university and we are discussing Pushdown Automata, Turing Machines, and the Church-Turing Thesis.
In our homework ...
2
votes
2
answers
263
views
C++ code example that makes the compile loop forever
Given that the C++ template system is not context-free and it's also Turing-Complete, can anyone provide me a non-trivial example of a program that makes the g++ compiler loop forever?
For more ...
-1
votes
1
answer
338
views
How to output only the symbols that occur at odd positions, removing the other symbols at even positions [duplicate]
I am looking for an algorithm that would removing the symbols that occur at odd positions, so keeping only the ones at even positions, and join the kept symbols into one, uninterrupted output sequence....
2
votes
2
answers
919
views
Constructing a Turing Machine that deletes every second input symbol and then merges remaining string into a string with no blank gaps
Example input: 010101, output: 000
Example input: 10011, output: 101
Example input: 11101101, output: 1110
While drawing a state diagram for this problem, I am confused by how to merge the input ...
0
votes
1
answer
4k
views
Construct the CNF for the following grammar and explain the steps. S→aAa | bBb |€, A→C|a, B→C|b, C→CDE | €, D→A|B|ab
S→aAa | bBb |€,
A→C|a ,
B→C|b ,
C→CDE | € ,
D→A|B|ab
In this i think E,C,D are useless but if we remove those, then there is no point in this question, so I'm stuck about what are useful and what are ...
1
vote
0
answers
111
views
Environments vs Frames in The Environment Model of Evaluation (SICP)
I found this section (3.2) of SICP pretty vague on the exact difference between an environment and a frame. Sometimes it seemed to use them interchangeably, and sometimes it labelled them as distinct ...
0
votes
2
answers
5k
views
NFA for the star of a language (01 U 001 U 010)*
Problem from page 5 of this pdf.
Give an NFA that recognizing the language (01 U 001 U 010)*
I think this is wrong because there should be an additional start state (accepting) going to state 1 for ...
0
votes
1
answer
109
views
Inversion Counting Algorithm implementation in Python,cannot unpack non-iterable int object
This is my implementation of the inversion counting algorithm using a divide and conquer approach, the problem i am having is it keeps saying there is a type error, cannot unpack non-iterable int ...
2
votes
2
answers
305
views
Is there a mathematically optimal way to parallelize a given algorithm?
Let us say we have an algorithm with multiple steps and each of those steps can be parallelized. Given a certain number of CPU cores, is there a mathematically optimal way to split things up on the ...
0
votes
0
answers
45
views
Specification of DFA accepting 𝐿≡∪𝑛∈N𝐿𝑛
Why it is impossible to specify a single DFA that accepts 𝐿≡∪𝑛∈N𝐿𝑛, although an individual machine can be constructed for each 𝑛?
1
vote
1
answer
262
views
Writing lambda calculus higher order recursion scheme in Haskell
[I'm on new grounds here, there might be some ambiguities]
Consider the recursor (which is a generalization of primitive recursion over higher types)
R_\sigma A B 0 = A
R_\sigma A B (S(C)) = B(R_\...
0
votes
2
answers
542
views
What is Undecidability and its practical application?
I have a vague understanding of undecidability. I get it that undecidability is that for a problem there exists no algorithm or the Turing machine will never halt. But I cant just visualize it. Can ...
-2
votes
2
answers
6k
views
Can we make pda for a^n b^n+1?
I am little confused about either can we make pda for a^n b^n+1 language ? As to my knowledge pda can be made only for CFL. Does a^n b^n+1 is cfl or not? Plz help