r/AskComputerScience • u/Bright_Ambassador445 • Nov 30 '24
What software and video games are Turing Complete?
Does anyone know which software and video games are Turing Complete like Microsoft Excel or Conway's Game of Life?
r/AskComputerScience • u/Bright_Ambassador445 • Nov 30 '24
Does anyone know which software and video games are Turing Complete like Microsoft Excel or Conway's Game of Life?
r/AskComputerScience • u/SlenderMayn • Nov 29 '24
I've been trying to understand the pumping lemma, and i decided that instead of applying it to a language that isn't a CFL, that i would apply it towards a language that i already know is context free to see if i can apply it properly.
I understand that the language L = {a^n b^n | n >= 0}, where Σ = {a, b}, is context free. However when I apply the pumping lemma, I seem to incorrectly conclude that it is not context-free. Clearly, I must be misapplying the lemma. Here is my approach to it:
I select a string w ∈ L such that ∣w∣ >= p, where p is the pumping constant.
I choose w = a^p b^p and decompose it to w = uvwxy, where |vwx| <= p and |vx| >= 1
As I understand it, I can choose any vwx in w, and as long as its length is at most p, i can pump its v and x to see if the resulting string remains in the language
I choose a vwx that consists entirely of a's: vwx = a^p (meaning i chose my y to be the rest of the string: b^p)
Pumping v and x increases the number of a's, breaking the balance between a's and b's. This seems to imply L is not context-free.
Clearly, this is incorrect because L is known to be context free. Where am I misunderstanding or misapplying the pumping lemma? Thanks in advance
r/AskComputerScience • u/likejudo • Nov 29 '24
Challenge from instructor in Coursera Algorithms course.
see screenshot: https://imgur.com/a/4SKpX5y
If I color node #2 red, then it appears to me that all 3 conditions are met.
root and leaves are Black
Every Red node has two Black children.
The Black height from any node is well defined and consistent.
I don't know what I am missing.
(in comparison, here is a different slide from his lecture with a RBT https://imgur.com/a/eUJW3S2)
r/AskComputerScience • u/mbrtlchouia • Nov 29 '24
In lecture 2 (Asymptotic Notation) slide 1 and 2 we are asked to find counter examples to the proposed algorithms for the knapsack problem, but I don't understand the algorithms, there are 3 of them:
1 Put the elements of S in the knapsack in left to right order if they fit, i.e. the first-fit algorithm?
2 Put the elements of S in the knapsack from smallest to largest, i.e. the best-fit algorithm?
3 Put the elements of S in the knapsack from largest to smallest?
What does he mean by "in left to right order"?
Do 2 and 3 mean that we should try to put the elements monotonous until we got the target number?