instruction stringlengths 35 29.1k |
|---|
I have the following problem:
Given an unsorted array A of size n, print the first k elements in A larger than its median.
Here's my approach to the problem:
1. Create a minHeap and a maxHeap
2. Iterate over elements in A // O(n)
- if maxHeap.count < minHeap.count
insert current element t... |
I am looking to implement a neural network on hardware using Verilog. I have completed and tested with floating point representation and a 20 bit fixed point representation. I want to further reduce the memory utilisation by using dynamic fixed point. I want to identify the less important weights, and assign them a sma... |
Computer Science has a broad spectrum of disciplines ranging from AI, Big Data, Cryptography to Human Computer Interaction and Bioinformatics. I would like to know what projects are ideal for undergrad students of CS among these disciplines that can attract funding from European and American firms.
|
So let's say you have a histogram distribution represented as an array where each element is equal to the number of numbers from the underlying data set that are equal to that element's index.
For example, if your underlying data had 5 0's, 18 1's, 11 2's, 0 3's, etc., then the array representing this distribution woul... |
I'm trying to find CFG for the language $$L = \{ a^nb^mc^kd^l | n + k = m + l, (n,m,k,l) \in \mathbb{N} \}$$
and what I have done so far is to make PDA which simply does the following:
If on the stream there is "a" -> push $\xi$ in the stack
If on the stream there is "b" and the stack is empty -> push $\zeta$ in the s... |
i am looking for an algorithm that will generate all possible combinations of words from given dictionary that satisfy given format.
Let me explain what i mean with format:
For example, if the format is "abcd" means that we are looking for one word, length of the word must be 4 and because all the letters in format ar... |
Given a list of entries entryList, determine a 4x4 matrix of which you sum up the entries specified in entryList such that there is no other matrix for which the sum of entries specified in entryList is greater.
In other words: entryList specifies some entries, now imagine an arbitrary 4x4 matrix m, entryList tells us ... |
Problem:
Looking for an efficient algorithm to find the largest value that exists in all columns.
Constraints:
The values in each column are always decreasing
My algorithm:
Check the first row for match
Use the lowest value from first row to search for match
Use the value from row x, column y to search for match
I... |
I'm trying to figure out optimal round 1 openings for this game: http://generals.io/.
For the purposes of this question, I've simplified some of the rules and mechanics of the game, and I assume that there are no opponents.
Here are the basic rules/mechanics/assumptions:
The game is played on a board of size m * n, 16... |
How do I calculate the information density of an encoding system?
This question came up as I was reading several papers about encoding data in DNA (I think I have gone through just about every major paper on encoding data in DNA after Church's). All of them mention the information density of their encoding system, whic... |
And obviously there will be no trivial vertex which has only 2 edges. I think triangle free graphs are (subjectively) easier than complicated graphs, i wonder if you know some heuristic approaches/steps specificly for triangle free graphs. Thanks in advance
|
I was reading "Principles of Database & Knowledge-Base Systems, Vol. 1" by Jeffrey D. Ullman. There is a chapter about Datalog negation and as I was seeing the problems of negation I kept thinking that using the predicate $ \neq $ would solve those problems but then I see the following:
p(X) :- r(X) & ¬q(X).
q(X) :- r(... |
Let $A$ be a sorted array of $N$ values. I am interested in finding the index $j$ such that the elements $A_j, A_{j + 1}, ..., A_{j + k - 1}$ have the $k$ closest values to the given target value $T$. Assume that $k$ is comparable, in magnitude, to $N$; i.e. we don't have $k \ll N$.
One can naively do this by first (bi... |
I have a reduction and can't understand if it is Karp reduction. I want understand if my reduction is Karp reduction as well as understand how to determine which one is so.
Let I have formula $\Phi = (l_{1,1}\lor l_{1,2}\lor...\lor l_{1,k_1})\land(l_{2,1}\lor...\lor l_{2,k_2})\land...\land(l_{n,1}\lor...\lor l_{n,k_n})... |
I was learning about support vector machines from MIT OpenCourseWare. I figured it out. I understand why we try to minimize $\frac{1}{2} w^2$. I just did not get why we try to maximize Lagrange expression like said at 35:56 in the YouTube video.
Margin (width) of the support vector is $2/\|w\|$. We want to maximize wi... |
I come to you with a problem I have been struggling with for the past few weeks. I would like to classify (complexity) a special case of Unique Coverage. To set the mood on, I will start by introducing the Exact Set Cover and Unique Coverage problems. I will then go over the special cases I am interested in.
Set coveri... |
I'm trying to find sup of $\|\mathbb{G}\|$ where $\mathbb{G}$ is CFG in Chomsky Normal Form. So far i have done some work, but I'm really not sure in my proof. Let $G = \langle Q, N, S, R\rangle$ and
$$\alpha \rightarrow \beta \in R,\ |\beta| = n$$
$$\|\alpha\| \le \sum_{i=0}^{\log_{2}n}2^{n}\,.$$
I made this conclusio... |
Question
Is it possible to find an existing point's nearest neighbour within a logarithmic upper bound?
What I've tried
I have:
the set of points $P$,
a point $p$, where $p\in P$,
a point $q$, where $q\notin P$,
a Voronoi diagram, $V(P)$, of the points in $P$.
I know it's possible to query for a new point $q$'s neare... |
First question, and my apologies if it is off-topic! This question suggests to me I may not be totally off-base.
Where did our present regex notation originate? I am particularly wondering how $ came to mean "end," particularly since its most common use in the English-speaking world (as far as I know) is as a prefix ... |
My problem is to find a better algorithm to fill the adjacency list.
specs:
G = (V , E ) //the graph
V ={w} //vertex in this case each vertex is an array
E={⟨u,v⟩| u,v ∈V ∧ u>v} // edge only if u > v
u > v only if foreach i u̸=v ∧ u[i]≥v[i]. // (u>v and v>w => u>w)
my naive code whit complexity O((v+1)*v/2) ≈ O(... |
I have an old exam question for my pattern recognition course which is stated as follows:
Consider a pool of Haar features, determine if these Haar features are independent or not. Is it a problem in boosting algorithms (e.g. AdaBoost)? Why (not)?
I have a really hard time figuring out an appropriate response to this... |
During a lot of algorithm competitions I met colored tree questions and there have been multiple cases where I though of different approaches.
I'm curious what is the best way of solving the following problem:
Given a tree with N nodes: 2 <= N <= 100 000. Every node has a color c : 2 <= c <= 100 000. You are supposed a... |
Lambda calculus can be used for encoding semantics of natural language, e.g. http://yoavartzi.com/tutorial/ contains full details about semantic parsing of natural language: converting natural language texts into lambda expressions - Cornell Semantic Parsing Framework is used https://github.com/cornell-lic/spf.
My ques... |
The order of the classes of three does not matter. Example: 1,2,3 and 3,2,1 would be considered one class. I am trying to do fisher discriminant analysis on a set of data and want to begin reducing the parameters to better help with classification. As of now I cannot tell which parameters are the most pertinent, so loo... |
The time complexity of a Binary Search is O(log n) and Hashing is O(1) - so I've read. I have also read that Hashing outperforms Binary search when input is large, for example in millions. But I see that log n, when n is around 30 million, is roughly equal to 25.
If for such a large value of n, log n is just 25, then i... |
As background, in Information Retrieval, there are many metrics to assess how well search results are retrieving information.
A simple one is precision, where we calculate the fraction of documents returned that are relevant to our query. There is a second (or more general?) metric, precision@K: For a ranked result se... |
I was going through the project lists of Andrew NG from his Stanford machine learning course and I found a project based on recreation of calligraphic characters. To do so firstly we need to extract strokes from characters and I can only understand it in bits and pieces and I cannot understand at all how to implement i... |
$L = \{ 0^m10^n|m\geq1 \wedge n\geq1 \}$
Is this a regular language?
A language is regular when there is a DFA accepting the language. Since there is a DFA accepting this language I suppose that it is a regular language. But as I have seen in the book it says that it is not regular. So I am confused. Can someone guide ... |
Considering the complexity classes $NP$, $co-NP$ and $PP$:
$NP$ and $co-NP$ are both contained in $PP$.
For any Language $L$ suppose we have the mechanism that: If the oracle of $co-NP$ implies $No$ on a modified version of $L$ (lets call it $L'$), then that we can be certain that for every run of $PP$ on $L$ would re... |
Within CSS we talk about binary interactions. Does this prevent synchronizing multiple processes in one step? Example:
$P_1 ::= a.D$
$P_2 ::= \overline{a}.D$
$P_3 ::= a.D$
Let's consider the following LTS: $(P_1 | P_2 | P_3)\restriction_a$
Do I get $P_1, P_2, P_3$ $\tau$-synchronized simultaneously if an action $\tau$ ... |
The problem
Given an undirected graph $G=\left(V, E\right)$ and positive edge weights $w_e$, design a 2-approximation algorithm based on the primal-dual principle.
So far I managed to represent the problem with a linear program:
Linear Program
Primal
$\min \underset{e\in E}{\sum} w_e x_e$
s.t.
$\underset{e|v\in e}{\s... |
Are there some languages not regular and/or not context-free in which the proof by contradiction fails? Why we need a "more specific" version of pumping lemma?
|
If A is an array with the following elements:
$$ a_1,a_2,...,a_n,b_1,b_2,...,b_n $$
How to shuffle A to form:
$$ a_1,b_1,a_2,b_2,...,a_n,b_n $$
with minimal swaps and using no additional space?
I read this answer and wrote the following code:
def shuffle(a,left,right):
if right - left>=4:
half = (right - left)/2
... |
On an HDD if data is fragmented the discs need to be spun to where the next block in the file is, so how and where data is stored can make a big difference in how long it takes to retrieve the data. With an SSD is the retrieval time for fragmented data constant (due to no moving parts and it being entirely electronic)?... |
Prove that given a number we can find whether there're 2 elements in a red/black tree that their sum equals that number in $\Theta(n)$ time and constant space.
The original problem appears here,
however the solution uses $\lg n$ space.
A problem in my course required adjusting the algorithm such that we use constant ... |
I'm looking at Jeffrey Erickson's Notes on the master theorem
(page 10).
Part (b) of the theorem states that if $T(n) = aT(\frac{n}{b})+f(n)$, $af(\frac{n}{b}) = kf(n)$ and $k>1$ then T(n) is $\Theta(n^{\log_b(a)})$. But I get a different result.
Using recursion trees we have $$T(n) = \sum_{i=0}^{\log_b(n)} a^i f\left(... |
Can there be a genuine algorithm in which number of memory reads far outnumber the
no. of operations performed? For example, number of memory reads scale with n^2, while no. of operations scale with only n, where n is the input size.
If yes, then how will one decide the time complexity in such a case? Will it be n^2 o... |
I've heard of bigO notation but I don't really understand how do I determine it for my code and what exactly does it represent?
I heard that there are two:
RunTime
Memory Complexity
How can I learn to use it?
|
I'm playing around with some historical stock data and attempting to optimize a portfolio.
I essentially have created a function that generates certain statistics about a portfolio (right now it's composed of a list of equities with corresponding weights). The portfolio is constant and tracked over a historical time ra... |
I'm trying to write a small algorithm to detect and delete duplicate lines inside a subset of consecutive lines in a file.
I've come up with 2 similar solutions.
After some quick tests, I've noticed that one of them is much faster than the other, especially on large files.
But I don't understand why.
Here's the quick s... |
I am currently doing a course based on algorithms (Coursera). I've come across an algorithm called quick find. The course does have reference to Big O Notation. Despite the fact that I do not have much knowledge of Big O, I have been doing some basic reading.
Implementation (Java):
Initializes the array:
public QuickF... |
The Bentley–Ottmann algorithm, for example, has time complexity of $O((n + k) \log n)$. Is the statement $O((n + k) \log n) = O(n \log n)$ true? I know that $k$ is there because it has big enough of an impact on the overall time complexity that it's relevant to include it. But can it be ignored, so that the previously ... |
Language $L$ is sparse if there exists a polynomial $p$ such that $|L ∩ \{0,1\}^n| ≤ p(n)$. Thus, if there are at most polynomial number of strings for each length $n$ in the set $S$ (where $S$ represents the language $L$), the set $S$ is a sparse set.
Mahaney's theorem states that if an NP-complete language is Karp-re... |
What does "n" or "N" in asymptotic notation actually means?
It is usually stated that the "n" is the size of the input.
Does it mean that it is the size of the algorithm,that it the size of the whole chunk of algorithm,meaning if a algorithm has 20 lines it's "n" is more than a algorithm which have 10 lines.
|
Can someone help me to construct a Turing Machine for this function:
$f(n) = \frac{n}{8}$. If $n \mod 8 = 0$, then
$f(n)$ is undefined.
So the machine should somehow first prove if the number (which is represented in binary) is divisible by $8$ . That means for numbers like $1000$, $10000$, $11000$ and so on. But I don... |
I'm totally new in algorithms and I have a hard time studying how to calculate the time complexity of algorithms.
I'm studying Introduction to Algorithms, by Cormen on my own. Iam doing an exercise and I faced a problem that I couldn't solved it. first, the book asks for the worst time complexity of combination of merg... |
Consider a set $S$ of formulas $\beta_i$ and a formula $\alpha$, if we have a condition such as $S \land \alpha$ is inconsistent what we have to calculate to check the inconsistency of $S \land \alpha$? In other words, what is the result of $S \land \alpha$?
For example, $S=\{\beta_1, \beta_2, \beta_3\}$
|
My question spawns from this question. The question is straightforward:
Can we find whether there exist 2 values in a balanced binary search tree where their sum equals a given target value?
Now the constraints:
Constant additional space in regards to $n$, the size of the tree. By this I mean you can use a constant ... |
I'm trying to solve the same problem as this fellow, in Java. The problem, in short, is:
Given pairs $(a_1,b_1),\dots,(a_k,b_k)$ of strings, find a sequence $s_1, \dots, s_m$ such that
$a_{s_1} \dots a_{s_m} = b_{s_1} \dots b_{s_m}$.
for all $i \ne j, s_i \ne s_j$.
If there is a shortest such sequence, the corres... |
This problem came up during the Google CTF 2017. For background information about the challenge you can search for GoogleCTF A7 ~ Gee cue elle.
Problem description:
A random number N between 0 and 39402006196394479212279040100143613805079739270465446667948293404245721771497210611414266254884915640806627990306815 (~3.9... |
Disclaimer
I have no idea about complexity theory. If this question makes no sense or is wrong, mods are free to delete the question
I´ve read somewhere that the problems that can be correctly decided in $o(log\ log\ n)$ space are exactly the regular languages. I was thinking in "$promise-DSPACE(o(log\ log\ n))$" probl... |
I am implementing the Christofides algorithm for TSP problem and currently I have one issue with the MST result. Let's assume that I have one graph $G$, whereas I can get $MST_1$ and $MST_2$ where both are Minimum Spanning Trees, because $G$ contains more than one edge with the same weight.
In image [2] below, the diff... |
Looking at this video starting at 1:45, the author claims to be using a second-order approximation for a Markov text generation. He has one letter which he outputs followed by another letter which tells him which state to go to - so in other words, he might first pick AC, so he outputs A and then goes to state C, where... |
I'd like to prove that the following problem is NP-complete. I'd just like to know what reduction I should do:
Two Subset Sum: Given a set S of integers and an integer T, determine whether there are two subsets of S such that the sum of the numbers of one is T and the other is 2T. The subsets do NOT have to be disjoint... |
Given a $3SAT$ problem the decision version of the problem (if it has a solution or not) is $NPComplete$. Now, given that we consider the promise version of the $3SAT$ problem, the promise is every $3SAT$ problem provided always has at least 1 solution.
Query: Does every solution of the above $3SAT$ problem instance ha... |
Given two non-trivial (not $\emptyset$ or $\Sigma^*$) languages $A$, $B$ over an alphabet $\Sigma$, which of the following is correct:
a. There is a language $C$ such that $A\leq_pC$ and $B\leq_pC$.
[..]
c. There is a language $C$ such that $C\leq_pA$ and $C\leq_pB$.
According to two different sources I've seen the c... |
Suppose that $F_2$ denotes the field with $2$ elements. We are given $m$ vectors $\{x_1, \ldots, x_m\}$ in $F_2^d$ which are a basis for a subspace $W$.
Suppose we have a vector $v \in F_q^m$, and we want to find a $w \in W$ that is closest to $v$ in the Hamming metric.
What is the complexity of this problem, as a fun... |
There is a large body of literature on RAMs with "reasonable" and "unreasonable" operations, where "unreasonable" operations would yield a machine with too much power to be practically feasible.
For example, it is known that for integer RAMs, allowing unit-cost multiplication yields a machine that is exponentially fast... |
Assume that a given turing machine $M$ accepts words in the language
in $n^k$ or less steps, but words that aren't in the language
are rejected in unknown number of steps (the machine might even loop).
$k$ is unknown.
Is $L(M)\in P$?
Well, obviously $L(M)$ is recognized in polynomial time. The question is whether... |
What is the most efficient way to prove that a person computed r rounds of some cryptographic hash function (ex. sha256) on an input?. The trivial solution seems to be to show all r hashes, where value_i = hash(value_(i-1)) /forall i <= r, but this seems very space inefficient.
|
Is "Rice's theorem for the computable reals" -- that is, no nontrivial property of the number represented by a given computable real is decidable -- true?
Does this correspond in some direct way to the connectedness of the reals?
|
According to Amortized time cost of insertion into an Array list,
A dynamically resizing array list will resize when the number of elements reaches a power of two. So, after n elements inserted, we've resized at sizes 1, 2, 4, ... , n.
Can anyone kindly explain me the logic of this? If we consider the n(number of ele... |
How much training data is needed to build a speech-to-text engine based on machine learning? (To within an order of magnitude or so.)
Big companies like Google, Facebook have a massive amount of data. For usual people its not possible to acquire that amount of data and without it training a model for the purpose seems ... |
Consider a graph where edges represent the similarity of two nodes. In general, the graph is sparse with edges existing between only similar nodes (I can achieve this by deleting edges with similarity values below a threshold). Now, let us say I have a group of nodes who are known to be similar (say determined by a clu... |
I have a set of sorted values $\left\{a_j \right\}_{1 \leq j \leq n}$, suppose now a number $x$ is given and we would like to find out the index $j$ such that $a_j \leq x < a_{j+1}$ (you can assume always $- a_1 = a_n = +\infty$). I could find such index with a binary search on the lower bound (which would take $O(\lo... |
I have a homework that I can't solve can somebody help me?
If $\Sigma$ is an alphabet, $R$ is regular and $L$ is context-free. Is the language $$P = \{\alpha\in\Sigma^*\mid \alpha\beta\in L\text{ for some }\beta\in R\}$$ context-free?
|
I am trying to understand how to build an eventually consistent KV store. It's just a learning experiment. Let's only consider one value which stores a fruits list.
We have 2 servers, 2 clients, N=2, W=1, R=1.
We start with an empty value and a zero version vector on both servers.
Server 1 and 2: ('', {'Client-A': 0, ... |
I'm a developer, so I understand (a bit) how computers work, and how softwares work and fail.
In all softwares I've dealt with (as a developer or as a user), I've always seen small or huge bugs:
Even in systems well designed/implemented you encounter design/implementation bugs.
Even sites/softwares exceptionally... |
We recently figured out a Dynamic Programming solution to compare two trees using concepts of edit distance in strings. It goes something like this-
$A[i', i, j', j] = \min \begin{cases} B[i', i-1, j', j] + c(i) \\ \min_{j_1 \le k \le j} \{A[i', p(i), j_1, k] + B[p(i) +1, i-1, k+1, j] + d \}
\end{cases}$
$B[i', i, j... |
I am thinking of a particular datastructure, but don't know the name of it.
A sequence of elements may be modeled by a collection of some X, where each X consists of:
The element, serialized as a bunch of bytes.
[a] The hash of the previous X in the sequence, based on the bytes of both parts of that X in a predictabl... |
Is there any algorithm which can transform any graph to tree, with providing mapping from one to another?
Suppose we have directed graph:
E->A
A->C
C->C
C->B
B->A
B->D
I want to convert it to tree in such way, that all biggest cycles is converted to node, and all dependencies out of this cycle is binded to this node. ... |
S → D
D → E | EC
E → anyId
C → B | .D | B.D
B → <S> | <SA>
A → ,S | ,SA
The tool I am using keeps complaining about left recursion in this grammar. I can't see where.
The language recognized is something like:
anyId
anyId.anyId
anyId<anyId>
anyId<anyId>.anyId<anyId,anyId>
|
I want to construct a loop-computable program for this construction:
IF x1 = c THEN P ELSE P'
I know how to transform if else construction in loop , but I can't understand how to check the equality.I have idea for x1 >= c , but how can I check if the both numbers are equal ?
|
Say I have a large number of sets (on the order of ~1000) with a smaller number of potential entries (~200), and a widely varying number of entries per set. An example:
$s_1 = \{1, 42, 133\}$
$s_2 = \{27, 283, 292, 172, 66, 62\}$
$s_3 = \{1, 42, 292, 66\}$
$...$
$s_{1000} = \{1, 133, 72\}$
Is there an algorithm more ef... |
I was given an object with exactly 2 operations test-and-reset that sets the value of the object to 0 only if it was previously set to 1 and does not return a value and fetch-and-add(v) which adds v to the value of the object and returns the previous value.
I am almost sure the consensus number of this object is 2 and ... |
So the basic doubt i had started with this piece of code
def fn2(a,n):
.
.
for i in range(0,n):
.
.
.
def fn1():
.
.
for i in range(1,n+1):
fn2(a,i)
Would this be considered as a loop within a loop or will this take more than the usual O(n2) or would it take gr... |
I have following statements which I must prove or disprove :
1) Let $L$ be a CFL and $k \in N$ then $L^k$ is also a CFL.
2) $L_1 \subseteq L_2 \subseteq L_3$ are Languages, if $L_1$ and $L_3$ are DCFL, then $L_2$ is also a DCFL
The first one I have no idea how to start or whether it is also a CFL
For the second one I ... |
Let $$MAX-CLIQUE = \{\ <G,k>\ |\ G\ is\ an\ undirected\ graph,\ and\ the\ largest\ clique\ of\ G\ has\ k\ vertices\}$$
Does $MAX-CLIQUE\in coNP$? If it does, can you think of a verifier?
If $NP=P$, does $MAX-CLIQUE\in P$?
I cannot think of a polynomial verifier for $MAX-CLIQUE$'s complement. There might not be a ma... |
I want to build the distance constrained k-Nearest Neighbours Graph, i.e. for every point $p$ in the data cloud $P$ there are at most $k$ undirected edges to points that are closest among all possible vertices using $L_2$ metric with additional constraint that are no further than $d$.
There are only insertions (in batc... |
how can i prove the following statement :
1- $L_1\subseteq\Sigma^*$ is CFL and $L_2\subseteq\Sigma^*$ is regular Language, then $L_1$\ $L_2$ is CFL .
so i want to know what is the method to prove it ?
I'm not sure, but can i use a PDA and DFA or something else ?
so i tried the following :
$L_2$ is regular and thus is ... |
I got onto the topic of HDLs (Hardware Description Languages) from a comment elsewhere on this site.
The Wikipedia article states, rather tantalizingly:
One important difference between most programming languages and HDLs is that HDLs explicitly include the notion of time.
I tried to dig deeper in the article to bett... |
I was thinking about developing a daily production work plan algorithm for an enterprise. The problem is as following:
There are various tasks that needs to be completed, each has a deadline, a duration and a set of requirements for resources. It is mandatory that no task is expired, but if that's not possible, we wi... |
what is the complexity of $FP^{NP}$ w.r.t. $FPSPACE$?
Also can someone please provide a few examples of Problems complete for $FP^{NP}$? If possible let the examples be natural.
|
I'm looking for the name of a particular pattern, and/or resources (articles) on its usage.
The context of the pattern is a journalling system to operate on some collection, as in the example given here:
We could model an webstore using patterns from event-sourcing. In such a model, we would have a collection (e.g. a s... |
If I have a language over alphabet $\Sigma=\{(,[,],)\}$. How can I find out if a tape has a valid (matching) parentheses structure in linear time?
So far, my attempt is as follows:
state 0: accept ( or [ i.e. no open parentheses
state 1: accept ), ( or [ i.e. a ( has occurred previously
state 2: accept ], ( or [ i.e... |
I am a starter in complexity theory though I have fair knowledge in Turing machine. I know what it means to be non-deterministically polynomial time solvable but I am trying to understand where the time goes beyond polynomial time even using non-deterministic concept. Is it possible or we can do everything in polynomia... |
The decision version of $TSP$ is $NPComplete$. I was reading about the functional version of $TSP$ i.e. the class $FP^{SAT}$.
It is mentioned in the original paper that TSP is complete for the class $FP^{SAT}[n^{O(1)}]$. By definition of the class, it means TSP can be solved in polynomial time by making $[..]$ calls to... |
I am looking for algorithm to rather complex problem and I am wondering if this is some well known problem or can be translated to one.
Let's say that i have buckets B1, B2, B3 that contain some number of colored balls (red and green) and set of conditions K1=(1 green, 2 red), K2=(2 green, 1 red), K3=(2 green, 1 red) ... |
The goal is to get big $\Theta$ for $$T(n) = 2T\left(\frac{n}{3}\right) + 2T\left(\frac{2n}{3}\right)+n$$ I tried two approaches, but both failed:
Recursion tree. We see that
$$\begin{align}
\sum_{i = 0}^{\log_{3}(n)}n2^i & = \Theta(n^{1+\log_3(2)})\\
& \ll T(n) \\[1em]
& \ll \sum_{i = 0}^{\log_{\frac{3}{2}}(n)} n2^... |
I have $a_1, a_2,\dots,a_n$ and $b_1,b_2,\dots,b_n$ and an upper bound $U$ and $n$ linear equations of the form:
$k_1 * a_1 + b_1 = x$
$k_2 * a_2 + b_2 = x$
$\dots$
$k_n * a_n + b_n = x$
Additional info where $r \in \{ 1,2,\dots , n \}$:
$a_r$ is prime
$0 \leq b_r < a_r $
$k_r b_r, U, n, \in N_0$ and $(a_r\in N)$
I... |
I'm wondering if anyone knows of any place where the Wolfram classifications of many outer totalistic cellular automata have been catalogued. The classes of a few examples are given in A New Kind of Science, famously that of Rule 224 (Life) or more simply ones like Rule 0 which kills all of the cells. I'm wondering if ... |
What is the complexity of finding the k'th largest element in an unsorted linked list? If we sort the list, I think that the complexity is O(nlogn + k)=O(nlogn) since k < n. Is there a way of finding the kth largest element without sorting the list?
|
Assuming that a database entry schema contains two 64-bit hash IDs generated via the algorithm explained here, in the section "Generating Hash Keys for Chess Boards", and simply a score that's a 32-bit integer, how many bytes would the database need to be to guarantee that it can store every possible game state of ches... |
My name is Webber from Auckland, New Zealand. I am currently in my second year studying the bachelor of computer and information science. I have chosen to do a double major in computational intelligence and analytics. My goal is to become a data scientist after graduation. I am currently trying to decide which paper to... |
After uploading a high definition video in youtube, youtube automatically makes a low definition(standard definition) version of the video.
I would like to know what algorithm they use to reduce the quality of video. Is it lossless or lossy?
If not youtube, I would like to know what algorithms are there in the literatu... |
In real-world programming, we frequently need to compute hash codes for complicated objects. The main desired properties are that the values should
be deterministic and
have few collisions.
Let's assume we have access to robust hashing for basic data types such as integers, strings, etc. How do we combine multiple s... |
Let $\text{MOD}_2 : \{0,1\}^n \rightarrow \{0,1\}$ be a parity function where $$\text{MOD}_2(x_1,\dots,x_n) = \sum_i x_i \bmod 2$$
It is known [See e.g. Lemma 5 of this lecture note] that any polynomial $f(x_1,\dots,x_n) \in \mathbb{R}[x_1,\dots,x_n]$ of degree at most $\sqrt{n}$ must disagree with $\text{MOD}_2$ on at... |
I have a question about the Set Cover problem: If I get a universe $U$, and $m$ subsets of size exactly $2$, and an integer $k$. Is this problem is still NP-C or I can solve it on a polynomial time?
Thanks.
|
I am not a computer scientist and have no knowledge of programming.
However, I wondered continuations occur as natural and interesting mathematical structures, perhaps as algebraic or type theoretic structures of some kind, and quite apart from computer science considerations.
I understand that continuations are spec... |
I have written an algorithm for rectangle packing where I have the following recurrence relation for the running time:
$$
T(x,y,z)=\begin{cases}
O(1)&\text{, if x = 0}\\
\sum^{z-1}_{i=0}\bigl(x\cdot T(x-1,y+1,z+1-i)\bigr)+x\cdot y\cdot z&\text{, if x > 0}\\
\end{cases}
$$
You however always start with $T(n, 0, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.