instruction
stringlengths
35
29.1k
For context, one of Numpy's features is that an an array of integers can be passed as an index to an array, and this selects values at all of the specified positions, in any order with possible duplicates. >>> import numpy >>> a = numpy.array([0.0, 1.1, 2.2, 3.3, 4.4, 5.5]) >>> b = numpy.array([2, 4, 3, 3, 0]) >>> a[b]...
I was following a discussion on a forum where they have posted a question like this--> Some people are saying that we can merge A,B,C in a single table and m:n relation of A and C in another table having foreign key. Thus 2 tables are required. Where as another person is saying that A,B,C cannot be merged as if we mer...
How do i prove that Is {$↔,⊕$} not a complete set ? I have no clue how to prove it .
I was wondering why it is not possible. Is it because the corresponding language is not decidable, or because of the fact that it is not guaranteed that a Turing machine halts on every input?
Consider two graphs $G_1 = (E_1, V_1) $ and $G_2 = (E_2, V_2)$ with their associated sets of edges $E$ and nodes $V$. I'm familiar with concepts such as edit distance for computing the similarity/distance between these two graphs. I was wondering if there are any metrics for estimating similarity between graphs where t...
I am looking for an algorithm in $O(N^2)$ that finds the maximum value that be obtained from a sequence of real numbers greater than 0 (e.g. $\{ 1, 2, 3 , 4\}$) by inserting a plus ($+$) or multiplication ($\times$) between the elements. Really not having much luck and wondering if anyone has any insight on this? It mu...
The recurrence: $T(n) = pT(n/q) + \log n$ for p < q and p >= 2. So, I've figured out it would fall into case 1, since we have $n^{log_{q}p} = n^r $, for $0<r<1$, which would mean that $f(n) = \log n$ would be dominated by a polynomial factor, i.e $\log n = O(n^{r-e})$ for $0 > e < r$. But according to my professor,...
I'm trying to find efficient algorithm for checking if string with wildcards contains given substring. The parts of the string are separated with a "." character. So for example I have ab.cd.*.efg And I want to check for given strings, if they are substrings of string above, for example to match with those: ab b.c cd.q...
The question is: given an array of size $n$ and a number $m$, now our goal is to find AT MOST $m$ contiguous subarrays such that the sum of all these subarrays is the largest. It is also required that none of these subarrays can overlap. Example: for an array [1, 2, 3, -2, 3, -10, 3], if $m = 2$, then the subarrays w...
Suppose a processor lacks STACK Pointer Register. But, It does have STACK. Then, in my opinion, a program will still be able to call subroutines but, will be unable to return back from the subroutines. Please do clarify me where I have made a wrong assumption. Also do mention the possible outcomes of the scenario.
I am trying to design an efficient algorithm that retrieves the ith to jth largest elements in an array. For example, if the following array is the input: [10, 14, 18, 3, 21, 25, 27] i = 2 j = 4 The following array is returned: [25, 21, 18] 18 is the 4th largest element in the array and 25 is the 2nd smallest element...
Suppose we have a weighted binary tree $G$ where the nodes are towns and edges are streets with edge weights being the travel time and we want to find out whether it is possible to travel from any town to any other town within some time $x$. There are three paths to consider for each node $v$. Path to the right subtre...
I know Dijkstra's algorithm can be seen as a specific case of A star, when the estimation heuristic used simply returns 0, so I know that A star with this specific heuristic can not check more vertices than Dijkstra's algorithm. What I'm asking however is the following. Given an A star algorithm with some heuristic whi...
Assume the languages: $$ a) \, L_1 = \{ w \in \{b,c \}^* | \, w \, \text{contains 'bbc' as substring} \} $$ $$ b)\, L_2 = \{ 1^k 0^m 1^m | k,m \in \mathbb{N} \} $$ $$ c)\,L_3 = \{ w \in {0,1}^* | \, w \, \text{is a multiple of 5 (binary system) }\} $$ $$ d)\,L_4 = \{ d^k e^m f^k | k,m \in \mathbb{N}, \, k < m\} $$ $L...
The various complexity classes usually taught and studied ($P$, $NP$ $co-NP$, EXP, NSPACE etc) are usually defined using Turing Machines as the preferred model of computation. Are these sets of decision problems (complexity classes) independent of the model of computation used?
In Types and Programming Languages by Pierce, from p257 to p258, about featherweight Java, The predicate override(m, D, C→C0) judges whether a method m with argument types C and a result type C0 may be defined in a subclass of D. In case of overriding, if a method with the same name is declared in the superclass then i...
I'd like to expand on this question : https://stackoverflow.com/questions/52420788/why-does-the-a-star-algorithm-need-gn Dijkstra's algorithm uses cost function $f(n) = g(n)$ whereas A* uses cost function $f(n) = g(n) + h(n)$, with $g(n)$ being the cost of the path from the start node to node $n$, and $h(n)$ is a heur...
Expanding on this question : Why is Dijkstra's Algorithm more popular compared to Grassfire algorithm? What are the differences between grassfire and BFS? I'm surprised grassfire (supposedly) has a complexity of only $O(|V|)$, whereas BFS has a complexity of $O(|V| + |E|)$.
Add a constant $c\geq |w_{min}|$ to each edge of $G$, so that each edge now has non-negative weight. Run Dijkstra's algorithm Can anyone tell me if this is viable or if it fails?
Suppose we are given a CNF formula $F$ with $n$ variables and $m$ clauses. The question is whether we can represent $\lnot F$ as a CNF formula with the number of clauses polynomial in $n$ and $m$?
I claim to have solved the travelling salesman problem as follows. (You will have to be familiar with djikstra's algorithm for this.) 1) I am about to start using djikstra's algorithm on any given road network but, 2) The end node is not known for now, regardless, I just begin from any arbitrary node, assuming I will b...
I'm given a problem statement which states "There always exists a vertex from a tree G such that the remaining connected components have size at most |V(G)|/2". I'm trying to formulate an efficient algorithm for this and am not sure where to start. I'd love some hints and can take it from there. Thanks.
I was wondering about the complexity of SAT tests with variables $x_i = 0 \lor 1 \lor 2 \dots \lor n$, with clauses being of the form $x_i = a \implies x_j \neq b$. When $n=2$, we have 2SAT, which has linear time algorithms. Meanwhile, if $n > 2$, then if we can almost convert it to 2SAT by having Boolean variables $x_...
Types and Programming Languages book introduces a theorem about principles of induction on term (p. 31, theorem 3.3.4): Suppose P is a predicate on terms. Induction on depth: If, for each term s, given P (r) for all r such that depth(r) < depth(s) we can show P(s), then P(s) holds for all s. Proof of this theorem ...
So, I'm trying to understand how to get the run time of this loop: for(int i = 1; i < n*n*n; i*=3) {...} So, far I know: loop starts at 1 finishes when $i > n^3-1$ that $i$ is multiplied by 3 each iteration. Intuitively it seems like as $n$ gets larger the number of iterations decreases which makes me think that ...
I didn't find, in the digital design books, who invented the adders. The same person invented the half-adder and the full-adder? What's the oldest publication on digital arithmetic design?
So, by the Bzozowski theorem, if A is DFA det(rev(det(rev(A))) would have minimal number of states. And for the most of them work. But for this example, I can't figure out why it doesn't. I have an DFA which is NOT minimal (the min. automata have 2 states ) but det(rev(A)) is the same automata (obviously det(rev(det(...
Given an unordered list of words, what's quickest way to test whether a certain word is in that list? I can't think of another way to do this other than just going through each element in the list and checking whether it's the word I want.
I have a master point cloud, which essentially just a list of points with {x,y} coordinates. The point cloud is HUGE ( like, it can contain more than 1 million points). The problem now is that I have another (sub)set of point clouds, and I need to check whether the points inside the second point clouds are the same wi...
The system has same physical and virtual address space i.e. 32-bit. Are the logical address generated by CPU and address generated by MMU same?
Can you have simple unit tests for complicated function? For example: Turing test for AI. Do you always can find simple unit tests for any complicated enough function / algorithm?
I read this problem as a part of my course curriculum, in my professor's notes. I am not able to understand about the standard solution, that if I list all the possible triplets of vertices as 3-tuples in the tape, then how come my solution is limited to log-space? As far as my understanding, listing all the 3-tuples i...
I have $n$ elements out of $n-1$ are distinct. The repeated element is either minimum or maximum element. I need to figure out how many distinct max heaps can be made from it. My analysis : I started with $n$ distinct elements. Since root is fixed( maximum element) we can choose $l$(found using deducting total elements...
Available data Available to me is a set of points which can be represented as shown in image 1: Also available to me is a non-continuous path derived from this data. It is not important how this non-continuous path is obtained. It is however important, that it roughly represents a curve I intent to approximate. This n...
Consider a system with 6 processes, where each process needs 2 copies of Resource R. The maximum units of R required to cause deadlock is ??
I am faced with the following problem; We are provided cost quotations for shipping cost per packet by various shipping companies, let's call these quotations $Q_1 ... Q_k$. Each Quotation is a $M \times N$ matrix with weights categories of packets along one axis and size categories along the other axis. We are provide...
I have a exam task with 3 parts. (b) is no problem. I got a solution for (a) but the way (c) is asked makes me wonder if I even understood (a) (a) L := { < A > | A is a DFSA, where all states are reachable }. Is L decidable? Why or why not? (b) M is a DLBA and k is the input length. There exists a function g(M,k) which...
I have been working in the time analysis for an exact solver I designed for the subset sum problem accepting multisets as input instances, and determined its time complexity to be dependent on the multiplicity ($m$) of the elements in the input. For input instances containing elements having $m \leq 2$, the time compl...
I understand that essentially we have to prove that $$c_1(n^2\log n)\le (56n^2+106n+48)(\log(264n^2+200)) \le c_2(n^2\log n)\,.$$ I am confused on how to simplify this further? And correctly find a c value.
Munapo (2016, American Journal of Operations Research, http://dx.doi.org/10.4236/ajor.2016.61001) purports to have a proof that binary linear programming [1] is solvable in polynomial time, and hence that P=NP. Unsurprisingly, it does not really show this. Its results are based on a convex quadratic approximation to th...
Being new to the OR and Optimization world, I've always assumed that a problem being convex meant that it can be solved in polynomial time. Now I am learning that a convex optimization problem can be NP-Hard, but that convex problems are still somehow considered easier than non-convex problems. Can someone explain th...
I was trying to solve a partial differential equation (PDE) using a neural network. The solution to the PDE is not unique unless the boundary condition is determined. In my case, the neural network takes $(x, y)\in [0, 10]\times[0, 10] = A$ and outputs a scalar. Suppose at the beginning of the training, I only sample f...
I have this question in my Theoretical Computer Science class on the topic of Automata and Formal Languages. $$ λ ∈ L \iff L^2 ⊆ L^3$$ I thought of showing it by proving the contrapositive but I was only able to complete half of the proof (since it is a bidirectional proof) and on top of that I am not even sure it is c...
A priority search tree can be constructed on a set of points P in O(n log(n)) time but if the points are sorted on the y co-ordinates then it takes O(n) time. I find algorithms for constructing the tree when the points are not sorted. I am thinking of a way to do this, which is as follows: Construct a BST on the point...
I'm looking for a data structure representing a finite set $I$ and a $d$-relation $R \subseteq I^d$ such that the following operations can be implemented efficiently: Add a new element $i$ to $I$. Identify elements $i, j \in I$, i.e. take the quotient set $I' = I_{/ i \sim j}$ and take for $R'$ the obvious relation on...
I am currently writing from a computer on which a VM has just frozen due to exhausted RAM. I am obviously no expert in the field of operating systems but i know that they implement certain memory management methods so why can't my OS handle my alt-f4 request to kill the troublesome process in a reasonable time? Why ca...
Why is the answer (b + /\)(ab)*aa(ba)*(b + /\) + (a + /\)(ba)*bb(ab)*(a + /\)? I'm confused and I request guidance
I have read that minimizing regular expressions is, in general, PSPACE-complete. Is it known whether minimizing regular expressions without the Kleene closure (star, asterisk) is in P? The language of any such regular expression would be guaranteed to be finite. I suppose an equivalent question is whether the problem o...
I am working on a problem of whose complexity is unknown. By the nature of the problem, I cannot use long edges as I please, so 3SAT and variants are almost impossible to use. Finally, I have decided to go for the most primitive method -- Turing Machines. Oddly enough, I could not find any example of NP-hardness reduct...
I'm trying to work out a proof by construction that $L/a$ would be regular. $a$ is any final symbol at the end of an accepted string, so I figured the only part of the machine that would have to be changed is the set of accepted states ($F$) I came up with the following definition of $F'$ for the new $F' = \{q ∈ Q | \...
I recently encountered a coding interview question which is broken down as follows. You are given an array N which consists of pairs n which consist of a reward and a cost. You are also given m which is the maximum cost you can incur. Find the subset of N in which the sum of the reward is maximized and the sum of the c...
Assuming the list is very large, and $k$ is very small, what's the fastest algorithm to sort this list?
In my lecture we learned: If X is NPC and X in Co-NP => NP = Co-NP Would it be enough to prove NP = Co-NP if I reduce a problem just in one direction (from NPC to Co-NPC) in polynomial time? Or would it be necessary to show this for both directions?
I was curious about the following: in most learning algorithms, when an algorithm is said to learn a concept class $C$ then the algorithm outputs a function from the hypothesis space $H$ and often the complexity of the learning algorithm is stated in terms of the VC dimension of $H$. I was wondering, what is an assump...
Can anybody explain to me how segment trees are used to answer interval stabbing queries? I have searched and searched and only come with the beginning of the line. From my understanding I need to take all the end points of every interval and build a segment tree then what? How can we know the original intervals now? H...
I came across following problem to finding whether the following language is decidable or semi-decidable or not even a semi-decidable. $L: \{\langle M\rangle: M\space is\space a\space TM\space and\space |L(M)| \ge3\}$ Now thinking intuitively I conjectured that this language is semi-decidable. We can say yes when the i...
I am a physicist learning a bit of information theory. I have encountered a term ("symbol codes") on Wikipedia, and cannot find what it means: Source coding theorem for symbol codes Let $\Sigma_1,\Sigma_2$ denote two finite alphabets and let $\Sigma_1^*$ and $\Sigma_2^*$ denote the set of all finite words over those a...
While learning stack allocation, I came across this paragraph in the textbook (Programming Language Pragmatics - 3rd Edition): Even in a language without recursion, it can be advantageous to use a stack for local variables, rather than allocating them statically. In most programs the pattern of potential calls among...
What's the meaning of the example statement here? "A service specification S describes an interface: it specifies the behavior of certain program elements (functions or subprograms) through statements expressed in program logic. For instance, these might be such statements: [...] x, y : N[{x>0} y := x * x {y > x}] " ...
In Computational Intractability, we often come across a need to reduce Vertex Cover (VC) problem to a Subset Sum problem, mostly to prove Subset Sum is NP-Complete. I also see a reduction in the line of - A graph G has VC of size k if and only if there is a subset S that sums exactly to t. However, not able to find out...
It's common to ask whether a particular class of languages $\mathcal{C} \subseteq \mathcal{P}(\Sigma^*)$, for some alphabet $\Sigma$, is closed under complement, or union, or intersection, or concatenation, or the Kleene star. And those questions seem natural to me, because they're essentially questions about the power...
Given a matrix $[A|B]$ I want to find a minimal matrix $[A'|B'] \subseteq [A|B]$ (i.e. the rows in $[A'|B']$ are also in $[A|B]$) such that $A'x < B' \Rightarrow Ax < B$. Geometrically, I want to discard the half-planes $X_i$ which contain the intersection of rest of the half-planes i.e. $X_i \supseteq \cup_{j \neq i} ...
Assume we want to solve the so-called "Super-G" problem from Jean-Claude Constantin. The goal of the puzzle is to get the ring off the other components. Here is a picture of the problem: Source: http://gunnarmp.blogspot.com/2016/10/super-g.html The question here shall not be how to do that - that's trivial after you ...
As far as I understand from PCY (Park, Chen, and Yu) algo is that the algo uses hashing during the first pass to reduce the number of CANDIDATE pairs that are considered in the second pass. I have 2 concerns. 1/ How can I chose a good hash function? since I noticed that if we chose a bad func, it turns out to make man...
I'm performing some correlation assessment à la NIST Recommendation for the Entropy Sources Used for Random Bit Generation, § 5.1. You take a test sequence and compress it with a standard compression algorithm. You then shuffle that sequence randomly using a PRNG, and re-compress. We expect that the randomly shuffle...
For a language L $\subseteq$ $\Sigma$* , define LOG(L) = { u $\epsilon$ $\Sigma$* | $\exists$ v s.t. |v| = $2^|$$^u$$^|$ and uv $\epsilon$ L}. Show that if L is regular so is LOG(L). I was trying to come up with some finite state automaton for LOG(L) but can't find any. Please give some hint.
Problem: Write a program which generates Deterministic finite automaton which accepts given language. Language is defined with alphabet and start/end sub strings. For example: Alphabet={a,b,c}; start sub string="ab"; end sub string="cb" I need to construct DFA which will accept strings of kind: {abcb, abaacb, abcabcb.....
\begin{align} L &= \{ w \in \{a, b\}^* \mid \text{ no prefix of $w$ starts with $b$}\} \\ &= \{w \in \{a, b\}^* \mid \text{ the first character of $w$ is $a$} \} \cup \{e\} \end{align} Why is it in union with an empty string? If an empty string from $b$ can also be a prefix.
I know some algorithms which compute the convex hull in a continuous space. Are there efficient algorithms to compute it in a discrete domain? For example in 3D discrete space, given the blue points, we want the convex hull including the green points. This fugure's points are plotted on the plane $v_1 + v_2 + v_3 = 7$....
A Forgetful Turing Machine (FTM) operates just like a normal Turing machine except that, in every instruction (i.e., transition), the letter written in the tape cell is always the letter $a$, regardless of the current state and the current letter (although the read/write head is still allowed to move either Left or Rig...
Σ(alphabet) contains 3x1 column matrices [[0],[0],[0]], [[0],[0],[1]] , [[0],[1],[0]]... [[1],[1],[1]] such that each element in the language is a THREE SET of the columns where the bottom row is the sum of the two top rows example [[0],[0],[1]], [[1],[0],[0]] , [[1],[1],[0]] is an element of the Language BUT [[0],...
I read a statement that was unclear to me, and was hoping to get some clarification. It said that given a full binary tree with $n > 2$ leaves, there exists some internal node such that one third to two thirds of all $n$ leaves in the tree are its descendants. From my understanding, I know each internal node in a full ...
And if it is not true, what are the problem classes or characteristics for which genetic algorithms are superior?
Given a general branching program, is there an algorithm which can find an equivalent branching program $P$ of minimal length. That is $|P| \leq |P'|$ for all equivalent branching program $P'$. If not, are their some specific cases where this algorithm exists?
Let N be an n bit number. A brute force algorithm factors N by trying to divide N by all of the numbers between 2 and sqrt(N). Given that dividng two n bit integers takes O(n^2) time, what is the asymptotic running time for the brute force factoring algorithm?
In the Min-Ones-2-SAT problem, we are given a 2-CNF formula φ and an integer k, and the objective is to decide whether there exists a satisfying assignment for φ with at most k variables set to true.Show that Min-Ones-2-SAT admits a polynomial kernel. What I did check if I can satisfy a 2-CNF Sat with k variables set ...
Consider the recursive quick sort with random pivoting i.e. each time a random pivot element is chosen uniformly. When this randomized algorithm is being applied to an array with n distinct element, what is the probability that the smallest and the greatest element will be compared during run of the algorithm.
I need to create an algorithm that will output the number of self-crossings for an irregular orientation of an n-pointed star, whose vertices lie on the boundary of a circle. The sample input is as follows: 5 24.0 168.0 312.0 96.0 240.0 Where the first integer is n (the number of vertices), proceeded with n lines, eac...
Consider cellular automaton rules for a two-dimensional universe with two states, where a cell's new state can depend on its previous state and the states of the cells in its Moore neighborhood. Such a rule can be modeled as a function that takes as input a 3 by 3 matrix of bits, and outputs a bit. Such a rule can be r...
Given N arrays of variable length. Find a way to concatenate the arrays in such a way that the number of inversions is minimum An inversion for an array Arr can be defined as, a pair of indices (i,j) such that, i != j i < j Arr[i]>Arr[j] I tried to concatenate the arrays on the basis of sum, such that the one with m...
I am working with the median-median algorithm or BFPRT algorithm and I seek to understand why would the partition of the array by $7$ blocks would work but with the $3$ fail? If we divide into blocks of $7$ then we will get: Solving it by substitution I think the following manner: It is a recursive tree. In the worst ...
We have a number of people that must be partitioned into groups, but there may be people that dislike other individuals. Partition the people into the minimum number of groups such that no person is grouped with someone they don't like. (If A doesn't like B then A cannot be in a group with B. Each person must belong...
I have some questions about Baker, Gill, Solovay proof of the existence of an oracle such that P^B != NP^B. The proof can be found in Siam Journal of Computing, 4:432-442, 1975 [219]. Why Isn't this construction considered a counterexample to P = NP? And if it is not, can it be strengthened into one? It seems tome tha...
It is an open question if NP $\neq$ Co-NP but if the conjecture were proved, this would mean that P $\neq$ NP because P is closed under complement. Now a fact that fails to enter my head is the following: We take 3SAT which we know is NP-complete and then we take 3TAUTOLOGY which is Co-NP-complete. The last formal la...
I asked this question to the OR community (https://or.stackexchange.com/questions/1498/how-is-the-field-of-operations-research-evolving) but, since there are quite a few CS people working in OR, I would like to get the perspective of the community. Classically, it seems the problems that OR people studied (at least the...
In the book by Cover and Thomas on information theory, there is a chapter on algorithmic information theory (kolmogorov complexity and so forth). As far as I understand, algorithmic information theory was developed separately from information theory, and Kolmogorov didnt formalize AIT in terms of shannon entropy and so...
Suppose you're given a DFA $M$ with a 5 tuple of $(Q, \Sigma, \delta, q_0, F)$. How do you construct an NFA that accepts $L(M)$ and $\{\varepsilon\}$, the set containing the empty string? I know that a DFA is an NFA. My thought is that you would simply add a new transition from the start state to the accepting state, w...
Given a minimal NFA for a finite language, is there a polynomial-time algorithm to find a minimal regular expression for the same language? This question is based on a recent question regarding minimization of regular expressions for finite languages given a regular expression. I was surprised to learn there don't appe...
What can be an initial guess for finding the tight asymptotic bounds of $T(n)=2T(n/2)+ \sum_{i=0}^{n} (i+2)^2$ using substitution method?
suppose I have 6$\{0,1,2,3,4,5\}$ numbers.I should generate following 4 pairings of numbers where there will be 3 pairs in each pairing s.t each number should be in one pair and also every number should be paired a pair(like 0-1) should be present in only one of the pairing. and also every possible pair should be pres...
This post and this post indicate that when the dimensionality gets higher, KDTree gets slower. Per scikit-learn doc, the KDTree becomes inefficient as D(dimensions) grows very large (say, $D>20$): this is one manifestation of the so-called “curse of dimensionality”. Is there some theoretical verification or explanation...
I've been asked to do this task in an online assessment. I've passed, so my solution is supposedly correct, but I am unable to prove it. The task is: Given a set of parts (array of integer part sizes), worker must put them all together. Parts are assembled in pairs. To put together two parts of sizes A and B worker nee...
Example N = 9 and K=3 4 + 4 + 1 = 9 . What I have tried. We can not go on dividing with 2. We can use unbounded knapsack with array elements from 2^0 to 2^32.
I am learning this post Fast computation of nearest neighbors is an active area of research in machine learning. The most naive neighbor search implementation involves the brute-force computation of distances between all pairs of points in the dataset: for N samples in D dimensions, this approach scales as $O[D N^2]$....
What are the differences between NP, NP-Complete and NP-Hard? I am aware of many resources all over the web. I'd like to read your explanations, and the reason is they might be different from what's out there, or there is something that I'm not aware of.
It is known that metric TSP can be approximated within some constant value, such as 3/2 through Christofides' algorithm. It is also known that non-metric TSP cannot be approximated within some constant value (unless P= NP), thanks to Sahni and Gonzalez. It isn't clear however if non-metric TSP can be approximated withi...
I'm trying to understand an algorithm shown in my textbook for solving a system of congruences. The problem states: Let $r$ and $m$ be arrays of size $n$, such that every two numbers (modulos) from $m$ are coprime. Find $x$ such that $$x \bmod m_0=r_0\\x \bmod m_1=r_1\\...\\x \bmod m_{n-1}=r_{n-1}$$ So yeah, the classi...
I'm trying to pack hexagons, within bigger hexagons, as shown here: For this example, I have 5 "children" to put in my "father" hexagon. Each time I've got too many children, I would like to reduce the size (divide by 3?) of the children, to store more of them, as shown on this image (ignore the bad position quality):...
In Hitting Set problem we are given a collection E of subsets of V and we want to find smallest subset H of V which intersects (hits) every set in E. In decision version of the problem, we are asked if there exists a hitting set H of size at most k. This problem is known to be NP-hard. However, I wonder if the problem ...
In Theta notation what are the running times of these algorithms? Algorithm 1 for i=1..n j=1 while j*j <= i: j = j + 1 Since the outer loop is going to n and the inner loop is going to sqrt(n). My guess is that it is Θ(n^2) $$ \sum_{i=1}^{n} O(1) \sum_{j=1}^{\sqrt n}O(1) = \sum_{i=1}^{n} \sqrt j*\sqrt...