instruction stringlengths 35 29.1k |
|---|
I apologize for the vagueness of the title, but this question is quite difficult for me to describe.
For that reason, I'm unable to directly convey my problem.
In an effort to circumvent this, I've created an example.
You've been instructed to help style your corporation's new website.
It's almost done, but you've rea... |
I have $k$ sorted arrays stored as linked lists. I need an algorithm to merge them into one single sorted array, also stored as a linked list. How can I do that?
My Code:
Function merge(A[k])
Begin:
// A is array of list to merge.
Array result;
temp //array to save element in each list
For (i=0:i<k:i++):
Temp.add(A[... |
Finding a short point on a lattice is hard, but I was wondering if finding a vector on the lattice which the fewest non-zero terms was easier?
Are there any good approximations like LLL, but which produce lattice points with lots of zeros?
|
If given any two language both
$L_1$ and $L_2$ are decidable then why both $L_1\leq_m^\mathsf{}L_2$ and $L_2\leq_m^\mathsf{}L_1$ are false. Please provide easy explanation with any counterexample for both cases.
Any language $L_3$ is given as Undecidable and $L_4$ is decidable then $L_3\leq_m^\mathsf{}L_4$ is false.... |
I'm new in theory of computation. Here {0,1} set of input symbols. I tried to make the NFA from L(M)= set of all accepted strings, but unable to complete it. Can someone give some hints that how should I attack this problem? . It will be very helpful.
|
I'm looking at geometric objects on the sphere and need to determine if a point on the sphere is inside a spherical polygon.
In our case a spherical polygon is a an ordered set of vertices $v_1v_2...v_n$ and the edges $v_iv_{i+1}$ are given by great circle arcs. The polygon is uniquely defined by a counterclockwise wal... |
I have a question that says that the complement of a regular language given as:
$L_1=\{a^nb^m|(n+m)<5\}$ is $L_2=\{a^nb^m|(n+m)\geq5\}$ over $\Sigma=\{a,b\}$, and therefore, we can simply construct finite automaton (FA) of $L_2$ by simply interchanging the accepting and non-accepting states of $L_1$ .
However, as per ... |
[Updated question]
A Dynkin System is, provided all sets are finite, a collection of subsets of a universal set closed under complements with the universal set and closed under union of disjoint sets.
In particular, every Dynkin system contains the universal set and the empty set.
Fix a finite set $\Omega$ and let $\ma... |
In the Wikipedia article on Rogers' theorem, it is stated that the proof given by Rogers is a construction of a partial recursive function which implements the Y combinator.
I've just a basic knowledge of both the theory of recursive functions and the lambda calculus, however I (think I) know what the Y combinator is a... |
I have an unordered set of n unique, positive integers. I want to partition it into ceil(n / k) unordered sets of up to k numbers (k << n) in a deterministic way (I want to get a sequence of the same ceil(n / k) output sets without depending on a fixed order of the input).
Is there a way to do so that has superior algo... |
Suppose I have the following Petri net:
I wonder whether it is possible to model an inverse relationship between $p2$ and $p3$. Basically what I want to achieve is to make either $t1$ or $t2$ fireable but never both. Currently, I just set a token in $p2$ and leave $p3$ empty if I want to make $t1$ fireable (or vice ve... |
I would just like to discuss with you first part of the proof for quick sort please unless you need more details.
Probabilistic fact: For a quick sort please, given that the expected number of coin tosses in order to get $k$ heads is $2k$.
Definition:A good call to quick sort should give partitions each of size at most... |
There is plenty of research into the so-called "random SAT" problem, where we basically try to solve SAT instances with clauses chosen "at random" in some sense.
There are all kinds of variations of this problem, mostly referring to how the clauses are chosen. Typically you see it written as the random "$k$-SAT" proble... |
In a French course (p. 13) there is a language of words of {a,b,c} containing at least one occurrence of the string bac.
The course provide also among other things this right-regular grammar below:
T = { a,b,c }
N = { S,U,V,W }
R = { S → aS | bS | cS | bU
U → aV
V → cW | c
W → aW | bW | cW | a | b | c... |
This is related to the discussion of average case of quick sort.
Given that we have a sorted sub-array $Z_{ij} = i, i+1, \dots, j$ where $i < j$.
Claim: $i$ and $j$ are compared if and only if, among all elements in $Z_{ij}$, the first element to be picked as a pivot is either $i $ or $ j$.
Forward direction Proof: T... |
Let $T_1$ and $T_2$ be two spanning trees. If $a$ is an edge in $T_1$ that is not in $T_2$, and $b$ is an edge in $T_2$ that is no in $T_1$. I want to prove that $T_1 - \{ a\} + \{ b\}$ is a spanning tree. I have an idea of what is happening but I don't know exactly how to write the proof. I know that $T_1 - \{ a\}$ cr... |
I am planning to teach approximation algorithms for problems such as job scheduling and number partitioning. I would like to teach proofs, but the proofs I found in the original papers (e.g. this one) are quite hard to understand - they use complicated weighting schcemes, and there is no explanation of how these partic... |
For Turing machines, if the input variables increase, will the state set Q increase ? will the tape alphabet Γ increase?
For example, for the SAT problem, the first question is whether the Boolean expression of one variable is satisfied, the second is whether the Boolean expression of three variables is satisfied. Does... |
Question: Suppose we have the following array where we want to find the smallest $i$th smallest element in the array using QuickFind algorithm (similar to QuickSort):
$$
QuickFind\left( A,n,i \right) =\left\{ \begin{array}{l}
QuickFind\left( A,k-1,i \right) ,\ i<k\\
QuickFind\left( A,n-k,k-i \right) ,\ i>k\\
... |
Given recursive equation, $T(n) = 3T(\frac n3 + 5) +\frac n2$
$$
\begin{align}
T(n) = 3T(\frac n3 + 5) +\frac n2 \tag{1} \label{1} \\
\lt 3T(n- 15) +\frac n2\\
\lt 3 \left(3T\left(\frac{(n- 15)}{3} +5 \right) + \frac{n-15}{2} \right) + \frac {n}{2} \tag{2}\label{2}\\
\lt 9T(\frac n3) + 3\frac {n-15}{2} + \frac n2 \tag{... |
If any language
$L_1$ reduces $L_2$ in polynomial time $L_1\leq_p^\mathsf{}L_2.$ If $L_1$ is recursive then $L_2$ is recursive and recursively enumerable, is it true? Because $L_2$ is at least as hard as $L_1.$
|
My question is about CompuBERT (Three is Better than One Ensembling Math Information Retrieval Systems)
It is written on page 21 (table 2):
"we assigned a distinct mask for math tokens on input, often used to
distinguish between different input languages"
I haven't found the implementation of the assignement of a dis... |
This question is about de paper Extending Multi-Sense Word Embedding to Phrases and Sentences for Unsupervised Semantic Applications, depicted in the following picture:
I am interested in more information about the problem of given a new phrase, find the most similar phrase among billions of phrases.
Is it possible to... |
Given a $k$-sorted array where each element in the array is $k$ positions from its correct position, we want to sort such array using quick sort. Generally speaking, I understand that running time is very unlikely to be guaranteed for best case and thus in most cases you would end up with $O(n^2)$ running time though q... |
I have an input of 128 bits (binary, 0s and 1s) and want to hash this input with 32 bit CRC. But I am not sure if collision rate is moderate or too high ?
Is it 2^128/2^32 = 2^98.
And does that means 1 collision after 2^98 hashes OR something else ?
I am a little bit confused with the math involved.
Is there any ot... |
well-known that a loop-programm in Theoretical computer science always terminates, but why do that java example not?
for( ; ; ){ }
|
What would happen if the CPU data-bus bit 2 is connected to the RAM data-bit 5 and CPU data-bus
bit 5 is connected to RAM data bit 2? Assume the rest of the connections are all right – explain.
|
I have a cloud of points in $\mathbb{R}^n$ and I want to embed them in Hamming Space.
One possible solution is for example found in Inductive Hashing on Manifolds.
The problem is:
I need an extremely fast evaluation of a new embedding when a new point arrives in my data (the so called out-of-sample extension problem) b... |
A naive algorithm for determining whether a graph with $|V|$ vertices has a clique of size $k$ is to list all $k$-subsets of $V$, and check each one to
see whether it forms a clique. Why is the running time of this algorithm $\Omega(k^{2}{|V| \choose k})$? Specifically, where are we getting $k^2$?
|
Given constants $c_i > 0$ and $K > 0$, find $b > 0$ numerically such that $b^{c_1} + b^{c_2} + \dots + b^{c_n} = K$. I'd like to solve this with a non-iterative method if possible.
My attempt at isolating b (applying the identity $\log(x + y) = \log x + \log(1 + y/x)$):
$$K = b^{c_1} + b^{c_2} + \dots$$
$$\log(K) = \lo... |
Def: the stability of algorithm is defined in case of the algorithm preserves same value elements while sorting as the following shows:
So for this QuickSort algorithm:
public class QuickSort {
public static int[] sortedData;
public static void sort(int[] data, int low, int high){
sortedData = data;
... |
When I look at the following algorithm, I believe I understand how bubble sort works.
procedure bubblesort
for i := 1 to n − 1
for j := 1 to n − i
if a[j] > a[j+1]
then
interchange a[j] and a[j+1]
endif
endfor
endfor
endprocedure
However I am ... |
I'm starting my masters in CS soon, and I have to decide on a general research topic.
In my undergraduate studies, I've enjoyed courses regarding data structures and algorithms the most. I'm also an avid competitor in competitive programming events, which involve a fair chunk of algorithms.
I've talked to multiple prof... |
Can an instance of the Post Correspondence Problem (PCP) have exactly one solution?
|
I have a simple program which achieves a certain functionality. I’m interested to know if it can be proven that the steps in the program are the theoretically simplest way to achieve those results. Is it an established practice in computer science to prove that an algorithm or program is the theoretically fastest way t... |
In $k$-sorting array algorithms, every element is supposed to be $k$ positions from its correct positions. So with that in mind, if we used a randomized QuickSort, we will have $O(n\log{n})$. Now to prove a lower bound on this, we assume $k \le \frac n2$.
Question: Prove that you can not do better than $O(n\log n)$ on ... |
It seems like a lot of programming is about converting a high-level human intuition into a very precise, ordered set of steps and conditions for the computer to execute correctly. I think programming could match the way people think more if we could write instructions which refer back to previous parts of the program w... |
The language that accepts strings with the number of 0s being congruent with 1%3 and an even number of 1s over the alphabet {0, 1}.
|
I was wondering what books are there that give you nice overview of the computer science field.
I'm not interested so much on the details of the trees, but on the forest. I was thinking it would have to be something like a popular introductory book, preferably up to date.
I hope this question is within the forum's scop... |
Suppose that the language
$L_1$ reduces to the language $L_2$ in polynomial time, $L_1\leq_p L_2$. If $L_2$ is recursive enumerable then so is $L_1$, but why isn't $L_1$ recursive? Because $L_2$ is at least as hard as $L_1$, and so $L_1$ could be easier than $L_2$. Why isn't $L_1$ recursive? Explain with an example.
|
Do the following measures qualify as computational resources?
number of even-numbered states that the machine $M$ visits on input $x$
number of times that the machine $M$, when run on input $x$, rewrites symbols on the tape
|
I am dealing with a knapsack-like problem with one difference from the conventional problem: the “weights” can be positive or negative and the constraint is $\sum w_i x_i \ge 0$ instead of $\sum w_i x_i \le W$. The "values" can also be positive or negative.
Can this be transformed to a knapsack problem or is it some ot... |
Corollary:1 We know that if $A\leq_m^\mathsf{}B$ and $B$ is decidable then $A$ is also decidable.
This is because if there exists a specific algorithm for solving $B$ and we can also reduce $A$ to $B$ then we can have a solution of $A$ as well. Hence $A$ is decidable.
We know that regular languages is always decidable.... |
Given a tree with n nodes, Print all nodes which are the endpoint of the diameter.
1<= n <=100000.
E.g.
For Above tree answer would be A,B,F,G
I tried the O(n2) approach (Running Dfs from each node) but need a solution better than it.
|
Approach:1 To prove any unknown problem $B$ is NPH then take any known NPH problem $A$ (e.g. $3$-sat) which reduces to $R$ in polynomial time. If I take any instance example $I_1$ of $A$, then prepare another instance example
$I_2$ of $B$, and if $I_2$ can be solved in polynomial time then $I_1$ can be solved in polyn... |
Google has the article Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken. Which primarily discusses the overflow on the mid calculation. However, what I found interesting was the return value for when key is not found. Initially, I thought the negative indicates the value was not fo... |
this is the algorithm :
F() = {
count = 0
n = 1000
For i = 1 to n Do
If n Modulo i = 0 Then
count = count + 1
end if
end for
if count = 2 then
return prime
else return prime
}
So what i know is complexity of a loop is n and other than loop is some constant
so what i get is O(n)
but my teacher... |
Suppose we are given a graph $G$ of order $n$ and a black box that can efficiently (polynomial time) compute the chromatic number $\chi(G)$. I am curious to hear how would one go about in order to construct a proper coloring of $G$, more precisely
Find an efficient algorithm (polynomial time) to construct a proper col... |
For n-bit ALU is equal-to operation and similar comparisons generally limited to n/2-bit words, or n-bit?
|
I'm reading a book on Randomized Algorithms by Raghawan and Motwani and I don't understand the algebra/calculus of a step in the analysis of Karger's algorithm(Randomized min-cut).
They have the following:
$$Pr[\cap_{i=1}^{n-2} E_{i}] \geq \Pi_{i=1}^{n-2}(1-\frac{2}{n-i+1}) = \frac{2}{n(n-1)}$$
This part in particular... |
I have a directed graph with roughly 2000 nodes, and roughly 4000 edges. I have created an application so the people that use it can easily see the path drawn on a map, if they e.g. want to find the shortest path between two nodes. And this works as intended. However, this shortests path is based on the weights of each... |
I have been reading up on Boolean logic and, specifically, the Boolean satisfiability problem. I have seen several people mention that the expression must be converted to conjunctive normal form (CNF) before it can be solved. Why is this the case?
I understand that propositional formulae would be quite "chaotic" if not... |
I am looking for references and/or algorithms for generating 4-dimensional periodic triangulations on unit 4 lattices. That is, generating a space filling triangulation of the 4D integer lattice (Z^4) that is invariant under lattice translations. I have found references for 2D and 3D, but it is not clear to me how to g... |
At section 5.2 of 2000’s republication of 1974’s paper ‘Continuations: A Mathematical Semantics for Handling Full Jumps’ by Christopher Strachey and Christopher Wadsworth, the following denotational semantic equation is given (to show that the following block command is equivalent to the while-loop command $\textbf{whi... |
I have read (and re-read) the informal proof of The Halting Problem. Can we not make the same argument using only the Program, without the Input {e.g. H(P) rather than H(P, I)}? I am confused by the step where we pass the Program as the Input as well. This seems to be the key since all explanations mention this step... |
The proof that the Edmonds-Karp algorithm will require at most $O(|V||E|)$ uses the fact that when an augmenting path has critical edge $(u, v)$, $\delta_f(u)$ strictly increases. Therefore, that particular edge can only be critical at most $|V|$ times and the total number of augmenting paths until the max flow is at m... |
I was recently introduced to big O and big Omega, as well as big theta. I know that big O is the worse case scenario in terms of runtime, big Omega is the best case scenario, and big theta is in between. However, I'm still confused on how I would use it mathematically to prove that n log n = Ω(n). Also, I get that n0 i... |
Selecting the median as an approach for pivot selection halves the array into $T(\frac n3)$ and $T(\frac{2n}{3})$, so our $T(n)$ becomes:
$$T(n) = T(\frac{2n}{3})+ T(\frac n3)$$
Solution:
Approach 1: using master method, it's CASE 1 gives and upper bound:
$$
\begin{align}
T(n) = T(\frac{2n}{3})+ T(\frac n3) + O(n)\\
\... |
Why are Gene squencing file i.e FASTA files so compressible. It was stated on a site that few compression algorithms are capable of compressing these files to Gigabytes (from Terabytes).
And is it possible to convert binary data to FASTA file for high compression.
Is there any difference between algorithms used in c... |
I am implementing a UDP based go back n example and I am a bit stuck on how the server should respond to packets.
If my client has a sliding window of say 5, it can send 5 packets to the server without waiting, and any time it receives back an ack lower than its highest window value it will retransmit all packets from ... |
In the this discussion of Dijkstra's Algorithm appear the following comments:
# Nodes can get added to the priority queue multiple times. We only
# process a vertex the first time we remove it from the priority queue.
I'm curious as to under which circumstances a node would be added to the priority queue multiple time... |
SO According to question grammar should be like this (A -> AA ).
->So i learn that if grammar is left and right recursive both then that grammar must be ambiguous but here the answer is deferent. Plz explain me.....Thanks :)
|
I am trying to implement min-max heap structure
A min-max heap is a data structure that is identical to a binary heap, but the heap-order property is that for any node, X,
at even depth, the element stored at X is smaller than the parent but larger than the grandparent (where
this makes sense), and for any node X at od... |
I read order statistics from the book The Design and Analysis of Computer Algorithms", by Aho, Hopcroft, Ullman, Addison-Wesley
As per the algorithm the recurrence relation given
T(n)<= cn for n<=49 .....1
T(n)<= T(n/5) + T(3n/4) + cn for n>=50 .....2
How can I prove it by induction T(n)<= 20cn?
I have two more questio... |
In a lecture I'm taking about complexity theory a professor said, there are infinite many NP-complete problems.
Question:
I was wondering if there exists something like a database or a book with some known reductions (or with maybe more than only the NP-complete ones) and the proofs for them? I know there is a very ni... |
I am studying direct mapping in cache. I understood the concepts like dividing into blocks and lines , tag directory etc. When solving numerical problems of finding main memory size or tag directory size I have no problem. What I understood is that, in cache we have a tag associated with each cache line ( neglecting va... |
You are given an undirected graph (social network) in which each edge $e = (v, v')$ has an interval $I_e = [l_e, u_e]$ on it. The meaning is that you know that $v$ and $v'$
met at some point during the interval $I_e$, but have no idea when exactly. You also know that some source node $s$ started with some infectious di... |
Is it true that for a finite or a countably infinite hypothesis class $\mathcal{H}$, then it is going to be PAC-learnable (and vice-versa)? And what about if we change the cardinality of the hypothesis space to be an uncountably infinite? Does that mean it will not be PAC learnable?
Please correct me if I'm wrong, than... |
In 2005 ID software open source the game Quake 3 Arena. When they did it was discovered was an algorithm that was so ingenious and all it did was calculate the inverse of a square root.
The easy way to calculate the inverse of a square root being
float y = 1 / sqrt(x);
But then again this functionality has already bee... |
For a given undirected graph $G=(V,E)$ I'm trying to construct a boolean polynomially computable formula $\varphi$ with the following property: $\varphi$ is satisfiable $\iff$ vertices of $G$ can be colored in $3$ colors with the following condition: For any edge $(u, v)\in E$, if $u$ and $v$ have different colors, the... |
I still have some doubts for finding the VC-dimension. Suppose $\mathcal{H}$ has VC-dimension $n$. This is the process of how I think about it: (1) Show that there is a set of $n$ points that can be shattered by $\mathcal{H}$; and (2) No set of $(n+1)$ points is shattered by $\mathcal{H}$. For (2), I just gotta show th... |
Given two strings $s, t$, I would liketo find a maximal subsequence of $t$ (denoted as $t'$), such that the concatenation of $t'$ with its reverse ($t'_R$), is a palindromic substring of $s$.
I thought to use dynamic programing to solve this question, but I'm not sure how to use it and how to define the recurrence func... |
LOC = lines of code
KLOC = Thousand lines of code
Fault (or defect) density = number of reported bugs per line of code.
Software artifact = function, class, module
Reading research papers on fault density and fault prediction, it seems a bit hard to get an overview, because there are lots of studies, and lots of differ... |
My question is about the article Sub-Linear Memory: How to Make Performers SLiM.
It is written in the article "our algorithm is compatible with distillation (Sanh et al., 2020)".
Now I would like to know if SLiM is compatible with parameter sharing...
Is SLiM compatible with ALBERT and with ELBERT?
P.S. I am asking thi... |
In the proof of the Time Hierarchy Theorem, Arora and Barak writes:
Consider the following Turing Machine $D$: “On input $x$, run for $|x|^{1.4}$ steps the Universal TM $U$ of Theorem 1.6 to simulate the execution of $M_x$ on $x$. If $M_x$ outputs an answer in this time, namely, $M_x(x)\in \{0,1\}$ then output the oppo... |
My question is about the article One Loss for All Deep Hashing with a Single Cosine Similarity based Learning Objective.
I would like to know how to solve the out-of-sample problem: given a new code how to find its corresponding orthogonal target?
Tell me the time complexity how many ms the algorithm demands for solvin... |
What device integrates and coordinates all the data from millions of CPUs/cores in a supercomputer? To call these cores CPUs (Central Processing Unit) seems wrong when they are not central at all but comprised of millions of units. Isn't there one processing unit or device that is truly at the center? I have Googled th... |
Given an integer number $n$ (in base 10) and a base $b$, determine whether the representation of $n$ in base $b$, $(n)_b$ has a coefficient with value of $b-1$.
Examples
- n=21914, b=6
(21914)6 = 245242 => we have b-1=5 in the representation of (n)b
- n=50673, b=9
(50673)9 = 76453 => we don't have b-1=8 in the represen... |
What is the average number of comparisons performed when sorting 3 items?
The question is based on the above picture.
|
The Kleinberg and Tardos Algorithm makes the following claim without proof:
Any algorithm that builds a spanning tree by repeatedly including edges when justified by the Cut Property and deleting edges when justified by the Cycle property - in any order at all - will end up with a minimum spanning tree.
Is there any ... |
Show the the following language is $\Sigma_3$-complete:
$$ \mathrm{REG} = \{ \langle M \rangle \mid L(M) \text{ is regular}\}. $$
Using the quantifier method I figured out that REG is in $\Sigma_3$, but how do I prove that it is $\Sigma_3$-hard?
|
A computational problem is said to be in the class $NC^K$, if the result $f(x)$ can be computed in time $O((\log |x|)^k )$ on a multi-processor computer, while the total number of operations remain polynomial in the input size $|x|$, i.e. number of bits in $x$. Show that counting the number of 1’s in a binary word $x \... |
I'd like to create a function decode(x : string) such that decode(x : string) == decode(decode(x : string)).
I believe I can think of how to do this with reserve chars. Is that my only option?
I'm not much of a theory guy. But, I think essentially what I need to do is represent a structure that is idempotent on substit... |
Assuming the 'hardness' of any possible input instance with $N$ elements (of any bit length) for the subset sum problem could be represented as $H \in \{0,0.000001,0.000002 \dots, 1 \}$, being ${0}$ those instances considered the most "easy" or "tractable" and ${1}$ those instances considered the "hardest" or "intracta... |
I have the following problem:
Suppose that we have several points that cover some cities, with a cost associated to each point. This can be represented as a grid:
c1 c2 c3 c4 c5 cost
p1 1 0 1 0 1 200
p2 1 1 1 0 0 100
p3 0 1 0 1 1 300
...
etc. Where $c_n$ represents a city, and $p_m$ a poi... |
I have two arrays A and B of the same length n. I am looking to swap such that all the elements of array A are less than each element of B. Elements in A and B can be unsorted.
Example Inputs: A = [2,5,1,8], B = [9,3,6,10]
Expected Outputs: A = [2,5,1,3], B = [9,8,6,10]
I solved using brute force way that takes O(n^2) ... |
I know that,
0* generates, NULL, 0, 00, 000, 0000, ... and so on.
But how does (0*)* actually work? Does it generate even length 0's?
Like this, NULL, 00, 0000, 000000...
or it generates strings same as first expression? What I thought is that if it has 2 star means, that it will multiply any string inside, regardless ... |
Given an an table that contains products I am selling with the dates, and given a table that contains the possible work orders with each work order, arrange the work orders such that all items are filled. (assume a starting stock of 0)
What I can produce per day:
Item1
30
Item2
20
Item3
25
Sales Orders:
... |
Suppose $A = \{0^{n}1^{n} \mid n \ge0\}$, which is not regular, and let $B$ be a finite subset of $\Sigma^* \setminus A$. Is $A \cup B$ regular?
|
We know that any languages $\subseteq\\\\$ $\Sigma^{*}.$ Because any language collection of string over alphabet. And we know that set of all languages is $2^{\Sigma^{*}}$ which doesn't $\subsetneq\\\\$ $\Sigma^{*}.$ But I have couple of smalls confusion are that
$A.$ Set of all regular languages $\{L_1,L_2,L_3.......... |
While I have come to learn some computer science, I find that I have next to no knowledge on computer networks.
Are there any good books at a basic level that cover some of the fundamental topics? Ideally something that doesn't overwhelm a newcomer and provides a good jumping-off point to get started with.
If it helps,... |
I am trying to solve this recurrence with substitution method. I guess $T(n) = \Theta(n \log n)$ (with Master Theoreme). Can someone show me how to demonstrate the upper bound $T(n) = O(n \log n)$?
|
Before starting, I want to say that I understand time complexity, and I understand how a hash table is considered O(1) vs an array having a time comp. of O(N) in terms of what you learn. What I don't understand is why looking up something in a hash table is not O(N).
Surely, just because you know the key, you still hav... |
A colleague recently brought up this argument when we were talking about big-O runtime analysis and I've been unable to find why it is incorrect:
Informally, the argument goes like this:
"If the runtime of all logarithms of any base are supposed to be
equivalent, there is nothing that keeps us from saying $O(\log x) \... |
I have tried to solve and understand LeetCode question "297. Serialize and Deserialize Binary Tree", and after I read their solution I came up with a question that I will be glad If you can help me to understand. First of all, two binary trees with different structures can have the same preorder result and that is the ... |
I do not have too much background in complexity theory, so please feel free to let know if my question is ill defined.
My question is, does $\mathcal{P}\neq \mathcal{NP}$ preclude the possibility that an NPC problem could have polynomial time algorithms on almost any input?
I am thinking something along the lines of th... |
Pretty much the title. I watched a video talking about P vs NP and it mentioned that the event that sparked this entire debate was the fact that some exponential time problems were shown to be solvable in polynomial time. So here I am hunting for some examples so that I can dive deeper into how they were cleverly chang... |
In their book An introduction to the Analysis of Algorithms, Flajolet and Sedgewick analyze the number of compares performed by Mergesort along the following lines. They denote by $C_N$ the number of compares that Mergesort uses to sort $N$ elements, and come up with the recurrence relation
$$
C_N = C_{\lfloor N/2 \rfl... |
Given a binary square matrix of order $n$. Can the problem of finding the longest sequence of 1's (horizontal or vertical) be solved with recursion?
I know how to solve the problem without recursion by iterating over the columns and rows, but was wondering it there is a solution using recursion.
|
I would like to know if it's actually possible to encode a (binary) sequence with rotations in MILP/MIP.
Given a binary sequence $(0,1,1,0,0,0,0,1)$ and variables $x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7$
I want to restrict my MILP program such that it takes up one of the following:
\begin{align}
(x_0,x_1,x_2,x_3,x_4,x_5,x_6,x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.