instruction stringlengths 35 29.1k |
|---|
I have a $n\times n$ matrix called $M$, and two integers $k_\min$ and $k_\max$.
Each row and each column of M is sorted in the increasing order.
I would like to know if there is way I can count the number of its elements which are inside $[k_\min, k_\max]$, using a $O(n)$ algorithm.
|
Given $x\in\Bbb N$, I would like to find $x\bmod N$, where $N$ is composite. For example $N=35$, $x=53$ and $x\bmod N=18$. Is this operation considered monotone in circuit/algebraic complexity language? I also want to have consider $x_1+x_2\bmod N = x_1\bmod N+x_2\bmod N$ and $x_1x_2\bmod N = (x_1\bmod N)(x_2\bmod N)$.... |
I have a finite automaton with these properties:
Contains cycles
It's a directed graph
All the states/nodes are initialy reachable from the initial state
It has final states but I guess it isn't relevant for my issue
It's a random generated automaton, and the generation isn't meant to satisfy properties like strongly ... |
Let $G = (V, E)$ be a connected graph and let $M\subseteq V$. We say that a vertex $v$ is marked if $v\in M$. The problem is to find a simple path in $G$ that visits the maximum possible number of marked vertices. The associated decision problem is: is there a simple path that visits every $v\in M$?
The problem is o... |
If we have $n$ elements $s_1, \dots, s_n$ and build a kind of treap (tree-heap) out of it. Each $s_k$ has a priority, which is an integer in $\{ 1, 2, 3 \dots, \lceil \log n \rceil\}$. Since the priorities will have duplicates, I just want the treap the verify that for each node $s_k$, all the nodes in its right and le... |
Some complicated algorithms (union-find) have the nearly-constant inverse Ackermann function that appears in the asymptotic time complexity, and are worst-case time optimal if the nearly constant inverse Ackermann term is ignored.
Are there any examples of known algorithms with running times that involve functions tha... |
What does it mean to multiply or divide polynomials?
I have used them so many times, in error correcting codes, cryptography, etc. but it was never clear to me what would be a graphical representation/ interpretation.
I have always pondered what did it mean when someone multiplies a line with a curve to get another hyp... |
Suppose I have a DFA recognizing a regular language $L$, how do I prove that
$$\text{lefthalf}(L)= \{ w_1 \mid \exists w_2 \in \Sigma^* ,w_1w_2 \in L \land \|w_1\| = \|w_2\| \}$$ is also a regular language?
|
Is there some natural or notable way to relate or link math groups and CS formal languages or some other core CS concept e.g. Turing machines?
I am looking for references/applications. However note that I am aware of the link between semigroups and CS languages (namely via finite automata). (Does this literature on s... |
Say, I have some permutation or combination formula like this,
$$\frac{n!}{(n-r)!r!},$$
and I want to $\bmod$ the result with some big prime ($10^9+7$ for example).
I already tried with modular operation and multiplicative inverse but failed (I don't quite understand them). Can someone give me some example in code so ... |
I am trying to calculate the runtime complexity of a function that does not have fixed size input, but uses several helper methods that do have fixed size input. I was unsure of how to include the helper methods in my calculations.
If I have an array with a fixed size of 32 indices, and I have a function that sums up ... |
Given a directed graph $G = (V,A)$, a feedback arc set is a set of arcs whose removal leaves an acyclic graph. The problem is to find the minimum cardinality such set.
I want to find out about is there some approximation algorithm around this problem.
|
If the running time of an algorithm scales linearly with the size of its input, we say it has $O(N)$ complexity, where we understand N to represent input size.
If the running time does not vary with input size, we say it's $O(1)$, which is essentially saying it varies proportionally to 1; i.e., doesn't vary at all (bec... |
Consider the following sequence $a_n$:
\begin{align*}
a_0 &= \alpha \\
a_k &= \beta a_{k-1} + \kappa
\end{align*}
Now consider the implementation of this sequence via lisp:
(defun an (k)
(if (= k 0) alpha
(+ (* beta (an (- k 1))) kappa)))
What is the running time to compute (an k) just as it is written? Also... |
I have an index taking as keys values from the power set $P(S)$ of a set $S$, except for $\emptyset$ and $S$.
Then I have a query $Q=(s, k)$, where $s \in P(S) - \{\emptyset \cup S\}$ and $ 1 < k \le |S|$.
The result of the query is the set of covers $R$ of $S$; $\forall r \in R, |r| \le k$.
So for instance, if $S = \... |
I have a Set $S$ of objects, a set $U$ of users and a map $c: U \rightarrow S^{\prime}$, where
$S^{\prime} \subset S$ and $\emptyset \notin S^{\prime}$.
Every time I add a new entry to $c$, i.e. adding a new user $u$ with her associated subset of $S^{\prime}$, I need to get the list of other users with whom she covers ... |
What are the common ways to check if a given language is regular, context free, or context sensitive?
Any surveys or notes would also be helpful. There's no need to describe your suggestions.
eg. it is sufficient to say a language is regular if it can be recognized by a DFA.
|
In a three dimensional Cartesian space, given a ray in its parametric form:
$r(t) = [1, 1, 1] + t[-1, -1, -1]$ find the intersection points between the ray and the following primitives.
a) A sphere centered at the origin with a radius of $1$, and
b) a triangle with vertices $\{[1,0,0]^T , [0,1,0]^T , [0,0,1]^T \}$.
R... |
In the A* search algorithm, we use a priority queue with heuristic function to find optimum result with minimum cost. But, how do we get the path after reaching goal?
|
What are some applications that require computing the permanent of a matrix?
One application I know of is related to graph theory and matchings. Apparently, the number of perfect matchings of a bipartite graph is the permanent of its incidence matrix.
I am curious to know more applications of matrix permanent.
|
Suppose I type in the website www.youtube.com. The computer first asks a local domain name server (DNS) what the IP address of this website is. If it can't find it, it then asks the root server, etc. This is recursive querying.
How does DNS work if there is no recursive querying? Is the root server the only one that ... |
It is well known now that Grover's quantum algorithm can SORT a database of $N$ entries in $O(\sqrt{N})$ time. How can an algorithm work without reading through the list of entries which needs $O(N)$ operation. How does Grover's algorithm avoid reading the list? Is there a special representation that can be used classi... |
Data Structures is the second CS course taught at Columbia University and it lists Discrete Mathematics as a Co-Req.
I have a BSEE and have not taken any discrete mathematics and am having a hard time understanding why I need to take this to do things like create data structures?
Is this just so the university can cram... |
I am trying to learn about applying the pumping lemma and I'm not really sure how to go about proving this language isn't regular with the pumping lemma:
$L= \{0^n 1^m \space | \space m \equiv 0 \space mod \space n, \space n \geq 2 \}$
Now I realize that the condition $m \equiv 0 \space mod \space n$, is essentially sa... |
I know how to code for factorials using both iterative and recursive (e.g. n * factorial(n-1) for e.g.). I read in a textbook (without been given any further explanations) that there is an even more efficient way of coding for factorials by dividing them in half recursively.
I understand why that may be the case. Howe... |
I've converted an NFA to a DFA. But even after checking over it a few times, it still doesn't feel right. I'm sure this is trivial, but I'd like someone to give me an idea where I went totally wrong on this.
NFA:
DFA:
|
This is the question I am asked and I am currently proving it using proof by contradiction something like this:
Let's take some language L which is non regular.
Let's assume compliment of L i.e. $(L^c)$ is regular.
Since we know that regular languages are closed under complementation, complementation of $(L^c)$, i.e. ... |
By Information-Theoretic definitions, the One Time Pad (OTP) is called/was proved to be a Perfectly Secure Cipher. For the sake of completeness, we define
OTP: An enc/dec function, $f:\mathcal{P} \times \mathcal{K} \rightarrow \mathcal{C}$
Perfect Security: Given $m, m^* \in \mathcal{M}$,
$$P\big(m=m^* \mid E_\mathcal... |
Consider the following pseudo code for mapreduce to find the frequency of words in a collection of documents:
map(String key, String value)
// key: document name
// value: document contents
for each word w in value
EmitIntermediate(w, "1")
reduce(String key, Iterator values):
// key: word
// values: a list of coun... |
As the question states, how do we prove that $\textbf{NTIME}(f(n)) \subseteq \textbf{DSPACE}(f(n))$?
Can anyone point me to a proof or outline it here? Thanks!
|
I'm willing to take a course in formal languages and automata theory , where we will explore side by side a functional programming language to implement the different algorithms we will encounter ,despite i am new to the language , i am assuming i've learned what's nessecary to move to the theoretical part , so i'm won... |
Problem taken from here (page 3): http://cse.unl.edu/~choueiry/S06-235/files/MasterTheorem-Handout.pdf
$T(n) = 3T(\frac{n}{2}) + \frac{3}{4}n + 1$
$f(n) = \frac{3}{4}n + 1$
It says we cannot use the traditional Master Theorem because $f(n)$ is not a polynomial. How is $\frac{3}{4}n + 1$ not a polynomial? It's a polynom... |
I read that most scientists don't believe that P=NP. It might be subjective but can you simplify why not? I'm not informed enough to have an opinion but I'd like to know the definitions and some "pretty simple" explanation why to believe one or the other case, for instance why even believe that it can be proved?
|
Several popular machine learning algorithms such as Logistic regression or Neural networks require its inputs to be numeric.
What I'm interested in is how you make these algorithms work on non-numeric inputs (such as short strings).
As an example, let's say we're building an email classification system (spam/not spam),... |
I just started learning about formal lang and automata theory, and recently learned about regex, so I don't know any complicated symbols, so please stick with basic symbols.
The question is: Write a regex for the following language over {0,1} that is a set of all odd length strings that contain exactly two 0's.
I've go... |
Below are two questions I found in Theory of Computation book but couldn't find its correct answers, can anyone please give correct answers with explanation?
It is undecidable, whether
an arbitrary Turing machine(TM) has 15 states
an arbitrary TM halts after 10 steps
an arbitrary TM ever prints a specific letter
an a... |
If a language is decidable, we can write a method that always halts and returns true for each string that is an element of the language and false otherwise.
If a language is undecidable, what does that mean? Does it mean:
a.) We cannot write a method; we cannot even conceive of a method.
b.) We can write a method that ... |
I am looking for a library which provides a "serializer" ADT for synchronization.
(http://courses.cs.vt.edu/~cs5204/fall99/Summaries/Concurrency/serializers2.html)
Googling leads me to nowhere, unlike monitors,semaphores and other constructs, serializers are hardly discussed over the web in depth.
Any other pointers a... |
A type-0 grammar generates a recursively enumerable (RE) language.
A RE language is also known as a semi-decidable language.
A semi-decidable language is a particular kind of undecidable language: If a language is semi-decidable, we can write a method that returns true for each string that is an element of the langua... |
I am looking for visual tools for the design, and optionally verifications, of concurrent systems.
PS:
There is no tag for visual-programming, I must have 150 reputation to create one, so please create one if you can.
|
I know how to use the FFT for multiplying two equations in $O(n\,log\,n)$ time, but is there a way to use FFT to compute the expanded equation before simplifying?
For example, if you are multiplying $A(x) = 1 + 2x + 6x^2$ and $B(x) = 4 + 5x + 3x^2$ such that you get $C(x) = A(x) \cdot B(x) = 4 + 5x + 3x^2 + 8x + 10x^2 ... |
Given any Context-Free-Grammar, $G$, and another in Chomsky Normal Form, $G_c$, how can we check if both $G$ and $G_c$ generate the same language?
One of the trivial ways I know of is to convert $G$ into a CNF form. which motivates my second question,
Can two different Context-Free-Grammars in CNF, $G_c$ and $G_c^\p... |
I feel the notion "there are countably many Turing machines" is wrong.
Suppose there is a Turing machine whose input alphabet is {0}. If we replace the input alphabet {0} with {a} and replace every occurrence of "0" with "a" in the transition table, then we get another Turing machine. Obviously, these two machines are ... |
Could somebody explain to me why the height of a weight balanced binary tree in $O(\log n)$ in the worst case?
|
Show that L = $\{0^{2^n}| n\geq 0\}$ is not a context free language.
Let string $s = 0^{2^p}$. Then we know we can write $s$ as $s = uvxyz$. I know that |vy| > 0 and $|vxy| \leq p$.
So how do I show that $uv^2xy^2z$ is not in $L$.
|
C++11 has a convenient Bernoulli RNG, illustrated at
http://en.cppreference.com/w/cpp/numeric/random/bernoulli_distribution .
However, distilling an entire random integer into a single random bit seems inefficient when the expectation parameter $p$ is rational with a small or power-of-two denominator.
Is there a reaso... |
(1) $L_1 = \{a^ib^{i+j}c^j|i,j\geq 0\} $
(2) $L_2 = \{xy | x,y \in \{0,1\}^*, x \neq y, |x| = |y| \}$
I doubt that $L_1$ is CFL. I've been trying to go with the string $s$ = $a^pb^{2p}c^p$. Thus, we can write $s$ as $uvxyz$. Now I'm trying to show $uv^2xy^2z$ is not in $L_1$.
I really have no idea how to approach (2).... |
I've read that MAJSAT is PP-complete. Under what type of reduction is this true? What kind of reductions are usually used in order to prove PP-completeness?
|
Suppose I have a program p that has time complexity $O(n)$ and a second program q that calls program p $m$ times. If we know the input size of p will be the same every one of those times (n), we can say that the complexity of q is $O(m \times n)$. This case sounds pretty simple to me.
However, suppose the input size of... |
Prove that for any finite set $X$, $|P(X)| = 2^{|X|}$. The solution should use induction.
|
An NFA $M$ contains a cycle if there is a state $q$ and a string $x$ such that if $M$ is in state $q$ and reads string $x$, $M$ can return to state $q$. Prove:
If $M$ recognizes an infinite language, then $M$ has a cycle.
|
Forgive me if I am new, I am trying to learn how to solve recurrences.
I have the following recurrence:
$$T(n) = 2 T(\lfloor\frac{n}{3}\rfloor) + \frac{1}{2} T(\lfloor\frac{2n}{3}\rfloor) + n^2 \text{ if } n>0$$
Now from my understanding is that I am not able to use the following methods.
Master Thereom (because it's ... |
Consider a bipartite graph with vertex set partitioned into $X=\{u_1,u_2,u_3\}$ and $Y=\{v_1,v_2,v_3\}$. Consider the graph has the following edges: $\{u_1,v_1\}$, $\{u_2,v_2\}$, $\{u_2,v_3\}$, $\{u_3,v_2\}$ and $\{u_3,v_3\}$. The perfect matchings are $\{\{u_1,v_1\}$, $\{u_2,v_2\}$, $\{u_3,v_3\}\}$ and $\{\{u_1,v_1\}$... |
In my descriptive complexity class, we've been asked to find a formula that characterises the language $(aa)^*$ (over the alphabet $\{a\}$) with a first order formula over the language $\{<, P_a\}$.
This was the first class, so I will recall what we've learned to be sure that I understood. To a $L$-formula $\phi$ we as... |
We have a DAG. We have a function on the nodes $F\colon V\to \mathbb N$ (loosely speaking, we number the nodes). We would like to create a new directed graph with these rules:
Only nodes with the same number can be contracted into the same new node. $F(x) \neq F(y) \Rightarrow x' \neq y'$. (However, $x' \neq y'\nRigh... |
The theorem of structured programming says that any algorithm can be expressed by those three control structures:
Sequence
Selection
Iteration
Isn't it possible to rewrite any loop using a finite sequence of statements and choice between statements? Isn't this what compilers do? Can't we thus omit the third structure... |
I'm working on a NFA to DFA conversion tool that is different from the Subset Construction and I need to test this tool.
In order to be sure that the immplementation has no bug I'd like to generate a random NFA with these properties:
The NFA should be connected
The NFA should have one initial state and one or more fin... |
Let L be language of balanced parentheses.
(a) Prove If there are equal number of ('s and )'s and every prefix of w contains at least as many ('s as )'s, then w is in L.
(b) Prove If w is in L, then there are equal number of ('s and )'s and every prefix of w contains at least as many ('s as )'s.
After much thought, I d... |
$L = \{0^i1^j0^i1^j|i,j \geq 0\}$
I've tried letting $s = 0^p1^p0^p1^p$. But not sure where to go from here. Help would be appreciated.
|
I'm presented with two snippets of code, and I need to determine their time complexity. I'm pretty convinced that both of these are $O(n^2)$, but I'm not 100% sure
1.)
2.)
|
I'm having trouble with this question about regular expressions:
Let $L_1$ be the language of passwords containing at least one
lowercase letter, at least one uppercase letter, and at least one
number. Write down a regular expression that describes $L_1$.
This is my answer, but I'm not too sure about it. I let $\... |
I have a question related to the hardware protection needed to implement an operating system kernel:
Identify at least three hardware level mechanisms that are necessary to protect an operating system kernel from malicious or erroneous user programs.
I can't work out what that would be from the Wikipedia article.
|
I'm doing some research on game semantics using these notes. Currently I'm trying to prove that the definition of composite-strategy is indeed a strategy.
I have already proved all the conditions of strategies except that it is prefix-closed(for even-length prefixes) and respects the alternation rule.
Can somebody giv... |
I am trying to understand what is meant by "deterministic" in expressions such as "deterministic context-free grammar". (There are more deterministic "things" in this field). I would appreciate an example more then the most elaborate explanation! If possible.
My primary source of confusion is from not being able to tel... |
Im studying for the computer science subject GRE test, as an exercise i need to implement the followin algorithm in java, any idea on how to aproach it?.
Given a set $X$ and $z$ not in $X$, indicate between which would be the immediate positions $z$ in $X$
|
I am trying to store an existing 2D triangulation (of which I have all of the vertices and edges) in a DCEL data structure.
Using the algorithm described in this answer, I was able to store a part of the triangulation, but not the "half-edge" representative for each triangle.
The algorithm is reported below
Algorith... |
Well, forgive my ignorance about the matter as I have been playing with ASP for the last couple of days.
Consider this simple example
p.
s :- p.
And the corresponding output generated after running the program in clingo:
$ ./clingo.exe ex.lp --number=0
Answer: 1
p s
SATISFIABLE
Models : 1
...
Where possible mo... |
The TCP(Transmission Control Protocol) delayed duplicate problem is discussed in Tannenbaum's "Computer Networks." The discussion references Tomlinson (1975) improved by Sunshine and Dayal (1978). Basically, from what I could make out it uses a ToD (Time of the day) clock to uniquely number packets and ensure that, if ... |
Why is the reduction $\textbf{SAT} \leq_P \textbf{3SAT}$ possible, but $\textbf{SAT} \leq_P \textbf{2SAT}$ not possible, given, that $\textbf{SAT}$ is $\textbf{NP}$-complete, $\textbf{2SAT} \in \textbf{NP}$ and $\textbf{3SAT} \in \textbf{NP}$?
|
I guess at the heart of this is that I don't really understand hash functions.
One article says any function mapping objects to an object of fixed size:
A hash function usually means a function that compresses, meaning the
output is shorter than the input. Often, such a function takes an
input of arbitrary or alm... |
From CLRS (3rd edition), I came have this question on page 626:
Given these definitions from the text,
DEFINITIONS:
Given an undirected graph G = (V,E),
1. A CUT (S ,V-S) of G is a partition of V,
2. A LIGHT EDGE over a cut is any edge crossing the cut with a weight smaller than or equal to any other edge crossing tha... |
I've been reading Saxe's proof that 1-embeddability of integer weighted graphs is NP-Complete (http://www.math.columbia.edu/~dpt/RigidityREU/Saxe79EmbedNPHard.pdf Theorem 3.2). I don't understand how this proof works.
First of all, does "1-embeddability" mean mapping each vertex to the real line? What is meant by a... |
I am reading a paper and it uses the expression "polynomial delay" which I don't understand. It is used in conjonction with the big O notation, which I'm familiar with.
Here is a example sentence showing how it is used:
The loop is executed in time $O(n^2(e+n))$, which makes a polynomial delay for the output of the d... |
$L = \{ \langle M \rangle \mid \text{there is at least one input string on which the \(M\) does not halt} \}$
Here, for a Turing machine $M$, the notation $\langle M \rangle$ denotes an encoding, over some alphabet, of the code of the Turing machine. To which of the following language classes does $L$ belong?
Regular.... |
I am trying to understand how to solve complex recurrence relations and whether there is a general method or technique to help me. That being said I am not talking about recurrence relations that can be solved using the (generalized) Master Theorem or the Akra–Bazzi method.
This is by no means a "I have some homework t... |
I'm reading Sipser and I'm finding it hard to understand what the process is such that if you give me k Turing machines with k tapes, I can spit out an equivalent Turing machine with only one tape. An example would be nice. Actually, a worked out example that shows how to go from TM that has $k$ tapes to one that has 1... |
I am perpetually confused when it comes to static scoping and dynamic scoping and their differences and Wikipedia isn't of any help, so here's my question:
Given the following pseudo code in a hypothetical programming environment, what are the outputs under the following conditions?
call by need using static scope
ca... |
What would be the equivalent math concept for associative arrays/maps/dictionaries?
EDIT: Disregard mutability. FYI,off topic, the reason why I ask this question, is that I want to calculate the distance(or similarity) between two maps given that I have a distance function for each entity(or key) in the map.
|
I was looking at this: http://www.cs.odu.edu/~toida/nerzic/390teched/tm/othertms.html
At the very beginning, they show a 2d tape and (I assume) it's 1d equivalent. However, I cannot figure out they got from the 2d case to the 1d case. I was hoping someone could elaborate.
|
Can anyone give me some hint on solving $T(n) = T(\frac{n}{2} + \sqrt{n}) + n$, with any method, master method, substitution....
I have came up with this : $T(n) = T(\frac{(\sqrt{n} + 1)^{2} - 1}{2}) + n$ and then substituting $n = 2^{m}$ but things gets really messy !
any idea?
|
Alloy's front page doesn't mention ASP, but the description sounds like ASP (finding solutions consistent with a logical spec). And Alloy isn't listed in the Wikipedia ASP article. Yet ASP systems and Alloy both seem to built on top of SAT solvers. So how do they differ?
[edit: Would it be fair to say, for example, ... |
I am using neural networks to predict a time series.
The question I'm facing now is how do I encode date/time/serial no. of each input set as an input to the neural network?
Should I use 1 of C encoding (used for encoding categories) as described here?
Or Should I just feed it the time (in milliseconds since 1-1-1970)?... |
if a,b are both binary bit. a=0, and b=0, what is least significant bit,and most significant bit of a+b, which means 0+0?
if c is the carry bit, and c=1, what is the least significant bit,and most significant bit of a+b when a=0,b=1
My thought is 0+0=0, thus least significant bit,and most significant bit are same, whic... |
In Chap 34.3 NP-completeness and reducibility of the book, Introduction to Algorithm(3rd Edition), the author states(the original text):
We call the function f the reduction function, and a polynomial-time algorithm F that computes f is a reduction algorithm.
In my mind, function should be a machine dependent implemen... |
I have a simple looking question. What is the most efficient conversion of $\sum_{i=1}^n x_i = y$ to 3-sat? Here $x_i$ is either $1$ or $0$ and $y$ is some positive integer.
Can you do better than making a SATISFIABILITY instance with $\binom{n}{y}$ clauses, each of which is the conjunction of $y$ positive literals a... |
Can anybody give me a way that i can use to calculate Complexity Time problems, i mean a way that will work on any complex code whatever it was.
I can solve basic problems, but whenever the problem gets a little complex i freeze which means that my way of thinking and solving is wrong.
for example like this:
|
A question on the interesting result in http://arxiv.org/pdf/1110.6126v1.pdf
It is shown $\Pi_2^P \not\subset P^{NP}$. But http://en.wikipedia.org/wiki/Polynomial_hierarchy says $\Pi_2^P = CoNP^{NP}$.
Does this mean an oracle in NP under which $P$ is not $CoNP$ has been shown?
Could someone elaborate?
|
Wiki (http://en.wikipedia.org/wiki/Sharp-P) says 'In computational complexity theory, the complexity class #P (pronounced "number P" or, sometimes "sharp P" or "hash P") is the set of the counting problems associated with the decision problems in the set NP'.
Is there a counting version for CoNP problems?
|
I am currently studying the pumping lemma for regular languages and I am trying to come up with an example where even if the language can be pumped it is not regular.
Which condition of the lemma should be broken such that I can find a language like that?
|
How to solve the recurrence relation below?
$$T(n) = \begin{cases}
2T(\sqrt{n}) + \log n/\log\log n & \text{if } n > 4\\
1 & \text{if } n \leq 4.
\end{cases}$$
Preferably by the master theorem; otherwise by any method. I know the Master Theorem fails, but is there any extension for t... |
I have come across a question that I am having quite a hard time with. I am to draw a design of an SRAM chip with an organization of 2M*128 SRAM that uses 1K*1K arrays of D latches. And then the questions ends with saying, "if this design is not possible then explain why." I have looked at other SRAM designs and have n... |
I need to analyze the time complexity of an online algorithm to keep track of minimum $K$ numbers from a stream of $R$ numbers. The algorithm is
Suppose the $i$th number in the stream is $S_i$.
Keep a max heap of size $K$.
If the heap contains fewer than $K$ elements, add $S_i$ to the heap.
Otherwise: if $S_i$ is sma... |
I have to create an algorithm for homework, but cant figure out where to start.
The divide and conquer algorithm muse be O(nlgn) and returns a pair of numbers p and q in an array A. p must appear before q in the array, and q-p must be the highest possible value
heres and example I made up:
A=[1,4,12,5,9,1,3,8]
the ret... |
Given a hypothesis $h:X\rightarrow Y$ ($h$ is returned by an Empirical Risk Minimization (ERM) strategy with realizable case i.e. $h$ is consistent with the sample examples) over $X=[0,1]\subseteq R$ where $Y=\{0,1\}$ and $D$ is the uniform distribution over $X$. How can I prove that for the accuracy parameter $0\leq\e... |
What would be the best introduction to Per Martin-Löfs ideas about type theory? I've looked at some lectures from the Oregon PL summer school, but I'm still sort of puzzled by the following question:
What is a type?
I know what a set is, since you can define them by the usual ZF axioms and they have a very intuitive co... |
(If I am posting this in the wrong StackExchange site, then please direct me to the correct one)
Okay, so some small background first: I am currently third-years student in Computer Science on the university.
I have big interest in Artificial Intelligence and I was wondering if I could practice it somewhere, for exampl... |
I am studying "An Introduction to the Theory of Computation" by Sipser -- there is a problem *3.17 (p.161) which I can not solve.
Any hints (not answers) from which side to attack it?
Let $B=\{M_1, M_2, ...\}$ be a Turing-recognizable language consisting of TM descriptions. Show that there is a decidable language C c... |
We have started learning about analysis of recursive algorithms and I got the gist of it. However there are some questions, like the one I'm going to post, that confuse me a little.
The exercise
Consider the problem of multiplying two big integers, i.e. integers represented by a large number of bits that cannot be han... |
I am stumped as to how to print the longest path from the root of a binary tree to a leaf, essentially traversing the height of the tree. I've got the following for finding the height of a binary tree:
if (root == null) {
return -1;
}
return 1 + (Math.max(heightOfTree(root.leftNode), heightOfTree(root.rightNode)))... |
I'm a bit confused about these concepts. As far as I understand, something is Turing complete when it can simulate a Turing machine. And there is this thing called a Universal Turing machine which is universal because it can simulate a Turing machine. Which to me, implies there are Turing machines that are not universa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.