instruction
stringlengths
35
29.1k
$$L'=\{ww|w\in L\}$$ I need to give an example of regular language L for which the concatenation of 2's $w$ gives $L'$ which is not regular. How can I give such an example if according to closure properties for concatenation $L1L2$. each of them is regular,concatenation gives me a regular output.
Probably newbie question here, please point me out to relevant theories/tutorials if needed : let say I want to evaluate the probabilities of the final rankings for a sport competition the competition involved 8 teams, but I can simplify the problem to 4 contestants (say A - B - C - D) the competition is splitted in...
Given a set of positive integers : $ \\ D = \{ D_1, D_2, ..., D_n\}$ and a non-negative integer $P$, where $P$ is divisible by every element in $D$, then find a set of non-negative integers: $C = \{ C_1, C_2,..., C_n\}$ such that $S > P $ where $S = \displaystyle \sum_{...
I have come up with the following problem, and cannot seem to find an effective way of solving it: Consider $n$ clients arriving at a service point at time moments $\{a_i\}_{i=1}^n$ whose duration of service (by a single employee, let's say) is known to be $\{d_i\}_{i=1}^n$. Choose the turn of servicing them, such t...
Given two arrays whose elements lie between $[1,10^5]$ and the size of arrays is $[1,10^5]$, how can we find the total number of pairs of elements from these arrays such that their product is a perfect square? The arrays may have same elements. For example: Array 1: {1, 2, 4, 5} Array 2: {4, 8, 16, 125} Output : 6 Th...
Say there're two queues of numbered items of different kinds (e.g. color), now we need to merge them into one queue so that each item maintains its order in the original queue, regardless of its kind. For example, queue of blacks balls: b1, b2, b3 queue of red balls: r1, r2 one possible merging result: b1, b2, r1, b3,...
Please consider the figure below. I have to find the best and worst options for W. From the preference list of W, the best option for W is D but there is no matching of W with D in all the 6 options. Thus option 1 is the best option in the context of W because A is the second preferred element of W. Now C is the worse ...
Suppose you have an array nums of integers, unsorted, containing the values from 1 to n. You have a second array, call it firstBigger, initially empty, which you want to populate with integers such that firstBigger[i] contains j if j is the least index such that i < j and nums[j] > nums[i]. A brute force search of num...
In order to keep my interviewing skills sharp, I solve one algorithm/data-structure problem every day, from sites like Leetcode or HackerRank. If I am not able to solve it after 45 minutes or so, I usually refer to the solution. I review it, understand it, and move on. However, I have found that I do not really learn a...
I'm looking for a customer clustering solution. I have done a lot of research on the machine learning level to find algorithms that could fit my needs but I can't find much information when the data is mainly text. I searched for clustering with string but found little relevant ( for me). Do you have any ideas for algo...
I have a problem for the comprehension of how to prove that a function $ \log_2 : \mathbb{N} \rightarrow \mathbb{N}$ defined as: $$\log_2 (x)= \begin{cases} y & \text{if $x=2^y$} \newline \bot & \text{otherwise} \end{cases}$$ is recursive. I think that I need to use minimization operator but I don't know how to do tha...
In an undirected (and unweighted) graph, to find the shortest cycle containing a specific vertex $s$, it is usually said to run a BFS from $s$ and the first time to find a re-visit, then that is the wanted smallest cycle length. This does not seem to be true, quoting from https://www.cs.princeton.edu/courses/archive/sp...
Given the Equivalence relation R = { x, y $\in$ $\Bbb{Z}$ : (x+y) mod 2 = 0}, what are equivalence classes of 1 and 2? I can't really see the equivalence classes of infinite sets. Only by having a drawing of all elements can I distinguish the answers, wich is not the case in the above mentioned example. What would be ...
I'm doing a masters in CS that requires me to implement from scratch most of the neural network models and because python libraries aren't applicable to what i want. The problem is that i don't feel capable of implementing those from scratch. Even the MLP seems very difficult, i always try but get stuck and restart. Me...
For this question I will refer to$\ NP-hard$ problems as those that are at least as hard as$ \ NP-complete$ problems. That is, a problem$ \ H$ is$\ NP-hard$ if there is an$ \ NP-complete$ problem$\ G$, such that$\ G$ is reducible to$\ H$ in polynomial time.$\ NP-hard$ problems are not restricted to decision problems an...
In the book by Cachin, Guerraoui, Rodrigues they discuss an arbitrary fault abstraction. It seems to me that this abstraction does not include crashes in its behavior. I think this because they propose an algorithm as follows: Send all messages infinite times. Keep a list of received messages in volatile memory, and o...
Why cant I Just create a TM A that runs a NTM B with a formula to compute the SAT Problem and Just Flip its Output. So when the Input NTM B Returns true (formula is satisfyable) the TM A Return false.
Given recurrence: $T(n) = T(n^{\frac{1}{a}}) + 1$ where $a,b = \omega(1)$ and $T(b) = 1$ The way I solved is like this (using change of variables method, as mentioned in CLRS): Let $n = 2^k$ $T(2^k) = T(2^{\frac{k}{a}}) + 1$ Put $S(k) = T(2^k)$ which gives $S(\frac{k}{a}) = T(2^{\frac{k}{a}})$ $S(k) = S(\frac{k}{a})...
$T(n) = \sqrt{2}T(\frac{n}{2}) + \sqrt{n}$ I am trying to solve this question by recursion tree method, do we have any way in which we can draw a recursion tree for this eqn. I just don't want to use master or extended master theorem
We have a set of $n$ products, each $i$th product can be kept in a temperature between $c_i$ and $h_i$. We have to buy fewest number of fridges for these products. The fridges can only have a fixed temperature. For me I think of this problem as intervals of product temperatures that are placed on the axis. My i...
I am learning algorithms from the CLRS book on my own, without any help. It has an exercise which combines merge sort {O(n log n)} with insertion sort {O($ n^{2} $)}. It says that when the sub-arrays in the merge-sorting reach a certain size "k", then it is better to use insertion sort for those sub-arrays instead of m...
Question 1: Given N sets of points $S_1$ ... $S_n$ (no intersection between $S_i$ and $S_j$ when i != j), I want to find subsets of $S_1$ ... $S_n$ (call them $T_1$ ... $T_n$ respectively) So that for any point in $S_k$ ,the nearest neighbor to it in $\bigcup_{i=1}^{n} T_{i}$ is in $T_k$, Obviously $T_k$ = $S_k$ (k= 1...
By my understanding, operating system is the abstraction layer above hardware. Which means that an operating system that supports two different CPU architectures can run the same code. But I still cant understand the details/steps of executing a given program. Suppose, I have a program that takes 2 numbers from the use...
I know that the main(sys.argv[1:]) is the function call statement but I have no idea about the other two variables and why it's used. Can anyone explain?
My approach:- I separated the x coordinates and y coordinates in 2 separate arrays..then i used the idea of pythagoras theorem by selecting three vertices(1 from x axis and 2 from yaxis and vice versa) but it's taking too much time..can anybody suggest me a better approach?
I have PDA which has final state that accept 'c' char, and there isn't any cross to other state. The input abca will accept, because there is 'c', or the PDA would stuck?
For the following grammar, how can I include both precedence and associativity of operators: S -> S|S S -> S.S S -> S* S -> (S) S -> a|b Note: In the first rule S -> S|S, the symbol | is the OR symbol and not two rules. Here, operators are |, ., * and (). PS: Suppose the precedence order is : () > * > . > |. And all ...
I'm really confused with definition of computational effects. What I knew and understood about computational effect were only that they're impure computation, but someone noticed me that computational effects includes continuation which doesn't seems to be impure. please someone reason these things. Sorry for babbling,...
I have been solving some algorithm questions recently and a pattern I have observed in some problems is as follows: Given a string or a list, do an aggregation operation on each of its elements. Here in each of these elements we apply some recurrence to solve it. An example of one such problem is below. Problem: Give...
The language is $S = (a^nb^m | n \geq m)$. I'm having trouble understanding MyHill Nerode theorem. Basically if I want to use MyHill Nerode theorem to prove $S$ is non-regular, I have to show that there are infinitely many equivalence classes. So in this case if I choose $S = a^n$ is simply not working since $n \geq m$...
I am looking for some help in devising/researching an algorithm. I have come up with some solutions on my own, but would like some guidance as to whether there exists a more formal/robust/mathematical solution. The problem can be stated as follows: I would like to purchase X amount of a good at as low of a price as ...
I'm wondering if there exists an algorithm to solve the following problem: Given a grammar $S$ of a context-free language $\mathcal{L}$, find a grammar $S'$ such as $L(S) = L(S')^c $. I note that the complement of a context-free language is also a context-free language, so the questions is well stated.
Lets say, we provide the algorithm a set of tokens. e.g. x + y - z x - x - x It will then try to generate a CFG which fits all the provided examples S -> S O T | T T -> x | y | z O -> + | - It feels like a data compression problem but I could be wrong. Does anybody know any existing literature or a starting point to ...
I came across a book where the author uses the following property of mutual information: Let $X$,$Y$,$Z$ be arbitrary discrete random variables and let $W$ be an indicator random variable. $$ (1)\ \ I[ X : Y \mid Z ] = Pr(W=0) I[ X : Y \mid Z, W=0 ] + Pr(W=1) I[ X : Y \mid Z, W=1 ]\ $$ I don't understand why thi...
Given the language: $$ L=\{ \omega \in \{ a,b,c,d \}^* : |\omega|_a = |\omega|_b \} $$ I propose the following grammar: $$ \begin{align*} S &\to \varepsilon \mid aSbS \mid bSaS \\ S &\to cS \mid dS \mid Sc \mid Sd \end{align*} $$ I want to know if this is correct or if there exists a smarter grammar (a shorter gramm...
Consider the language $$L = \{ w\in \{ 0, 1\}^*: \#_{010}(w) = \#_{101}(w) \}$$ Is $L$ is regular? If it is not regular, can we prove that using the pumping lemma (only with pumping down)?
I'm creating an app that receives some map between finals and the respective periods during which they are held and a student's required finals. I was wondering if there was an algorithm to enumerate all complete schedulings of these finals. Concretely, I have a list of finals for a specific student and each $F_i$ has ...
From Kozen's Automata and Computability, 3ed, lecture 32 p. 328: What are HP and MP in this context? I tried looking around and this text says: How did the halting problem and membership problem become regular expression? I am so loss here.
I was reading a book on OS by Galvin. I well understood that blocking send will wait until it has loaded the message into the kernel buffer. In contrast, the non-blocking send system call will return a check value indicating a successful or unsuccessful event. Please can someone explain the difference between blocking ...
I understand that in programming languages in general, function routines have what I can generally name a parameter set (or "list"), usually symbolized with parenthesis and if it is not empty, it is also utilized in function calls. In JavaScript: function myFunction (passed_parameter_1, passed_parameter_2) { // Som...
I'm considering the standard Erdös/Renyi $G(n,p)$ model where we have $n$ nodes and each possible edge is sampled independently with probability $p = \frac{1}{n^\epsilon}$. It is relatively straightforward to show that, starting from any node $u$, the expected number of hops to reach every other node is $1/\epsilon$. ...
This would be analogous to the Kolmogorov complexity of a string, except that in this case, I'm interested in the algorithm that solves a given problem using the least number of steps. We would therefore have to be able to show that any other algorithm is at best of the same order of complexity as the algorithm in ques...
I am looking for a textbook that helps me understand how basic digital electronic units are used to build complicated integrated circuits. I have looked online for textbooks, but what I have found tends to be either At a level of abstraction below what I'm looking for: textbooks on the nitty gritty electrical enginee...
Here is the algorithm: int sum = 0 for (int i = 2N; i > 0; i = i / 4) { for (int j = 0; j < i; j+=2) { sum++ } } I figured this would be linearithmic, but it's just linear. I would appreciate seeing a formalized summation and not a qualitative explanation. I have tried doing this but I fail to get linear runti...
I am studying CSP for my master thesis. I found that many thesis based on CSP described N-Queens as an introductory and they actually do experiment on random CSP problems. If so,when I do master thesis in CSP,it is reasonable to experiment algorithms with N-Queens. How can N-Queens problem be changed CSP parameters l...
Here is an example problem which I have having trouble figuring out. The red text is the answer. I get how the values are added before the hashtable is resized... that is common sense. (Insert 0 at index 3, 5 at index 1, etc.) But when the table is resized, each element has a new position. HOW is 1's new index 0? HOW ...
Which induction schemes (e.g. induction-recursion by Dybjer and Setzer, "Irish" induction-recursion by McBride or induction-induction by Forsberg and Setzer or perhaps some simpler ones) allow one to encode the following Agda definition data A : Set where a : Maybe (List A) → A I can think of some tricks to refo...
A typical bubble sort steps through all pair indices until it reaches the end of the list, then starts a new pass. For a toy problem, we have a variant that just performs the first available swap in each iteration and repeats until sorted. It does not continue from the position of the last swap. Is there a standard nam...
i am getting really confused by it. i got to a point i had to calculate the lim when $n \rightarrow \infty$ for an optimization problem, and i got to the point that i had to calculate a fairly simple limit: $lim_{n \rightarrow \infty} {3-\frac{7}{n}}$. now i used $3 - \epsilon$ and i am trying to show that there can'...
I've just attended an algorithm course, in which I've seen many sorting algorithms performing better or worse depending on how much the elements of an array are sorted already. For example, for what I've heard, quicksort is preferred most of the times, yet still it has $O(n^2)$ complexity in case the array is sorted al...
I try to prove that this function is recursive: $$f(x_1,x_2)= \begin{cases} 2x_1-x_2 & \text{if $x_1 \geqslant \sqrt{x_2}$} \newline \bot & \text{otherwise} \end{cases}$$ I think that I need to use minimization operator but I don't know how to do that. $\qquad $ $\qquad $ $\qquad$ Maybe i have to prove that $$\mu y(...
Is there a simple procedure for constructing a grammar that is LR(k) but not LR(k-1) for any k?
I know there alot of questions on Dynamic Programming and I feel I have a handle on the theory, use the answers from sub problems to answer the current problem, without the redundancy of recursion. My confusion comes from implementation. Here is a specific question. Every question I look at builds its grid different...
I keep seeing two versions of the Subset Sum Problem. The first and seemingly least common is: Given an integer bound $W$ and a collection of $n$ items, each with a positive integer weight $w_i$, find the subset $S$ of the items that maximizes $\sum_{i \in S} w_i$ while keeping this sum at most $W$. Or the decision ve...
The problem is to solve the recurrence using Master Theorem : $$T(n) = 2T(n/2)+\log_2 {n}$$ My attempt: $$ a=2, b=2, f(n)= \log_2 {n}, g(n)=n^{\log_b{a}}=n $$ I am torn between case 1 & the Master Theorem not applying. I notice that $\log_2{n}$ cannot be written as a polynomial, but the ratio of $f/g = \log_2{n}/n$, w...
The language $S_c$ defined as: $S_c = \{wtw^R \mid w,t \in \{0,1\}^\star \text{ and } \lvert w \rvert = \lvert t \rvert \}$ It looks like the language can be "pumped" by context free pumping lemma, but the pumping lemma doesn't prove the language is context free. So I'm thinking of building a PDA that recognizes it. B...
For most sorting network diagrams how do you work out that it is not a sorting network? What is the method to work it out ?
I'm confused if the following approach is mathematically correct Suppose I have to prove $(\log n)! > n^a$, where $a$ is a constant I can assume $n = 2^k$ which leads to $k! > c^k$, where $c = 2^a$ The conclusion is true since factorials have a higher rate of growth than exponentials. My doubt is, is it correct to term...
Given N * M 2-D matrix find out all the 0's which are completely bounded by the all 1's. ( This is not any online platform question ) (This problem statement I faced during an interview). Sub-matrix or matrix which is forming the square or rectangular boundary should only contain 1 in it and 0's should inside that boun...
Consider the following algorithm: run algorithm A until a solution or out of memory run algorithm B Then if A does not solve the problem, a computer with less memory has an advantage. This could be solved by running A and B in parallel, but then the resulting parallel algorithm could be renamed A' and run: run algor...
$Can$ $a$ $TLB$ $hit$ $lead$ $to$ $a$ $page$ $fault?$ My answer is yes, as say even after a TLB hit if the page in the memory is dirty and it will lead to Page fault. Other case can be that, it is read only and we want to write that page which will eventually lead to page fault. Now wrt this context, let me ask u que...
I'm trying to determine the complexity of the following structure: for (i = 1; i < n; i++) for (j = 1; j < o; j++) for (k = 1; k < p; k++) print "Hello world!" Normally, for a triple loop like this, I believe the complexity is O(n^3), but the undefined variables "o" and "p" are throwing a wrench in the works. I've don...
Let us say I am given an algorithm that calculates the transitive closure of a given graph $G = \{ V, E \}$. How can I use this algorithm in order to perform the Boolean Matrix Multiplication of two matrices $X$ and $Y$? I know that in order to calculate the transitive closure of a matrix $I$ need to compute $I^{(V-1)}...
I am in an algorithms course, and my professor keeps specifying "we are talking about Problem complexity here, not Solution complexity". I would like to gain an intuitive understanding of the difference between these two. Do you all have an example(s) that can help me to understand?
I'm trying to create a grammar (having the highest type) for the language: L = {$a^{k}$$b^{n}$$a^{m}$ : m,n,k $\in$ $N^{+}$ $\land$ m +k $\geq$ n} I'm not finding any good approach for it. Hints or ideas? Thanks!
The language is defined as $$L = \{0^n10^m10^q \mid n,m,q \in \mathbb{N}, q \equiv nm \mod 5\}.$$ Can someone help me get started on this question? I don't know what part of the question I should do first. I have made an automaton that keeps track of $\mod 5$, what next?
Create an CFG for all strings over {0, 1} that have the an even number of 0’s and an odd number of 1’s. Also, I have a hint HINT: It may be easier to come up with 4 CFGs – even 0’s, even 1’s, odd 0’s odd 1’s, even 0’s odd 1’s, odd 1’s, even 0’s – and combine them ... But I can't understand how it works Who can help?
The following is what I came up with from my synthetic prior research but I might be wrong. I understand it is possible to reduce any computer "program", in a maximal reduction(?), to these features: Internal implementation: Everything from start to end, including possible functions and possible sub functions External...
I recently came across this question and honestly am pretty unsure of how to solve it, or even begin to develop an algorithm to properly solve it.. The question is: "An array of $n$ integers is correctly positioned with respect to an integer $k$ if for any $k$ consecutive indices in the array, there does not exi...
I am trying to prove that, in an optimal encoding (possibly Huffman?), if letter frequencies are increasing, their encoding lengths are monotonically decreasing. It is intuitive that this makes sense, but I'm not sure how to write it formally. Here is what I have: Let $x_1$ and $x_2$ be two letters in the encoding wher...
I'm looking for a easier algorithm to implement to solve the travelling salesman problem (in javascript). Unluckily all of the ones i found are really hard to understand/ to implement. The ones i already have are the nearest/farthest-neighbour-algorithms. Do you guys have any other suggestions?
Consider a typical data-flow problem, for example, reaching definitions or available expressions. I am struggling to understand how $IN$ and $OUT$ of the basic blocks are initialized. For example, for available expressions, we initialize $OUT[B] = U$ for all $B$, that is we assign each $OUT[B]$ all expressions, while ...
I understand that a binomial heap can be represented as binary numbers according to the degree of each tree but what exactly is the relationship between inserting a new node into the binomial heap and incrementing the binomial number. In addition to that, I assume that there is a relationship between performing union ...
I am confused regarding a propositional logic representation of a sentence. Please note that this sentence is not realistic: "A person who is male (M) is smart (S) if he is tall (T), but otherwise is not smart." Which of the following propositional logic formulas correctly represents the above: (a) $(M \wedge S) \iff ...
I have been puzzled by the following question on an exam for quite a while: given a set of monsters with their health and attack damage (per second), design an algorithm that minimizes your overall damage received given that you can do one damage to one monster each second. Note: all monsters that are alive attack simu...
I want to describe my search tree in an algorithm and describe how each level of the tree is created. But I cannot find good examples to help me express how to write it in an elegant way. Please if anyone can recommend a good resource for describing a search tree in detail in a pseudo code.
My computer specs: Processor type Intel(R) Core(TM) i7-8550U CPU @1.80GHz 1.99GHz Installed RAM 8.00 GB System Type 64 bit operating system i also have Intel UHD graphics 620. I am starting an AI course in college and we have been given the project to submit by the end of the semester. i want to use deep learnin...
I understand the definition of Load Factor and how Quadratic Probing works. But what happens in the case where quadratic probing cannot find an empty slot for a new element? According to https://en.wikipedia.org/wiki/Quadratic_probing: In the case of quadratic probing, with the exception of the triangular number cas...
Consider the following function on binary trees, which is supposed to tell whether a given int is a member of a binary tree t: type tree = Leaf | Node of int * tree * tree;; let rec tmember (t:tree) (x:int) : bool = match t with Leaf -> false | Node (j,left,right) -> j = x || tmember left x || tmember righ...
I am trying to read an algorithm for computing minimum distance between each pair of points from the book: Algorithm Design Algorithm Design It considers the points in a line. If the points are in a line why we need to sort them? We can start from the beginning and compute the distances from starting pint to all the...
Yeah, this is for a homework assignment, but I hope that you'll humor me anyway. I am asked to design an algorithm that finds the natural logarithm of a number. This would be straightforward, but I'm not allowed to use strategies that involve integration, bit manipulation, approximation formulas, or Taylor Series. Inst...
I'd be glad for an explanation on the analysis of this exercise. Given these functions: $$f(n) = n^2 \\ g(n) = n^{2/3}$$ Show that $f(n) = O(g(n))$, or $f(n) = \Omega(g(n))$ and comment if $f(n) = \Theta(g(n))$ In my answer, it is $\Theta(g(n))$ with $n_0 = 1, C = 1$ PS: The exercise requires a mathematical demonstrati...
Suppose that we have a max heap and that it contains duplicate values .Is it always true that nodes with same value are adjacent(neighbors)?I think it is true because if there was any other node being intercepted between them then this would break the max heap property as it would be out of order(with respect to value)...
I have to prepare for a midterm and I am looking for a resource where I can practise the three basic sorting algorithms insertion sort, bubble sort and selection sort a little. Last year they had to sort an array with n elements and the elements were integers with values between 0 and m-1 and the complexity had to be o...
Have to find Boolean circuit formula that solves PARITYn problem with complexity O(n^2)? (Function PARITYn(x1, . . . , xn) is equal to 1 if and only if the number of variables x1, . . . , xn equal to 1 is odd.)
Consider the following problem: We are given a collection of $n$ items $I = \{1,...n\}$, each item has a size $0 < s_i \le 1 $ and a profit $ p_i > 0 $. There are $m$ (a fixed number) of unit-size knapsacks. A feasible solution is an $m$-tuple $U=\{U_1,...,U_m\}$, such that the size of items in each knapsack doesn't ex...
I'd like to remove the minimum number of edges from an undirected unweighted graph to partition the nodes into an arbitrary number of connected components $S_1$, $S_2$,$S_3$,... $S_k$ while maximizing the size (number of nodes) of the smallest partition and with a constraint limiting the size of every partition: $|S_i|...
Note: I come from a mathematics background. The Thue-Morse sequence $t_n$ is a binary sequence that takes the value $0$ at the positive integer $n$ if the number of $1$s in its binary expansion is even, $1$ otherwise. A definition that is closer to computer science states that $t_n$ is the binary sequence obtained by...
What is the time complexity of $$\sum_{i=1}^n 1+\lfloor\log_2 i\rfloor$$ and how do you calculate it?
We get two arrays: ordering = ["one", "two", "three"] and input = ["zero", "one", "two", "two", "three", "three", "three", "four"]; We want to find the array output so that output = ["one", "two", "two", "three", "three", "three", "zero", "four"] // or output = ["one", "two", "two", "three", "three", "three", "four...
Given the Turing machine $M = ( \{q_0, q_1, q_2. q_3,q_4\}, \Sigma= \{a, b, c \}, \Gamma = \{a, b, c, \}, \delta, q_0, , \{q_4\} )$ where $q_0$ is the start state, $q_4$ the end state and the blank symbol. $\delta$ is defined as: Let $w$ be any word of length $n$ accepted by the Turing machine $M$. Is it always tr...
Given the following language: L = {$a^{2m}$ $c^{4n}$ $d^{n}$ $b^{m}$ : m,n >= 0} I’m trying to design a PDA. My aproach is: -for every 2 ‘a’ push an ‘a’ -for every 4 ‘c’ push a ‘c’ -then pop them to solve the 2nd half of the language This is the first part to count 2 ‘a’, but the ‘c’part is not very clear: Any hints or...
If $L_1,\,L_1L_2$ are regular languages with $L_1\neq \emptyset,\,\lambda\notin L_1,\,\lambda\notin L_2,$ is $L_2$ regular? I think I found a correct proof for this question but my professor says it cannot work. Her issue is with the right quotient step but I cannot see why it is incorrect. Can anyone shed some light o...
I'm trying to prove that the recurrence $T(n)=2T(\left \lfloor \frac{n}{2} \right \rfloor) + n$ is in $\Omega(n \log_2 n)$. Here's my attempt: Suppose there is some $c>0$ and a positive integer $n_0$ such that $n_0 \le k < n \implies T(k) \ge ck \log_2 k$. Then $$\begin{eqnarray*} T(n) &=& 2T(\left \lfloor \frac{n}{2}...
The title pretty much says it all. I want to know if Knapsack is still NP-complete when the weights, values, and weight limit are restricted to a finite set of values. I figure that it wouldn't be because clearly for very small finite sets it isn't. (E.g., if you must use integers from 1 to 3.) That said, I'm strugglin...
Given an positive integer $n$, we define an order of subset sums (or simply, an order, when there is no ambiguity) to be a sequence of all subsets of $\{1,\ldots,n\}$. For example, when $n=2$, the sequence $\emptyset,\{1\},\{2\},\{1,2\}$ is an order. We call an order $S_1,\ldots,S_{2^n}$ valid if there exist real numb...
I am trying to prove the hardness of the following problem. This problem is from google hashcode, qualification-round, 2020. Hier is a brief description of the problem. Given a list or libraries and a list of books. Each book $b$ has a number of points $P_b$. We want to scan a subset of the books in a way that maximize...
I was reading https://www2.cs.duke.edu/courses/spring02/cps296.1/lectures/08-view.pdf Or in the paper "Incremental Maintenance of Views with Duplicates," by Griffin and Libkin, SIGMOD, 1995. figure 2. I don't understand why we need to min(R,ΔR) before -. Is there any counterexample?
I'd like to read a book on the history of programming languages, that places their development into the context of their times. What was the context in which concepts like structured programming, object oriented programming etc were developed? I was introduced to programming when OOP was well developed and hence I don'...
This question has been asked and the top answer https://stackoverflow.com/a/38173155/12862537 is not satisfactory. So, it would be nice if someone could specifically point out the similarities and differences between the two. About the answer at the mentioned link: The term busy-waiting tends to mean that you are will...