instruction stringlengths 35 29.1k |
|---|
There exist greedy algorithms for vertex coloring like optimization problems. We know that for graph coloring, there is an order of vertices for which greedy coloring produces the optimum results. Is it true for any problem on graph which has such a greedy algorithm.
|
I am interested in knowing the Chomsky hierarchy of a particular computation model. Also, I would like to know if it is equivalent to Finite State Machine or is Turing complete.
This computation model is called marbles and circles. For this model, the variables take a constant word size w which matches the problem. A ... |
Show if $L = \{a^mb^nc^n \mid m,n \geq 0\} \cup \{b,c\}^*$ is regular or not.
My attempt:
I think the Pumping lemma won't work in that constellation, so I'm working with "The intersection of regular languages is regular".
Assuming $L$ is regular. I already know that $S=\{ab^* c^*\}$ is regular. I'll now look at the int... |
Consider a directed acyclic graph (DAG) of topics and links. Apart from the root topic, topics are situated under one or more parent topics, and links, as well, are situated under one or more parent topics. Now imagine that the DAG changes over time as users add, remove and update link and topic relationships and met... |
As the title suggests, I am curious whether Linear Discriminant Method can be performed on a dataset as pre-processing before putting the reduced-dimensional data as input for a neural network for creating the mapping function/ surrogate model.
Thanks!
|
We are given a flow network and two nodes $u$ and $v$. We want to create an algorithm that tells us whether or not there is a minimum s-t cut so that $u$ belongs to the same side of the cut as the source node $s$ and $v$ belongs to the same side of the cut as the sink node $t$.
My initial idea was to run Ford-Fulkerson... |
Say I have a circle of a fixed radius, with overlapping arc intervals along its edge. I want to return a minimum set of Points which intersects all arcs in $n^2$ time.
I'm having some trouble proving that my algorithm works. I'm getting caught up with arc intervals that span $0,2\pi$.
For example I have the intervals (... |
We are trying to find height of following recursion formula in terms of $n,k$:
\begin{gather*}
T(n,k)=T(\frac{n}{2},k)+T(n,\frac{k}{4})+nk
\end{gather*}
\begin{gather*}
T(n,1)=T(1,k)=O(1)
\end{gather*}
I read this link , and this post, but i think neither of answers are true.
|
I was task to describe this regular expression a* (ba (cf* (g ( f +h )* bf* )* e )* a)* informally.
My attempt at describing it informally = any number of a followed by any number of one b one a with any number of one c and any number of f with any number of one g with any number of f or h one b and any number ... |
T(n)=T(n/2)+log log(n)--------1
T(n)=T(n/4)+log log(n/2)+log log(n)-------------2
T(n)=T(n/8)+log log(n/4)+log log(n/2)+log log(n)-----------3
T(n)=T(n/2k)+log log(n/k)+....+log log(n/2)+log log(n)
T(n)=1+log log(n/k)+....+log log(n/2)+log log(n)
n/2k=1 => n=2k
T(n)=1+log log(2K/k)+....+log log(n/2)+log log(n)
T(n)=... |
\begin{gather*}
T(n)=T(\frac{n}{\log n})+O(1)
\end{gather*}
\begin{gather*}
T(1)=O(1)
\end{gather*}
I try to use substitution method to solve $T(n)$, but because of $\log n$ get stuck. Can we use substitution method for solving $T(n)$?
My attempt:
One step of my extending of $T(n)$:
\begin{gather*}
T(n)=T(\frac{n}{\... |
how can I know what are the recursive calls of this algorithm ?
in line two there are 2 recursive calls and I don't know how to write this as T(n) for the Recurrence relation.
Here is the algorithm :
|
Given a binary search tree $T$, we insert $n$ elements, but when the size of tree become doubled then we balance the tree. for example if we insert $2^{k-1}$ element then when the size become to $2^k$ then we balance $T$. what is time complexity insert $n$ items in such tree?
I think be $O(n)$, but when i want draw a ... |
I have a question regarding the methodology of Huffman coding. So, is there a Huffman coding methodology that approximates the minimum average number of bits per decimal character when the odds of information symbols are not powers of 2? I can't understand or find anything relevant
|
Assuming we have a fixed set of line segments $S$ such that any two segments are either disjoint or have a common endpoint.
A query would look like this; given a query point $q$ shoot 4 rays from $q$ (both sides horizontally and both sides vertically) and report the line segment in $S$ closest to $q$ intersecting any o... |
I came across interactive proofs and randomized computation, in particular, i read about the complexity classes $\text{IP}, \text{BPP}, \text{RP}$, etc.
Since the above classes are well-known, I will give a hand-wavy definition of $\text{IP}$. Then, I will state my question. Roughly speaking, a language $L \in \text{IP... |
I'm currently reading a paper on First-order definable languages by Volker Diekert and Paul Gastin.
Im having trouble understanding a part of the proof for lemma 3.2 (splitting lemma).
The part I'm having a problem with, is about the complement:
(Note: I've substituted $B^\infty = B^* \cup B^\omega$ with $B^*$ which sh... |
The $k$-center problem is where we a given a graph $G(V,E)$, an integer $k$, a distance metric $d$ and we want to find a subset $C\subseteq V$ (such that $|C|\leq k$) which minimizes the following function: $\max_{v\in V}\min_{c\in C}d(v,c)$.
I am trying to understand the proof that the $Gon$ algorithm is a 2-approxima... |
I'm looking for a data structure that supports efficient:
Insertion of arbitrary integers.
Value lookup (given a particular value needle, return true if it's currently in the structure).
Removal of all values below a given threshold integer.
I suspect this can be with a self-balancing BST, with insertion and lookup b... |
My professor has said that the average depth of all possible binary trees which can be formed with $n$ nodes would be $O(\sqrt n)$ and has assigned the proof of this as homework. How do I approach this problem?
|
I am reading about P and NP and looking at the reduction of a Rudrata/Hamiltonian path to a Rudrata cycle. I think adding an extra node and 2 edges connecting the start, s and the target, t is O(1) time as this doesn't depend on the size of the graph. Algorithms by Dasgupta et al. says that the pre and post processing ... |
I am reading about P and NP and looking at the reduction of a Rudrata/Hamiltonian path to a Rudrata cycle. I think adding an extra node and 2 edges connecting the start, s and the target, t is O(1) time as this doesn't depend on the size of the graph. Algorithms by Dasgupta et al. says that the pre and post processing ... |
The number of Dyck paths (paths on a 2-d discrete grid where we can go up and down in discrete steps that don't cross the y=0 line) where we take $n$ steps up and $n$ steps down follows the Catalan numbers. Another set of objects that follows the Catalan numbers is the number of binary search trees with $n$ nodes.
This... |
I am looking for intuition here. Essentially, I understand that the set of parse trees from a context free grammar forms a regular tree language. I also understand that regular tree languages are closed under union, intersection and complement. Now, why are deterministic context free languages not closed under intersec... |
The problem: we have a list of terms $[t_1, ..., t_n]$ , and a term $t$, and we want to find which of the terms in the list can be unified with $t$. Obviously we can iterate through the list and check one-by-one whether $t_i$ unifies with $t$, but what better (i.e. faster) approaches exist? Assume we can store the list... |
Context: I am a clinical psych researcher dabbling in machine learning.
Humans cannot be truly random. Therefore, could machine learning be used to analyze a string of numbers and determine the probability that said string was generated by a human or by a computer? Taking it a step further, could machine learning be us... |
The proof is in the image below, taken from "Quantum Computing Since Democritus":
Here's what I don't totally get: my understanding of random algorithms is that randomization is not done over the input space; the inputs are still worst case. So that when a random algorithm has some error, what I interpret that to mean... |
If the same $f$ reduces $L_1$ to $L$ and also $L_2$ to $L$ does it imply that $L_1=L_2$?
My intuition says no, but I couldn't find a counterexample.
|
I want to build a utility that helps manage small groups of participants. It is an acting class setting.
For each exercise, the facilitator will usually have some number of participants get up to do a scene. Two is the most common, but sometimes 1 or 3 or 4. More than 4 is not common.
I want the utility to have a list ... |
I'm trying to determine whether a language $L_{a}$ is recursively enumerable, but first I'm having trouble deciphering the definition $L_{a}$ given the following question:
Given an recursively enumerable language $L$, we can define $L_{a} = \{ x : \exists\langle M\rangle \in L \text{ such that } x \in L(M)\}$. Prove $L... |
Consider the language:
$L=$binary strings that contain a substring of the form $ww$, where $w
\in (0+1)(0+1)^*$.
I am convinced this language is not regular, as $w$ can have arbitrary length due to the $(0+1)^*$ term, and whatever is generated by this term must be remembered for the next occurrence of $w$ immediatel... |
I know that for most computation involve nan (not a number) the result is a nan itself except for some cases.
For example, $1^{\text{nan}} = 1.00$ which proven by mathematicians to be true.
I tried to find a proof but failed
so my question is how to prove that $1^{\text{nan}} = 1.00$?
|
Is $e = 1 + \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \frac{1}{4!} +\ldots$ efficiently computable? To be more specific, we say that a real number $r$ is efficiently computable if there is a polynomial time algorithm that takes a positive integer $C$ as input and outputs a rational number $y$ such that $r−\frac{1}{C... |
I never heard about this variation of the gas station problem. The statement is as follows:
There is just one road connecting the n+1 cities c0, …, cn
consecutively. You want to go from c0 to cn stopping at most s times
to fill the tank of the car. There are gas stations at the cities, but
none on the roads. The lengt... |
Why are registers named so short - EAX, EBX,...etc They could have easily made the names more
descriptive rather than encrypted like that.
|
The EAX, EBX and ECX registers on a cpu are they 64 bits for a 64-bit cpu ?
|
I'm reading the paper where AdaBoost was invented (link), and I couldn't understand why they have chosen the formula α_t = 1/2 * ln((1-ε_t) / ε_t).
snippet:
AdaBoost algorithm from the paper
What is the motivation behind that specific formula?
Why not using something that feels more natural like ε_t?
|
When translating an NFA to its deterministic equivalent, we get an exponential blowup due to the powerset construction method. I tried to search but couldn't find an appropriate question regarding this question:
I was wondering if there are algorithms that are better, even if it's just a tiny bit, for translating NFAs... |
Given $a\in\mathbb{N}$, I wondered for what bases $b$ is the following language regular
$$\{a_ka_{k-1}\ldots a_0\mid \exists n\in\mathbb{N},\ a_0+a_1b+a_2b^2+\ldots+a_kb^k=a^n\}$$
I think it's regular only for bases which are a rational power of $a$, but I couldn't come up with any proof of that.
Is that correct? How c... |
Thinking about specific settings on WorldBuilding.SE, it turns out I need help from people who are more in touch with CS and Clusters. For those who curious about how it started, backstory here, relevant details will be provided in the body of the Q. A note, despite that joking setting, it has some bearing in reality a... |
I know butterfly networks (and benes as well) allow routing a packet from any input to any output node. Congestion is $\sqrt{n}$ but with bene it can be $1$.
Now assume that in a butterfly network, each switch is a selection switch, i.e. the switch has two inputs terminals and two outputs terminal but it "copies" one o... |
You are given an directed graph $G = (V , E)$ with positive edge capacities, a source vertex $s \in V$, and a target vertex $t \in V \setminus \{s\}$. $G$ is guaranteed to have the following additional property: The graph obtained by deleting $t$ from $G$ has exactly one path from $s$ to each other vertex in $V \setmi... |
Let $\displaystyle S_{1} ,S_{2} \subseteq \{0,1\}^{*}$, we say $\displaystyle x\in S_{1}°S_{2}$ if it's of the form $\displaystyle x=x_{1} x_{2} ...x_{n}$, for $\displaystyle n$ even, such that:
$\displaystyle x_{i} \in \{0,1\}^{*}$
$\displaystyle x_{1} x_{3} ...x_{n-1} \in S_{1}$
$\displaystyle x_{2} x_{4} ...x_{n}... |
I want to find an upper bound on the number of planar graphs with $n$ vertices, assuming that we are given some embedding for those vertices beforehand. In particular, Im interested in either showing for every embedding there is $2^{o(n\log(n))}$ planar graphs, or showing that there exists an embedding with $2^{\Omega(... |
I know that for most programs pseudo-random numbers are sufficient, but there are ways that machines can generate truly random numbers! There are devices that generate unpredictable processes. However, they tend to be biased somehow. So, is it possible to make devices that can generate unpredictable processes and also ... |
I came across the term self-delimiting program, referring to the paper "Laws of information (nongrowth) and aspects of the foundation of probability theory" by Levin, 1974.
Unfortunately this paper is not available afaik, and I couldn't find any definition anywhere. What is the definition? or what is a resource stating... |
Say I have a 256 bit bit-string, and I know that there are 16 ones and 240 zeros. I know that this bit string can be compressed, because there are only 256 choose 16 possible strings that satisfy this condition: that's about 2^83.06.
So I know that I should be able to compress this bit string down to 84 bits long. But ... |
According to my fragile knowledge of computer hardware the way computers store information is by electric circuits. If there is current the bit is 1 if there isnt its 0. My question is after a computer runs out of battery the memory stil holds all of the information, how? Wont it be the case that all the bits are 0?
|
See this picture, in parentheses are (arrival time, execution time required)
Why doesn't the "p5" process is processed before "p6"? Why do p3 and p4 are finished and p5 is executed only after the processes that arrive at "11" are executed?
|
I have divide and conquer problem and below is the recurrence relation for it
$$\begin{align}t (n) &= a\cdot t (n/4) + O (n^2/\log(n)) + O(n^2)\\
t(n) &= a\cdot t (n/4) + O(n^2)
\end{align}$$
I solved this recurrence for different values of $a$. These are the solutions below
$$ =\begin{cases}O(n^2),&\text{ for }a = 8\\... |
I was going through the text : Compilers: Principles, Techniques and Tools by Ullman et. al where I came across a claim:
$\text{"The error entries in the goto table are never consulted"}$
I feel that whenever there is a reduce move, the current state pointer moves some states back. Suppose that $A\rightarrow \alpha$ ... |
Given
The starting and the end values of X
The maximum step (maximum delta)
Exact amount of steps
I need to determinte the maximum and the minimum possible values that X could become during this chain of changes and still make it from the start value to the end value with the steps that are less or equal to the maxim... |
Consider the alphabet {0, 1}. How do I find the regular expression for the set of all strings such that each block of five consecutive symbols contains at least two 0's?
Here, by block I mean a given set of concurrent substrings. For example, for a string "0011010", the first five characters are "00110", which satisfie... |
Just like we can represent a mathematical expression uniquely with a binary expression tree, I was wondering if we could do the same for LTL formulae? Such that no two different looking LTL formula will have a same in order traversal.
|
It is common to see articles praising the advances in AI (here is one example).
There is no doubt that significant progress has occurred on all kinds of automation, hard games like chess, etc.
The question is, how much of that progress is due to conceptual proogress, as opposed to increase in processing power? Or, to p... |
The question is to find Find a Cook Reduction from $R_{k-Clique}$ to its determinist problem.
Basically:
k-Clique: a group of $k$ nodes in the graph such there is an edge between every two nodes.
Suppose you are allowed to use an algorithm (B) that in $O(1)$, given as input a graph $G$ and a number $k$, returns whether... |
I've been thinking about this for a while now. Given a graph $G$ of 2-dimensional points (we draw the edges based on a "threshold" distance), find $s_1, s_2, \dots, s_k$, the sizes of all connected components in $G$.
The vertices of the graph are 2-dimensional points and there is an edge between $v_1$ and $v_2$ if the ... |
I coded a solution for the famous Travelling Salesman Problem but my code does not work properly, although it seems okay.
In a grid of size m x n, you are allowed to move only down/right, and
you need to go from the top-left corner to the bottom-right corner.
Each sell has a reward value. How much is the maximum rewar... |
Suppose we are given a set of $n$ points on the plane. How many different planar graphs can we form on those $n$ vertices, assuming that each edge must form a straight line between the two vertices it connects?
I'm interested in either showing for every set of points there are $2^{o(n\log(n))}$ planar graphs; or showi... |
Given
An array of elements, all elements are positive (unsorted, but sorting is not a problem if required)
The objective:
To create two subarrays, so that abs(sum(array_1) - sum(array_2)) is the smallest possible
The order of elements in the subarrays and the amount of elements don't matter but all elements should ... |
Let A = { | M is a DFA which doesn't accept any string containing an odd number of 1s}. Show that A is decidable.
The questions seems simple so I designed the following TM D that decides whether there exists a DFA with this property or not.
D = "On input w:
Construct a DFA B that accept any string containing an odd ... |
I'm having a hard time wrapping my head around an algorithm, and not really sure if such a problem is known, common and possibly named, or if this is somewhat unique.
I have 2 different clouds of points (2D). I need to generate an index map from one to the other by proximity. Points that are closest should map to each ... |
Suppose given recurrence relation
$$T(n)=T(\sqrt{n})+T(n-\sqrt{n})+n$$ $$T(1)=O(1)$$
How we can find an order of above recurrence relation?
My attempt:
I read following post, but get stuck in understanding that solution.
|
I've started learning C++, and I know a little bit of C. Something that always struck me as somewhat off was that the address-of operator is represented with the seemingly random ampersand (&) symbol instead of, say, the "at" symbol (@). Is there some kind of history behind this?
|
I was reading an article on how to solve sliding window problems and it said:
Fast/Lagging
This one is a little different, but essentially the slow pointer is simply referencing one or two indices behind the fast pointer and it’s keeping track of some choice you’ve made.
In the House Robber problem you are trying to ... |
I am wondering if there are any results for the following max-min assignment problem:
Given $n$ machines $C = \{C_1, C_2, \dots, n\}$ with the $k$-th machine has power $C_k$. There are $m$ tasks $T = \{T_1, T_2, \dots, T_m\}$. Each machine can cover a subset of the tasks in $T$. Now we assign each task to a machine tha... |
I would like to compute matrix multiplication A * B where A is Nx3 and B is 3x3. We also know that the elements of B only contains 0, 1, and -1. The content of A is arbitrary floats.
Is there any speedup we can do?
|
How to compute a table of numbers (all possibilities), where repetition is not allowed and order is not important.
Example:
I have a set of prime numbers. In this example I have four: {3,5,7,11}, but it can be anything, and I want to choose every pair out of that set.
To make things easier, I want to compute the indice... |
I am trying to understand the following exercise from Introduction to algorithm (3rd edtion).
Exercise 24.1-3 (page 654)
Given a weighted, directed graph $G=(V, E)$ with no negative-weight cycles, let $m$ be the maximum over all vertices $v \in V$ of the minimum number of edges in a shortest path from source $s$ to $v... |
How can I find an NFA for such a language, considering the alphabet to be {0, 1}. I've tried deriving it from the DFA (@Steven) and the regular expression (@Yuval Filmus), but no luck.
|
so i have this problem where:
I have to accomplish a challenge A with n quests. Each quest gives me:
p points and
needs t time to be done.
The object is to complete the challenge A that needs M points to be completed, in the least possible time.
So let's say A has these following quests:
q1 => p1=20 points, t1=5... |
Given recurrence relation : $$
T(n) = \begin{cases}
T(n-\log n) + 1 & \text{if } n \ge 1,
\\
1 & \text{otherwise.}\\
\end{cases}
$$
To find asymptotic order of $T(n)$ i do as follow:
Suppose $n=\log m$ now :
$$T(\log m)=T(\log m-\log \log m) +1$$
$$\implies T(\log m)= T(\log \frac{m}{\log m}) +1$$
,but in th... |
On page 139, example 2.4.5 of "Categorical Logic and Type Theory" by Bart Jacobs demonstrates the interpretation of the abstraction typing rule with respect to a $\lambda 1$ category. Specifically, the category in question is $(\mathcal C \ell 1 (\Sigma), T_1)$:
An object of $(\mathcal C \ell 1 (\Sigma), T_1)$ is a pai... |
I don't understand why do we need to have more than two nodes in doubly linked list when all we need to maintain is the most recent and least recently accessed nodes.
I was going through solutions for LRU Cache and it seems that all solutions seem to ignore this. The linked list's size keeps increasing.
Can we do this ... |
I have undirected weighted linear tree (path tree) with $n$ nodes ,and
a weight function on edges $\omega: \mathbb{N}\to \mathbb{N}$,
additionally given $k\in \mathbb{N}$, How we can find a path with
lenght $k$ that have minimum number of edges in $O(n)$?
I think as follow:
Run Bellman Ford for each node and then se... |
Given a graph $G = (V,E)$ and a probability $p \in [0,1]$ with which each edge is sampled from the graph $G$. The goal of the stochastic matching problem with fewer queries is to find a subgraph $H \subseteq G$ of fewer* edges such that we maximize the following ratio
A realization of a graph $G = (V,E)$ with a paramet... |
Given two strings $s$ and $t$, is there a way to find a string $a$ such that $d(a,s)=d(a,t)$, where $d$ is the Levenshtein distance?
I am sure that a genetic algorithm would work pretty well but I would prefer an explicit solution.
|
Suppose "CFG+" was created, where it is identical to standard context-free grammars in every way, but rather than rules being limited to unions, was also closed over intersections, both between CFGs and between other CFG+'s.
Consider non-context-free language:
$$
\{ a^nb^nc^n|n≥0\}
$$
With the addition of intersections... |
I was working on a problem for some time now, and I made a data structure to solve it. To my surprise, I could not find any instance of this data structure on the internet (though I am certain someone has thought of this).
Put simply, it is a sorted linked list and a sorted array, with the array pointing to spots a fix... |
I am trying to understand the concept of big-O notation problem and came through this problem. Can you tell me how could
$$O(n) = 1 + \Theta(1/n)$$
|
Suppose in a 5 stage pipeline when the stall will actually happen if there is a RAW hazard? The stall will start after Instruction Fetch(IF) stage or Instruction decode(ID) stage? In few cases I see that the stall start after IF that is before executing ID and in multicycle pipeline, the stall starts after decode stage... |
The following corollary can be found at page 653 of "Introduction to algorithms (3rd edition)"
Corollary 24.3
Let $G = (V, E)$ be a weighted, directed graph with source vertex $s$
and a weight function $w: E \to \mathbb{R}$. Then, for each vertex $v
> \in V$, there is a path from $s$ to $v$ if and only if BELLMAN-FORD... |
Question on operating system
If we execute kernel programs in the user mode and user programs in kernel mode what are some consequences
|
Given that the MMU does all the memory translations and etcetera, how does it maps a system consisted of multiple RAM chips?
Are their spaces concatenated (e.g Chip 1 + Chip 2)? If so, how does that works given ASLR?
|
I'm looking at the pseudocode for chord algorithm here:
// create a new Chord ring.
n.create()
predecessor := nil
successor := n
// join a Chord ring containing node n'.
n.join(n')
predecessor := nil
successor := n'.find_successor(n)
// called periodically. n asks the successor
// about its predecesso... |
Given an unweighted, undirected graph $G=(V,E)$ without loops or multiedges, and vertices $v,w$, one can use breadth-first search to check if $v$, $w$ are connected, and in particular the algorithm will return a shortest path between them.
BFS has time complexity $O(|V|+|E|)=O(|V|^2)$.
Now let $k$ be some fixed integer... |
Suppose that:
You're using a programming language that doesn't support fixed-point or floating-point numbers.
The said programming language rounds down divisions, e.g. 12 / 5 = 2.
You're adding 18 trailing decimals to represent fixed-point numbers in your algorithm. for instance, you'd represent 0.5 as 500000000000000... |
I have a problem like this:
we have an array of elements like this :
(a0,b0)
(a1,b1)
.
.
.
(an,bn)
and I wanna find the number of elements which have one of this two condition:
1) if ai>aj and bi<bj then:count:=count+1
or
2) if ai<aj and bi>bj then:count:=count+1
I've already found an algorithm that is $O(n^2)$, but I... |
I have the following regular expression for the set of all strings such that each block of five consecutive symbols contains exactly two 0's (consider the alphabet to be {0, 1}):
(0+1+ϵ)4+(11100+ϵ)r(0011100r)*(00111+ϵ)
r=11+(110+ϵ)s(0110s)*(011+ϵ)
s=(0+10)*(1+ϵ)
How should I convert this into an NFA? Please explain ... |
I'm looking for an algorithm/insight into a problem that's an extension of the Maximum Weight Matching problem. The maximum weight matching problem looks for the max-weight set of edges that contain 0 common vertices. The problem can be thought of as grouping the vertices into sets of 2 such that no vertex belongs to m... |
In 2014, inspired by Regex Golf, I started exploring, along with a mathematician going by the name teukon, what could be done in the unary domain in ECMAScript regex that went significantly beyond matching primes and powers of 2 (both of which were puzzles in the Regex Golf site). This is a dialect of regex that includ... |
I have a set $S$ of intervals. I'd like to store them in a data structure, so that I can handle the following query efficiently: given a query interval $q$, count the number of intervals $s \in S$ that contain $q$, i.e., count the number of intervals $s \in S$ such that $q \subseteq s$.
(This is like a stabbing query,... |
I'm in a scenario where ~30% of the time, my array is almost completely sorted, and the other 70% of the time, it is basically completely random. I want to quickly determine if my list is almost sorted, use insertion sort if it is, or quicksort otherwise. I've been searching this up all day but no luck.
The alternative... |
int i=0,j;
while(i<=n)
{
while(j<=(i+1)){
a=a*a;
j++;
}
i++;
This question was in my homework and we have to calculate the frequency count of the code above. I am having difficulty understanding how the code will execute and how many times will the loops execute. I know the inner loop is dependent on 'i', ... |
The stream cipher is an encryption algorithm that was designed to approximate an idealized cipher, known as the One-Time Pad. It's crucial for a stream cipher to remain secure is to have a pseudorandom generator that hard to predictable and a seed that was never used. For this to be achieved, I assume we need to have a... |
I am grading an exercise in Automata and Formal Languages and see many of the students use $\{\varepsilon\}$ as the empty language. At first I thought this was an error, and I have asked the lecturer who confirmed. But I keep seeing this and I'm losing my confidence. Is this kind of thing used by anyone? Meaning, does ... |
Let me explain my trouble by another example.
The wiki page says that
Lattice problems are an example of NP-hard problems
However, by clicking NP-hard, i find this definition
A decision problem H is NP-hard when for every problem L in NP, there is a polynomial-time many-one reduction from L to H.
What the fact?
Lat... |
I know there are many algorithms for finding a pattern in a text like Boyer Moore, KMP, RabinKarp and so on.
I want to know what is the one that is mostly prefered by text editors and IDEs, as I find them efficient.
|
If we have a graph $G=(V,E)$, can we find a vertex cover with size $\lceil \log |V| \rceil$ in polynomial time?
|
Suppose there are three categories of people.
Type X, Type Y, Type Z.
In each type, there are two objects of subtype Type 'a' and type 'b'.
For example.
X: a1 , a2 , b1 , b2
Y: a3 , a4 , b3 , b4
Z: a5 , a6 , b5 , b6
Each object of type 'a' should be assigned with an object of type 'b'. But it is desirable not necessary... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.