Problem Detail: I’m trying to find a solution for this exercise: Give the pseudocode of an algorithm which takes two positive integers n and k and prints all the non-decreasing sequences of length k (1,2,…,n). For example n=4, k=3: 111 112 Read More …
Blog
[Solved]: “OOD allows ADTs to be created and used.”
Problem Detail: I just had a CS mid-term and one of the questions was: OOD allows ADTs to be created and used. True False I answered false, but my answer was marked as incorrect. I suspect what the question means is Read More …
[Solved]: computer science in the movies as an educational angle
Problem Detail: recently there have been a few questions on teaching CS in both cs.se & tcs.se and there are many high-rated related questions on the two sites on the topic. thinking over the latest one made me realize that a Read More …
[Solved]: Generative Machine Learning algorithms on tree structure
Problem Detail: I’m looking into PCFG sentence grammar dependency structure parsing using StanfordNLP PCFG parser. It generates tree structures represented as a string like this: Happy new year => (ROOT (VP (VBN Happy) (NP (JJ new) (NN year)))) Or in a Read More …
[Solved]: Are functions in O(n) that are nor in o(n) all in Θ(n)?
Problem Detail: One of my lectures makes the following statement: $$( f(n)=O(n) land f(n)neq o(n) )implies f(n)=Theta(n)$$ Maybe I’m missing something in the definitions, but for example bubble sort is $O(n^2)$ and not $o(n^2)$ but it’s also not $theta(n^2)$ since it’s Read More …
[Solved]: JIT, AOT, Interpretation: What are differences between them?
Problem Detail: I’m a beginner in Compilation. My understanding is that Interpretation means Interpreter takes source program as input and produce the result of this program.(source -> Interpreter -> run on the machine) Compilation means Compiler take source program as input Read More …
[Solved]: Algorithm: Cracking the Safe
Problem Detail: A safe is protected by a four-digit $(0-9)$ combination. The safe only considers the last four digits entered when deciding whether an input matches the passcode. For instance, if I enter the stream $012345$, I am trying each of Read More …
[Solved]: How does a regular language satisfies the second condition of the pumping lemma
Problem Detail: I’m a little bit confused about the second condition of the pumping lemma which are: $|y|geq1$ $|xy|leq p$ $forall i geq 0:xyizin L$ I don’t understand why the length of substrings $xy$ has to be less than the pumping Read More …
[Solved]: Why does this graph show the tightness of MST heuristic’s 2-approximation bound?
Problem Detail: This is a homework problem I’ve been given and I’ve been raking my brain for hours (so I’m satisfied with some pointers). I know already that the approximation ratio cannot be worse than $2$. I have a wheel graph, Read More …
[Solved]: On the minimum order of a maximal independent set in cycle graphs and path graphs
Problem Detail: I can see from this question that a $K_{r + 1}$-free graph with $n$ vertices and $e$ edges contains an independent set of order at least $$frac{n}{2e/n + 1} tag{1} $$ Since for a $C_{n}$/$P_{n}$ we know how many Read More …