instruction stringlengths 35 29.1k |
|---|
Why does the BOM consist of two bytes instead of one for example in encoding utf-16?
Information about the order of bytes can be easily saved on just one byte.
Is it because it would be good for the sum of coded bytes to be even?
|
This question is inspired by a recent (imo bad) TV show in German television.
Given two finite sets $A$ and $B$ of same size (representing two groups of people) and a bijective map $m \colon A \to B$ which is unknown (representing a matching).
We also define an oracle $o \colon (A \to B) \to \mathbb N$ which yields for... |
I heard concept of virtual memory is using disk to save temporary progress or data instruction (temporary data). About temporary data, it's main job of physical memory (RAM) so that's mean virtual memory is helping main job of physical memory.
Virtual memory work in software level and hardware level. Even though my maj... |
I have a list of $n$ disks in $\mathbb{R}^2$ with center and radius $(x_i, y_i, r_i)$. I also have $Q$ line segments $l_1, l_2, ..., l_Q$. I am interested in preprocessing the $n$ disks (or the line segments!), to answer the following query:
Given segment $l_k$, is there a point on $l_k$ not inside any disk?
There is a... |
I have researched this topic in the last time, but no usefull results for me. So I'm here and I please you to help me with the following problem:
What is $VCdim$($\mathcal{H}$), where $\mathcal{H}$ is the class of concentric circles centred in origin in the 2D plane?
|
I'm trying to compress unordered lists of a few thousand integers for transmission over HTTP, and Claude Shannon is disappointing me with his mathematical ambiguity :)
Each integer is 6-digits, so representing such a list naively, let's say we'll allocate a fixed 20 bits per integer, stored in whichever order they happ... |
In recursion theory, it is possible to diagonalize a computable function out of the class of primitive recursive functions. Can you do the same with context-sensitive languages? I was thinking we could use the LBA and the finite countable set of possible configurations to diagonalize a TM out of this set or something a... |
If $f(n) = 5n^2 + 3n + 7$ can be written as $\Theta(n^2)$, then how to write the following in $\Theta$-notation:
$$ \frac{6^n - 1000}{2^n + 1}. $$
|
I have two related questions:
Do you know of any good reference to the recursive function / lambda-calculus equivalence in terms of computability, including proofs?
Do you know of any reference to subclasses of computable layers in lambda-calculus, like you have in recursion theory? It looks like you can't "dumb down"... |
Suppose that we are given a key $k$ to search for in a hash table with positions $0, 1, \dots , m-1$, and suppose that we have a hash function $h$ mapping the key space into the set $\{0, 1, \dots , m-1 \}$. The search scheme is as follows:
Compute the value $i \gets h(k)$, and set $j \gets 0$.
Probe in position $i$ f... |
I am trying to understand hamming codes for single bit error correction. I understood all the things like hamming distance , k bit error detection and all basics for hamming codes. Also, I know the algorithm for error correction using hamming codes. I have read many answers from different stackexchange sites and also ... |
I started learning DSA recently and I came across the Dynamic Connectivity Problem. One of the listed real-world applications of the Dynamic Connectivity Problem is "pixels in digital photos." How do you apply it to photos? What is it used for?
I can understand its usage in a social network or a network of computers ... |
We say that a Turing machine is fragile, if it halts after changing the symbol of one of the tape cells for the third time. Is it true that every language that is solvable on a Turing machine will be solvable on a fragile Turing machine?
What can we say about Turing machines which stop after changing the symbol of one ... |
Suppose given an array $A[1..n^2]$ that contains positives real values. Also we have a black box that have two input numbers $a,b$ and return true or false, also i know that, for any input, the black box return true for at least one pair. The goal is, we find two vales $a,b\in A$ such that $a+b$ minimized also the bla... |
Currently studying the following paper:
"Fair Allocation in Online Markets" - Gollapudi and Panigrahi 2014
In which they present Theorem 2 as a hardness result for online maxmin matchings (without proof). My thinking for a counterexample which demonstrates that a random ordered stream can give an arbitrarily bad result... |
I have a random variable $X$ that can take finite values in $\{X_1, ..., X_n\}$ with probabilities $\{p_1,..., p_n\}$. Is there a computationally efficient way to sample a number from this set? My problem is that $n$ is very large $2^{1000}$. Also the distribution is quite arbitrary - not uniform or something nice.
Co... |
Given $n$ tuples $(k_i >0,a_i >0)$, is there any efficient algorithm that can dynamically track
$$
\max_{i=1,\cdots,n} \left\{k_i\left(\sum_{j=1}^n a_j\right) - a_i\right\}
$$
in response to online updates to $a_i$? (in $\text{poly}(\log n)$ complexity per update).
I do have an algorithm in mind, which sees $k_i$s as t... |
If there is a polynomial time algorithm for a decision problem $A$, which is m-reducible to 3SAT, and 3SAT is NP-complete, does this prove that P=NP?
|
As the title says: are there problems in $\mathbf{NP}$ that do not reduce in polynomial time to any problem in $\mathbf{NP}$?
|
For every edge $e\in E$ of a graph $G=(V,E)$ we know the union $U_{e}$ of the edges of all cliques that contain $e$.
Can we determine, in polynomial time, for a given edge $e_{0}\in E$, the size of the maximum clique that contains $e_{0}$?
|
I am going to design a Turing machine for doubling any words. My algorithm is such that for word X as input, the output will be in the form X@X which @ is a character. How can design an one-tape Turing machine that give exactly XX as its output? For example, X=abba, XX=abbaabba. Thank you in advance for consideration.
|
Given Graph $G=(V, E)$, where each edge in $E$ is assigned a "weight" as a set of elements. $w(e) = S_e \ \forall e \in E$.
Find a subset $E' \subset E$ such that it spans $G$, i.e., $E'$ connects all pairs of nodes $n_1, n_2 \in V$ through some path, such that its "total weight", the size of the union of all of its me... |
so I was wondering how to know the sequence a Turing machine T computes?
We are reading The Annotated Turing by Charles Petzold at the moment which includes Turing's original paper "On Computable Numbers, with an Application to the Entscheidungsproblem" and adds explanations.
As far as I understand we are looking at ci... |
The graphing calculator Desmos has a ton of functions, and can express any arithmetric formula. What I want to know is, is it Turing-Complete?
Desmos supports, among other things:
Most mathematical operations / functions
Multiplication, addition, subtraction, division, modulo, etc
Sum and product
Integration and diff... |
In Skiena, S.: The Algorithm Design Manual 3rd Ed., Exercise 3.2 reads as follows
Give an algorithm that takes a string $S$ consisting of opening and closing parentheses, say )()(())()()))())))(, and finds the length of the longest balanced parentheses in $S$, which is 12 in the example above.
(Hint: The solution is n... |
I saw the following question online:
Init - Initlize data structure in O(1).
Insert(s) - Add string s to your Data Structure in O(|s|).
Remove(s) - Remove string s from your Data Structure in O(|s|).
PrefixExists(s) - return True if there exists 2 different strings s1,s2 (different from each other) such that s is a pre... |
Where I can find formal proof of there exists an equivalent parse tree for each derivation? There is a lot of informal proof of equivalency on the internet but I need formal proof to reference it in a paper.
|
Recently, I had an idea of a novel Deep RL algorithm that might perform better than existing algorithms such as DQN, TRPO, PPO, etc.
However, I do not know of a website or a research paper that might gather/present the performance of all existing Deep RL algorithms on a set of known environments.
So my question is, is ... |
Which one should be faster? I have written a script comparing both run time, initially the implementation with adjacency list and minimum heap performs faster, but as the number of nodes/edges increases, it seems the latter perform faster
Is this result expected?
|
{w | w does not contain the substring 11}
What I am thinking: $(0^* 1 0^* )^*$
Is anything wrong with my expression?
Thanks in advance for your help!
|
I'm dealing with a directed acyclic graph representing calculation steps. Imagine it as something like a big excel spreadsheet, where each cell is a node in the graph.
A node (cell) can have an arbitrary number of precendents/parents, and an arbitrary number of dependents/child nodes
The graph is recalculated in cycl... |
If we have an sorted skiplist how can we count the occurences if it is sorted on a effective way?
Occurence of the same element in the skiplist?
|
I recall reading about a data structure for sequences where writes in the same area are faster due to some kind of caching or structure manipulation. What are some structures that do this? I know a gap buffer is one of them (kind of), but are there any others?
|
This question has already been asked, but I still cannot understand how the substitution makes sense in the recurrence equation $$T(n)=2T(\sqrt{n})+1$$
Following the logic:
Substitute $n$ for $2^m$. This yields the equation:
$$
T(2^m)=2T(\sqrt{2^m})+1=2T(2^{m/2})+1 \\
\text{where } n = 2^m,\ m=\log_2 n
$$
Great, this... |
I am currently a Ph.D. student in the computer science department, I was given the subject of Deep RL for Healthcare. However, after lots of research on the internet, I could not find any free dataset or environment to develop/test my algorithms against. It seems that till now, RL and Deep RL is still focused on games ... |
Following this latest and very exciting research object I can't find till now a usable computer. By computer I understand a definitive switchable Hardware.
I would like to call actual "quantum computing" by the topic "researching of quantum elements for computing". Till now I found only expensive and complex quantum ci... |
I have a DAG that admits many possible topological sorts. I want to construct one that has the minimum maximum distance between a node and its neighbours in an array storing the nodes in sorted order.
Does this problem have a name that I can search (minimum maximum distance topological sort didn't turn up anything)?
(I... |
I was shown this problem from a class last year and I am still not sure what the right answer is.
Items that occur with high frequency in a dataset are sometimes called heavy hitters. Accordingly, let us define the HEAVY-HITTERS problem, with real parameter $\varepsilon>0$, as follows. The input is a stream $\sigma$. L... |
We all know that the worst case complexity for comparison sort is in $\Omega(n\log(n))$, but who was the first to publish this?
Everywhere I look, people have their own proofs but no reference to the original. A lot of them talk about Shannon Entropy which was published in 1948.
|
I'm reading a paper about O(1) median filtering. I'm confused how histograms, denoted H, have the properties described. How can histograms be implemented such that: summing histograms, H(A ∪ B) = H(A) + H(B), is a O(1) operation with respect to the number of accumulated [points]?
|
Given a set of numbers, S {s1, s2, ... sn} and a value T, I am looking to determine if any three elements in the set add up to value T. It is valid to have repeats like 2+2+2 would be fine for achieving a goal value of T=6.
This is ultimately a decision problem of whether such a trio of values exists within the set tha... |
As CLRS book,page 260 stated,
Thus, the total time required for a successful search is $\Theta{\left(2+\alpha/2-\alpha/2n\right)}=\Theta{(1+\alpha)}$
I wouldn't have any problem if the author says the bound is eventually $\Theta{(2+\alpha/2-\alpha/2n)}$ or even $\Theta{(1+\alpha(1-\frac{1}{n}))}$. What kind of logics... |
Is it correct to talk about shortest path in a tree, isn't a tree has only single path between any two nodes ?
|
I am wondering if there exists an example attribute grammar that is non-circular but not l-ordered (l-ORD) as well.
The reason I am asking this is one can find an attribute grammar that is circular, then it will obviously not be an l-ORD. But I am wondering if there even exists a non-circular AG that is also not l-ORD.... |
I have a function that needs to be represented in theta form.
The below is my answer.
But the correct answer is (n.2^n)
Can someone please explain me how??
|
Let's have a static function f(n) which for a given n returns only these answers "lower" or "higher" comparing against an imaginary number x
In a sorted list l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
It is obvious that using binary search we can find the position of the element in O'lo... |
In problems like the 15 Tile Problem or Larry's Array problem, we use inversions in the array as a method to solve.
But what's the principle behind this method and how do I know when to use inversions?
|
The object I am studying is a bit more complicated than a bidimensional function, but I think I can explain what I need better with a simplified example. I can provide more details if asked.
So imagine I have a function of two variables with real output, $f(x,y)$, and I know that, $f(x_0, y_0) = 0$. Now I also know tha... |
My doubt is related to the given SPOJ problem:
Farmer John has built a new long barn, with N (2 <= N <= 100,000)
stalls. The stalls are located along a straight line at positions
x1,...,xN (0 <= xi <= 1,000,000,000).
His C (2 <= C <= N) cows don't like this barn layout and become
aggressive towards each other once put... |
The book CLRS claims these statements before introducing the topic of universal hashing:
If a malicious adversary chooses the keys to be hashed by some fixed hash function,
then the adversary can choose n keys that all hash to the same slot, yielding an average retrieval time of $\Theta(n)$. Any fixed hash function is ... |
I have this question from CLRS book please.
Question: The square of a directed graph $G=\left< V, E\right>$ is the graph $G=\left< V, E^2\right>$ such that $(u,w) \in E^2 $ iff for some $v \in V$, both $(u,v) \in E$ and $(v,w) \in E$. That is $G$ contains a path with EXACTLY two edges between $u$ and $w$. Describe... |
How is a homeomorphic embedding (in the sense of term algebra) a homeomorphism?
Definition of homeomorphic embedding:
Alt text:
Homeomorphic embedding = `<|` =def
-------- Variable
x <| y
s <| t_i for some i
--------------------------- Driving
s <| sigma (t_i,..., t_n)
s1 <| t1,..., s_n <| t_n
------------------... |
I do have some intuition(although I would like to be corrected) regarding why $NL!=Dtime(n^{log n})$ as for some $L \in Dtime(n^{log n})$ it might be required for the TM deciding it to read inputs of size $O(n^{log n})$ which isn't possible in logarithmic space constraints. Having an oracle access surely saves a lot of... |
Q. Given two arrays, $A$ and $B$, of equal length, find the largest possible contiguous subset of indices $[i,j]$ such that $\max(A[i: j]) < \min(B[i: j])$.
Example: $A = [10, 21, 5, 1, 3], B = [3, 1, 4, 23, 56]$.
Explanation: $A[4] = 1, A[5] = 3$, $B[4] = 23, B[5] = 56$, $\max(A[4], A[5]) < \min(B[4], B[5])$.
The indi... |
Given an undirected graph $G(V, E)$, two vertices $u$ and $v$ and a natural number $k$, does a path of at least length $k$ exists between these two vertices?
How can we solve this problem? I think maybe that it's in $NPC$ with a reduction of HamiltonPath but I'm not sure.
|
In Bubble sort, the number of swaps/comparisons is equal to the number of inversions.
1st pass it will do (n -1) comparison
2nd pass it will do (n-2) comparison....so on
(n-1)n = n^2 - n
Worst case of bubble sort is theta(n^2)
How is the number of inversions theta(n^2) too??
please explain the logic behind this
|
I would like to discuss a solution with you below please.
Describing the matrix product $BB^T$ of the incidence matrix of a directed graph $G=\left< V,E \right>$.
Question: The incidence matrix of a directed graph $G=\langle V,E \rangle$ with no self-loops is a $|V| \times |E|$ matrix $B=(b_{ij})$ such that,
$$
b_{ij}=... |
Really confused about the meaning of offset in email headers.
Header date reads as:
Sat, 8 Jun 2019 11:45:15 −0500
Does the time shown 11:45:15 is the actual time at timezone -0500
OR
Actual time at time zone -0500 is calculated by subtracting offset??
Thanks.
|
If the worst case arrays {5 4 3 2 1} have number of inversions as Θ(n^2) => n(n-1)/2 swaps
The best case arrays {1 2 3 4 5} have number of inversions 0(no swap)
What kind of arrays have number of inversions Θ(n)?
{2 1 3 4 5} can this be an array with number of inversions Θ(n) as there will be only 1 swap.
|
This looks to me as some tweaking or generalization of Ladner's result on NP-I languages, can some help me in the right direction? or redirect me to some sources where this generalization is explicitly proven?
|
I would like to know what determines bus speed in a CPU. I know about bus width, that all makes sense, but since electrical pulses travel at light speed I don't understand why bus speed is measured rather than just light speed. What on the bus means the signals aren't sent at light speed?
Thanks in advance.
|
Having a matrix $M$, with unique rows, how to calculate a minimal subset of colums $D$ such that every row is unique? Also, how to maximize the amount of unique rows, if the number of chosen columns is limited?
For example:
$M$ =
0 0 0 0 0 1
0 0 0 0 0 2
0 0 0 1 0 0
0 0 0 2 0 0
$D$ (columns {4, 6} from $M$) =
0 1
0 2
1... |
From what I understand, in a pipelined CPU, every stage takes 1 cycle. But instructions are fetched from memory which takes up to ~150 cycles. The CPU fetches most instructions from the L1-cache, but I've read that it takes around 4 cycles. From that logic, a new instruction should only start every 4th cycle, which obv... |
I am reading Distributed Algorithms by Nancy Lynch. In chapter 16, I came across the pipe symbol. Does this mean the same as "or" in some programming languages or could someone explain that line please?
|
This was the algorithm for bubble sort in textbook.
I tried the with WHILE loop, then I tried the same with the for loop. My answer is not sorted. Why? I follow the above algorithm in Python 3.0.
My attempt
Step1: I created a swap() function. it was working perfectly.
Step2: I made bubble_sort() function following th... |
The definition given below is present in the exercise of the text Database System Concepts by Korth et. al.
Let $\alpha$ and $\beta$ be sets of attributes such that $\alpha \rightarrow \beta$ holds, but $\beta \rightarrow \alpha$ does not hold. Let $A$ be an attribute that is not in $\alpha$, is not in $\beta$, and fo... |
Let $A\leq_P B$ mean that the language $A$ is polynomial time reducible to $B$. It is a theorem that $A\leq_P B$ and $B\in \text{P}$ then $A\in \text{P}$.
My question is, if $A\leq_P B$ and $B\in \text{NP}$, is $A\in \text{NP}$? What if $B$ is $\text{NP}$-complete?
|
An array with bubblesort time $\Theta(n)$ is nothing but a sorted array like:
A = 1 2 3 4 5
No swaps are done so only $n - 1$ comparisons.
An array with insertionsort run time $\Theta(n^2)$ is a reverse sorted array: A = 5 4 3 2 1
Each element is swapped in every iteration.
There cannot be any array that can have I... |
Let's say there is a sender sending messages with commands to a recipient.
The sender knows a set of commands but doesn't know anything about the recipient. A command is simply an opaque uniform random 128-bit string. E.g., the sender might know these commands and what they do:
(1) 0x'BC04672BCEB7AEE08E555599F051F1CF... |
Suppose, I have a 4-bit binary Incrementor that uses XOR gates to increment the inputted number by the value of 1 (b0001, to be precise).
Suppose, we connect it to 4 D-Flip-Flops (DFF) to create a counter that goes up every time we send the clock pulse. This is straightforward: Just connect the outputs of DFFs to the c... |
I would like to discuss resizing strategies for arrays please. If you have an array of $k$ initial size and it gets full, so you would like to choose from one of the following approaches:
Approach 1: if array get full, then we resize the array by $k$ constant.
Approach 2: if array get full, then we resize the array by ... |
Subject pretty much says it all. My strong impression is that for any algorithm and any choice of programming language or computational model, if it's Turing-complete, then there must be infinitely many ways to implement the algorithm such that a fixed interpreter for the language will necessarily return the same outp... |
Let's say I have a file which is exactly 1 MB in size.
Contents of file are :
0001001000... upto 128 bytes (128 bytes per line in file).
If I sort it in ascending or descending order (using notepad++):
Line 1: 0000000....
Line 2: 0000001.... and more.
Now if I compress it I get a 110 to 120 KB file.
I want to kn... |
If we want to detect and odd cycle if an undirected graph $G=<V,E>$. Suppose we run BFS algorithm from CLRS book as follows,
Q: Now my question is suppose we have the following graphs:
The figure to the left above:
$d[v] \bmod{2} == d[u] \bmod{2}$ equal and gives odd cycle.
$d[v] \bmod{2} == d[a] \bmod{2}$ not equal... |
What are all the functions $f:\{0,1\}^n\rightarrow\{0,1\}$ that can be expressed as a product of affine Boolean functions? For example, if $x_1,x_2,x_3\in\{0,1\}$ then $x_1x_2x_3\oplus x_2x_3 \oplus x_2=(x_1\oplus x_2)(x_1\oplus 1)(x_3\oplus 1)$. Here $\oplus$ denotes the XOR operation.
I would guess that not any funct... |
Consider a variant of interval scheduling except now the intervals are arcs on a circle. The goal is to find the maximum number of arcs that do not overlap. Let $C$ be the circle
on the plane centered at the origin with unit radius. Let $A_1, ..., A_n$ be a collection of arcs on the circle where an arc $A_i$ is specifi... |
I understand what $O(f(x))$ means... $O(f(x))=\{g(x): g(x) ≤ cf(x), c,x_0>0 \}$. But I can't find a clear explanation on the meaning of: $f(O(x)).$ Can you explain the exact definition of this? When does $f(O(x))=O(f(x))$? Can you provide examples of when this holds and say why?
|
In this article about FFT the author used FFT on this polynomial.
$A(x) = 3+2x+3x^2+4x^3$
Using $ A(x)= Aeven(x^2) + xAodd(x^2)$ the author determined the following for $Aeven(x)$ and $Aodd(x)$
$ Aeven(x) = 3+3x$
$ Aodd(x) = 2+4x $
How were $Aeven(x)$ and $Aodd(x)$ determined? Shouldn't $Aeven(x) = 3+3x^2$ and $Aodd(x)... |
In phrasing an information model for consumption-optimized RDF-like data (full context at 1 for the curious), I'm looking for any established term for X as used here:
Given is a directed rooted graph. An X is a (finite) sequence of edges, which go down the tree and then jump up again to a point where they've been just... |
Must a partial halt decider be a pure function of its inputs?
A partial halt decider correctly decides the halt status of some of its inputs.
I am trying to write C code that would be acceptable to computer scientists in the field of the theory of computation.
In computer programming, a pure function is a function that... |
I'm not too familiar with minimum cost flows, so please bear with me. I need to calculate the minimum cost flow for a network that looks like this:
(The numbers in parentheses next to nodes indicate supply, and the numbers on the arcs indicate the capacity and cost of that arc.)
There are essentially $\binom{4}{2} = 6... |
You are given a string S initially and some Q queries. For each query you will have 2 integers L and R. For each query, you have to perform the following operations:
Arrange the letters from L to R inclusive to make a Palindrome. If you can form many such palindromes, then take the one that is lexicographically minimum... |
While reading the text Modern Compiler Implementation in C by Andrew Appel I came across the hierarchy of grammar given below.
The above diagram is very helpful in understanding the correlation among the various parser grammars. All the grammar above are context free grammars. From theory of computation texts, I have ... |
Given following program:
while n > 0 do
for i = 1 to n do
print '*'
n = n / 2
where $/$ is integer division as usual. We want to calculate exactly how many * are printed. By summing up $n+n/2+n/4+...+n/2^{\lfloor\log_2n\rfloor}$ we get $2n-1$ but only if $n$ is a perfect power of $2$. In this case we ca... |
The given problem is from CLRS, exercise 4.3-2.
Show that the solution of T(n)=T(⌈n/2⌉)+1=O(log(n))
I decided to prove T(n) ≤ clog(n) and this is the result I got:
T(n)≤clog(n/2)+1
= clog(n)-clog(2)+1
= clog(n)-c+1
≤ clog(n)
From my understanding of how the substitution method and induction works is that, clog(n)-c+... |
Here the probability of frame being lost is $P.$ So the probability of frame reaching safely would be $(1-P).$
Now lets consider that the frame will reach safely in $k$-th transmission. That means that the frame being lost $k-1$ times and reached in $k$-th time with probability $(1-P).$ Now a frame requires $k$-transmi... |
I was reading SICP and was solving a problem that asked to create a function in lisp for finding elements of Pascal's triangle.
The way I went about it is to take input as the row number and then print each element of the row iteratively, whose value would be found recursively.
(define (pascDisp n)
(define i 1)... |
I have an array A with n elements. I am trying to write an efficient algorithm to find the index of elements that matches condition A[j-1]>=A[j]<=A[j+1].
Example:
A = [12,11,9,7,5,54,67,87,23,54,20,22]
Should return 4 because subarray [7,5,54] matches the condition where A[4] = 5.
Below is the solution I tried. It has... |
I admit I didn't know much before what a Map is living with just the terminology Hash Tables, even when I first Google it I found this
https://www.mathworks.com/help/matlab/matlab_prog/overview-of-the-map-data-structure.html#:~:text=A%20Map%20is%20a%20type,indexing%20into%20its%20individual%20elements.&text=These%20key... |
The question is basically in the title. I know that a computers hardware is of course some physical object, where as the interpreter is some abstract thing that does something abstract with the code it is given. Yet, can we say that the way the processor is build is the implementation of an interpreter?
Machine languag... |
The following commentator writes:
Monads are a unification of a bunch of computer stuff, including sequencing, IO, non-determinism, state, concurrency and exceptions. When I say "unification", I mean it in the sense that Newton's theory of gravity unified the motion of the planets with a falling apple (previously they... |
Based on theory, the implementation using adjacency matrix has a time complexity of E+V^2 and the implementation using min heap has a time complexity of (E+V)logV where E is the number of edges and V is the number of vertices.
When E>>V, such as for a complete graph the time complexity would be V^2 and (V^2)logV. This ... |
I have $f(n) = O(g(n))$ and $g(n) = O(h(n))$.
Is $h(n) = \Omega(f(n))$ true, and if so, what constants would make it true?
I was thinking that since $f(n) = O(g(n))$ and $g(n) = O(h(n))$ are true, then $f(n) = O(h(n))$.
I can state $h(n) = \Omega(O(h(n)))$ but I don't know what to do from here. Any pointers?
|
Let $L$ be defined as follows:
$\small L = \{(\phi, k) \mid \phi \in SAT \mbox{ and there is a satisfying assignment for $\phi$ having exactly $k$ true variables} \}$
I am struggling to show that $SAT\leq_{p} L$, I can't figure what $k$ should be and how to reconstruct $\phi$.
|
The number of ways in which the numbers $1,2,3,4,5,6,7$ can be inserted in an empty binary search tree, such that the resulting tree has height 5, is _________.
Note: The height of a tree with a single node is 0.
What I have tried:
Since It has height=5, we have 4 options for root $1,2,6,or$ $7$. One element will be al... |
Using the Boltzmann selection in genetic algorithms, the probability of visiting a point in optimization space $X_j$
is
$p(X_j)=\frac{\exp\frac{-f(X_j)}{T}}{\sum_i \exp \frac{-f(X_i)}{T}}$
my question is: how do we set the initial temperature T?
|
To what extent is the MAP data type implementation language dependant???
If we know that C++ implements maps as Red Black Trees, unordered maps as hash tables,
How C++ and alike maps are actually stored in memory?
what about other languages?
Go as an example?
|
As far as I know, the admissability of a path-system is an example of a P-complete problem.
However, I am not sure under which kind of reductions (many-one or turing-reductions? logspace or AC$^0$ reductions ... ?).
Can anyone explain me under which reductions are Path-systems P-complete, please?
|
I know from the book by Neapolitan that for any algorithm input size is defined as the number of bits to encode the input. In graph algorithms, the input size is defined as $|V(G)| + |E(G)|$ for the input graph $G$. On the other hand, we save graphs in computers by their either adjacency lists or adjacency matrices whi... |
Problem 1
Let $G(V,E)$ be a directed graph. Let $T \subseteq V$ be a subset of vertices called terminals. Find a subgraph $H$ of $G$, such that $T \subseteq V(H)$, $H$ is a strongly connected component and the number of edges in $H$ is minimized. Here $V(H)$ stands for the set of vertices of $H$.
Problem 2
Everything ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.