instruction
stringlengths
35
29.1k
The multiple knapsack problem (MKP) is defined in "A PTAS for the Multiple Knapsack Problem" as: Instance: A pair $(B, S)$ where $B$ is a set of $m$ knapsacks and $S$ is a set of $n$ items. Each bin $j\in B$ has a capacity $c(j)$, and each item has a size $s(i)$ and a profit $p(i)$. Objective: Find a subset $U\subsete...
While I was using the Genetic Algorithm to generate full correct Sudoku grids starting from a population of random grids, I occasionally face the problem of the process being stuck on a local maxima until the population loses its diversity. So, I decided to find a mechanism for maintaining the diversity of the populati...
$$L=\{M\mid \text{there exist }x,y\in\Sigma^* \text{ s.t. }x \in L(M)\text{ and } y \notin L(M)\}\,.$$ I think it's not recursively enumerable because this language reduces to complement of the membership problem. $\langle M,w\rangle$ would be input where $y$ would become $w$ and $x$ belongs to $L(M)$. Please tell me ...
There are two orderings of numbers from the same set. Number $a$ is "immediately before" $b$ iff $a$ appears before $b$ in both sequences and there is no other number that appears between them in both sequences. So in this example: Seq 1: 1 2 3 4 5 6 Seq 2: 6 2 1 3 5 4 1 is not immediately before 2 because they appea...
I have an undirected graph with weighted edges, in which I want to find the shortest paths from an initial node to every other node. Obviously Dijkstra's algorithm is usually a good choice, and I have previously used the variant where a min-priority queue (heap) is used to keep the set of tentative nodes $N_T$, and nod...
I'm trying to find any publications involving a system that can classify if there is physical contact in a video. Ideally, if the physical contact is brief, it would also be beneficial to classify. However, despite this clearly defined problem, I've been unable to find any mention of this in the literature. I am able t...
Consider this example from Wikipedia: P1 | W(x)1 ---------------------------------- P2 | R(x)1 W(x)2 ---------------------------------- P3 | R(x)2 R(x)1 ---------------------------------- P4 | R(x)1 R(x)2 Where P1 - P4 are different processors that issu...
Assume $n$ is much greater than $m$. Would $O(nm)$ simplify to $O(n)$? Is there an explanation?
To check that a rational number is in the Cantor set, I have written an algorithm to obtain its base-3 representation. To verify if the representation is periodic, I used a hash table in order to save memory. Is there any easier solution to check that a rational number is in the Cantor set?
i want to do a polynomial reduction from the Independent-Set-Problem which is NP-complete to the AUCTION-Problem, to show that AUCTION $\in$ NP-complete, but why do i always have to show first, that our problem(in this case AUCTION) $ \in $ NP?
Why is computing the function at certain ranges of h $$f(x) = \dfrac{\sqrt{-x+a} - \sqrt{2x+a}}{ 4a}$$ unstable? How would I rewrite this function so that it is stable?
I'm stuck trying to implement a DFA to do this. Everything I've tried so far seems to have to be able check the next nine elements to determine if the string terminates. Any tips?
I read the Wikipedia entry about "List of NP-complete problems" and found that games like super mario, pokemon, tetris or candy crush saga are np-complete. How can I imagine np-completeness of a game? Answers don't need to be too precise. I just want to get an overview what it means that games can be np-complete.
Well known example of Context-sensitive grammar which produces language $\{a^nb^nc^n|n\geq 1\}$ is widely used in various papers. But actually, while this language is definitely context-sensitive, it is also belongs to smaller subset of CS-languages: it is indexed language, because it can be described with indexed gram...
I am trying to prove $L =$ {${a^k|k=2^n, n \ge 0}$} is not regular. So far I have identifed a string $s = a^{2^p}$, and I've divided $s$ into $xyz$ as follows: $x = a^l$ $y = a^k$ *(where $k + l \le p$) $z = a^{2^p-l-k}$ Now, when I start to look at pumping, I first select $i=0$: $xy^iz = xy^0z = xz = a^la^{2^p-l-k}=a...
Let's say that I have a standard feedforward neural network which has $M$ inputs, some number of hidden layers $N$, and a single neuron in the output. Is it possible to construct a network such that the output neuron's output value is the maximum weighted input value? I know that I could easily hard code something to m...
I am struggling with a proof from my discrete mathematics class. We have to prove that multiset union is idempotent, i.e. $M \sqcup M = M$, where $\sqcup $ denotes the union of multisets. We have defined multiset union (using lambda notation) as $M_1 \sqcup M_2 := \lambda x : X \cdot M_1(x) + M_2(x)$, which means that ...
I am trying to answer exercise 3.1 from Sedgewick and Flajolet's "Introduction to the Analysis of Algorithms". That is, I am trying to find the Ordinary Generating Function for the sequence: $$\{kH_k\}_{k \geq 1}$$ I think that the generating function for this sequence is: $$H_1 + 2H_2z + 3H_3z^2 + 4H_4z^3 + ...$$ whi...
I know for pretty sure that there is a function with the type $f: \forall \alpha, \beta . \alpha \rightarrow \beta$ (at least in a Hindley-Milner type system), but I can't wrap my head over it. Neither could I think of an actual function with this type. I found a function of this type, which in Standard ML would be wri...
According to Wikipedia, A $\rho$-approximation algorithm $A$ is defined to be an algorithm for which it has been proven that the value/cost, $f(x)$, of the approximate solution $A(x)$ to an instance $x$ will not be more (or less, depending on the situation) than a factor $\rho$ times the value, $OPT$, of an optimum sol...
Wikipedia has this pseudocode on bucket sort: function bucketSort(array, n) is buckets ← new array of n empty lists for i = 0 to (length(array)-1) do insert array[i] into buckets[msbits(array[i], k)] for i = 0 to n - 1 do nextSort(buckets[i]); return the concatenation of buckets[0], ...., b...
To my understanding: The Church-Turing thesis means that one could theoretically compute anything that can be computed using either a Turing Machine or the Lambda Calculus. The Lambda Calculus is based on mathematical functions. This leads to the inability of "pure" functional programming languages based on Lambda ...
In this How to show composition of one way function is not such? question, the accepted answer uses g(x,y) as a one way function. But, for a given output of g(x,y) = 0|x| of length l (say), isn't the output of g(any x of length l, 0l) the same as the earlier output? Isn't this a possible preimage of 0|x|?
Before we start, my textbook declares lgn as base two. I only have one question, how did log2 become n (both highlighted in yellow in the picture)? Is it because log2 = 1, which is too small to even matter?
I have recently been investigating dynamic topology neural networks and there is only one problem I have with understanding them. Because a neuron could be inserted at any point, the neurons are no longer organised into layers, so how is it possible to ensure that all of the inputs for Neuron A at position X have been ...
I'm trying to prove the following language is in $L$ (decided by a TM in $O(\log n)$ space): $$A = \{ (C,x) \mid C(x)=1\text{ and $C$ is a Boolean formula with depth }\log(n)\}\,,$$ where $n = |(C,x)|$. Equivalently, $C$ can be a Boolean circuit with maximum fan-out of $1$.) Checking if a word $w$ is in "the right for...
The a^n was pretty easy: function powN(a, n) { if(n == 0) return 1; return a * powN(a, n - 1); }; But somehow I got stuck on a^(2^n), any suggestions or even a hint? I need a recursive algorithm that solves: a^(2^n).
Let $X=\{x_1,...,x_N\}$ be a set of real numbers. We consider $M$ sums over its subsets, e.g. $N=9$, $M=3$ $$ \begin{align*} s_1&=x_1+x_2+x_3+x_9,\\ s_2&=x_1+x_2+x_4+x_9,\\ s_3&=x_1+x_2+x_5+x_9 \end{align*}$$ There are repeating subsums, e.g. $x_1+x_2+x_9$. If subsums are extracted and summed up separately, one needs 5...
Given a Turing machine $M$, we associate a partial function $f_M : \Sigma^{\ast} \to \Sigma^{\ast}$ to it (this is called the function computed by the machine), where $\Sigma$ denotes the finite input and output alphabet, defined as $$ f(u) = v :\Leftrightarrow \mbox{The machine halts on input $u$ with output $v$}. $$...
I implemented Q-learning and double-Q-learning as presented in Sutton's "Reinforcement Learning: An Introduction". I test the algorithms on the OpenAI cliff walking gym and analyze the resulting policies after 500 episodes. I was expecting the two policies to be the same, but actually the policies differ: Policy learn...
I brought the book Lambda-Calculus and Combinators: An Introduction by J. Roger Hindley and the author explains what is $\beta$-reduction. Now there is a difference between $\beta$-contracts and $\beta$-reduces: $$ \begin{align*} P &\rhd_{1\beta} P^\prime\\ P &\rhd_{\beta} P^\prime \end{align*} $$ Could someone please...
I've just had a thought about multiple precision number (i.e. variable length integers). The naive way to represent numbers is to use an array sized in such a way that the number of required bits can be stored. Example say we dispose of words of size $L$ and we want to store $N \leq 1$ bits, then we need an array of si...
Consider a consensus process in which participants Initially take a position Receive positions only from their neighbors Accept a new position that is a super-majority of neighbors positions. Under what conditions is it possible for any participants to accept different new positions, regardless of whether they are ne...
I have a problem, which appears to be similar to number partitioning: a set of numbers partitioned (two-way), such that the sum of the numbers in each subset are as close as possible to a targeted ratio (instead of having the minimum difference, as in the number partitioning problem). Can I use the same algorithms? How...
While calculating the cost in linear regression (for either with multiple features or a single one using gradient descent) we compute the cost by squaring and summing up the cost related to each training set. What is the point of summing up the cost related to each training example is what I do not understand. Why not ...
I want to do an analysis on the sum $ \Sigma_{i=0}^n f(i)$. All that is known about $f(i)$ is that $f(i) \in \Theta (i \log i ) $. How do I do this?
I was working through an NFA to DFA conversion tutorial: where I'm converting the following NFA to a DFA: I used lazy subset construction which I'm sure the tutorial did as well because we had the same transition table of: delta | 0 | 1 | ===========+===========+==========+ {a} |{a,b,c,d,e}|...
I have a question on the statement of the s-m-n Theorem and the implication $$ \varphi_{f(x,y)} = \lambda z \varphi_x(\varphi_y(z)) $$ for some recursive function $f(x,y)$ cited in the above link. In what sense does this follows from the s-m-n theorem and in what sense does it gives anything new? To be more specific....
In Chapter 5 of the Arora–Barak complexity theory textbook we are asked to prove the following statement: If 3SAT is polynomial-time reducible to its complement then PH=NP. How do I prove this statement?
I feel understanding why data flow is higher level than control flow is key to writing good code (and convincing others during code reviews). I find this repeatedly when arguing why my functional style programming with immutability is superior to their mutable state code which is more common and expected. But I don't u...
This is something I couldn't find - but I always found it interesting that the pumping lemma is just a lemma (especially since it has the same name for regular languages, context free languages, etc...) What is it a lemma to?
The Schensted insertion algorithm has an $O(n^2)$ running time, for constructing such a standard Young's Tableaux. But, since every permutation has a unique Young's tableau, there seems no reason as to why it cannot be done in $O(n \log n)$ time, which is the optimal time to identify a permutation. Are there any known ...
I am studying what coinduction is. In particular, I am reading that coinductive datatypes can be defined as elements of a final coalgebra for a given polynomial endofunctor on $\tt Set$. I've seen that $A^w$, infinite streams over an alphabet $A$, is the final coalgebra of the functor $FX \rightarrow A \times X$, and s...
There exists a very close and well-known relation between a vertex cover and an independent set in a graph $G(V,E)$ ([1]): if $S$ is an independent set of $G$, then the set $V$ \ $S$ is a vertex cover of $G$. The same complementarity relation holds obviously for a maximum independent set $S$ and the set $C = V$ \ $S$ t...
How would you write the following equations in $O,\Omega,\Theta$ notation? $$ \begin{align*} t(n) &= 4n^4 + 3n^5 + 3n^6 \\ g(n) &= 2n^6 + 5\log n \\ f(n) &= 50n^5 \end{align*} $$
In the second phase of the paxos algorithm, the proposer issues an accept request with the number n and the value v it got from the acceptor, if the acceptor has already chosen a value previously. My questions is why the proposer is doing this? Because once a value if chosen it is permanent and cannot be changed, so in...
Consider the language $L = \{0^p \mid p \text{ is a composite number}\}$. I know that this is not a regular language. I have thought that to prove this language is not regular take the complement (prime numbers) which must be regular, but its complement has prime numbers and 0 and 1 occurrences of 0's. Could anybody gi...
I got the following as an interview question: Count the number of tours from the upper left corner to the lower left corner in a grid world where you can move in any manhattan direction. This is the number of Hamiltonian paths from upper left to lower left: a path such that every vertex is visited only once, and (this...
From Wikipedia: In theoretical computer science, correctness of an algorithm is asserted when it is said that the algorithm is correct with respect to a specification. But the problem is that to get the "appropriate" specification is not a trivial task, and there is no 100% correct method (as far as i know) to get the ...
Let $A$ be a decision problem with at least one yes instance and at least one no instance. Also let $B \in \textbf{P}$. How could I prove that B reduces to A in polynomial time? Thanks in advance.
I'm trying to understand how we can get the time complexity of Dijkstra's Algorithm down from O(V²) (for a matrix-implemented Dijkstra's) to O(V) if the edge weights of our graph are bounded by a constant C. I've read up on this MIT lecture but can't really wrap my head around the explanation. It says that all paths a...
I am trying to figure out how to make an unambiguous grammar for palindromes over the alphabet {a, b}. I have the following, but it is ambiguous and causes conflicts in yacc. S -> a S a | b S b | a | b | ε Is there a way to convert this to an unambiguous grammar? Or is there another solution?
PARTITION: Given a set of positive integers $A=\{a_1,...,a_n\}$ does there exist a subset of $A$ with sum equal to the sum of it's complement? SUBSET SUM: Given a set of positive integers $A=\{a_1,...,a_n\}$ and another positive integer $B$, does there exist a subset of $A$ such that it's sum is equal to $B$? I was try...
Brief problem description I'm using a Basel Morphable Face Model, which was labeled with MPEG4 and Farkas landmarks. I can generate different faces, use different lighting conditions, rotations, perspective etc. I want to use it to train an algorithm in order to find these landmarks on real pictures further. More stric...
I was reading the venerable "How to Find or Validate an Email Address [using Regex]", and I came across the following statement at the bottom of the page: [A] true regular language cannot enforce a length limit and disallow consecutive hyphens at the same time. This seems wrong to me. I feel like if the length of a...
In wikipedia NFA-ε transition function defined as follows $Δ : Q × (Σ ∪ \{ε\}) → P(Q)$, where $Σ$ is an alphabet and $ε$ - empty string. I don't understand the meaning of $ε$ in this context. Assuming $ε$ means a sequence of symbols with length of zero, as per definition. Alphabet $Σ$ is a set of symbols. But symbol $\...
So, I've been conferred upon the opinion that: Union, difference, cross product, selection, projection form the "complete set of relational operations". That is, any other relational operation can be expressed as a combination of these (excluding domain manipulation operations like aggregate functions I assume). Qu...
I have created an algorithm to find all palindromes in a string, and studied the related theory (Manacher, Suffix trees) and prior work and don't think my algorithm relates to any of the existing ones, and the implementation of my algorithm is 3 times faster than a Manacher implementation. Now I want to get it peer-rev...
Can anyone please help me try to understand what will the state diagram look like for this question: Let $L = \{x_0y_0z_0x_1y_1z_1\ldots x_{n-1}y_{n-1}z_{n-1} \mid \exists n,x,y,z \, x+y=z \land x=\sum_{j=0}^{n-1} x_j2^j \land y=\sum_{j=0}^{n-1} y_j2^j \land z=\sum_{j=0}^{n-1} z_j2^j \land \forall i \, x_i,y_i,z_i \in...
Consider strings $s \in \{0,1\}^*$. Define $c_1(s)$ to be the ones' complement of $s$; i.e., the string obtained from $s$ by inverting all of its bits. So, for example, $c_1(000111) = 111000$. Call a language $L \subset \{0,1\}^*$ ones' complement closed, or OCC, if $s' \in L$ $\iff$ $c_1(s') \in L$, provided $s'$ is n...
Can a Turing machine $M_A$ determine if the Turing machine $M_B$ accepts the set $W_k$? I am curious about the answer to this as I am thinking about using the truth value of it on using it for a recursive enumerability proof.
I don't really understand how we can use the fact that the edge weights are integers in the range [1, 2, ... , C] in order to speed up the computation of Dijkstra's algorithm. I read this lecture but I still don't really get it. I understand why we make an array of size |V|C + 1 holding buckets where we put nodes with ...
I have been studying Process Synchronization and inter-process communication in Operating Systems Engineering and have come across multiple problems like "Sleeping Barbers", "Producer Consumers", "Dining Philosophers" and "Reader Writers" . While working on these problems I found them very interesting and I get a sort ...
I'm trying to train a load-balancing system with reinforcement-learning (RL) s.t. the incoming jobs are queued evenly at the available servers. The system will not be able to directly dispatch the jobs, but it will only offer suggestions to use a set of servers over another. The system will also be capable of reducing ...
I want to calculate the determinant of a matrix. Currently I'm using LU decomposition. To check my algorithm I wrote a unit test with random matrices. In one part I set one row to be equal to another row to test if the resulting determinant would be 0. This is the matrix: $\begin{pmatrix} 0 & 0 & 33 & 17 & 42 & ...
I am developing an ontology. I've got the classes, relationships and I guess I could come up with instances at this point too. But what I'm really focused on is the axioms. I've learnt that the axioms restrict the knowledge so that reasoning can be done which then reveals the consistency or satisfiability of the ontolo...
I am attempting to prove via the pumping lemma that $1^{n^2}$ is not a regular language. I started with $w = 1^{p^2}$ I then divided $w$ into $xyz$, where: $x = 1^{l}$ $y = 1^{m}$ $z = 1^{{p^2}-l-m}$, where $l+m \le p$ and $m \ge 0$. Now, when I choose $i=2$ in order to get $xy^2z$, I end up with: $1^{{p^2}+m}$, since...
So I have been trying to create a Deterministic Finite Automaton(DFA) in Jflap that accepts all strings from the alphabet {a, b, c} except those that contain the substring "abc". However i keep running into issues where certain strings that should be allowed aren't, such as "acbc". Do you have any tips or tricks that c...
I was reading up on Ehrenfeucht-Fraïssé and came by this example at http://www.math.cornell.edu/~mec/Summer2009/Raluca/lesson3.html Shouldn't there be a line between b4 and b2 (or b3 and b1), otherwise I don't see how the duplicator has a winning strategy in 3 rounds. Is this a mistake or ami I missing something? than...
The maximum (unweighted) coverage problem is defined as follows: Instance: A number $k$ and a collection of sets $S = \{S_1, S_2, \ldots, S_m\}$. Objective: Find a subset $S^{'} \subseteq S$ of sets, such that $\left| S^{'} \right| \leq k$ and the number of covered elements $\left| \bigcup_{S_i \in S^{'}}{S_i} \right|...
I am reading Probabilistic counting algorithms for database applications. In the introduction an algorithm for finding an intersection is specified: Sort A, search each element of B in A and retain it if it appears in A. It is claimed that if a, b are number of elements in A and B, and $\alpha, \beta$ are the number of...
For my application problem, I am searching for an algorithm that can find all symmetric vertex sets of an undirected labeled graph. My definition of symmetric vertex set is: Let $G$ be a graph with vertex set $V$ and edge set $E = \{u,v\}, u,v \in V$. If $S \subseteq V$ and there exits an isomorphism $f$ on this graph ...
Given that language $L = \{a = b ⊕ c \mid a, b, c ∈ \{0,1\}^*, a = b \oplus c\}$, with an alphabet $Σ = \{⊕, =, 0, 1\}$, I need to prove that this language is not regular. The following is as far as I have gotten in my proof, but I am getting stuck when showing why it is contradicting the pumping lemma: $s = (1^p = 1^p...
Let $\Sigma = \{0,1\}$, and consider the language $$L = \{\langle M \rangle \mid M \text{ is a TM and } L(M) \text{ is a subset of } Σ^* \text{ and all strings in this set have an even number of 1s}\}.$$ I think $L$ is undecidable. But I am stuck on proving it. I think it is equivalent to prove $L = \{\langle M \rangl...
Imagine I can specify a certain process as a Petri Net. Is there any good software, open source or not, that can verify my process against some conditions I declare (or code) in some language? In case not, is there an open source software that does at least simulations?
Let the alphabet be $\Sigma=\{0,1\}$. I want to construct a DFA which accepts strings ending with either '110' or '101', additionally there should be only one final state. I have a solution with more than one final state, but cannot come up with a solution which has only one final state.
I am doing a study on I found on youtube called OpenSecurityTraining: Introductory Intel x86. From what I understand there are registers like EAX, ECD, EDX, ect... and each have a purpose and hold/move information in memory. Are these registers per stack/application? Meaning, each application will have it's own EAX, ED...
My understanding is that most popular implementations of a mutex (e.g. std::mutex in C++) do not guarantee fairness -- that is, they do not guarantee that in instances of contention, the lock will be acquired by threads in the order that they called lock(). In fact, it is even possible (although hopefully uncommon) th...
Is a lower bound of $\Omega(n^2)$ known for the size of any constant depth circuit expressing a digital comparator for two $n$-bit numbers? Two $n$-bit binary numbers can be compared using a digital comparator circuit. The straightforward way to implement such a circuit is to compare the high-order bits; if they are ...
I'm learning the Ant Colony Optimization Algorithm and I would like to apply it to a variation of the TSP problem (find the path that start from a node, crosses all nodes and finish in the initial node) where you can cross a node or edge more than once. Actually, my problem wouldn't have solution for the TSP because so...
It is well known that the universality problem for NFA (deciding whether $L(A)=\Sigma^*$) is $PSPACE$-complete. However, what if every state of the NFA is known to be accepting? It seems to me that the problem is at most in $co$-$NP$, as a counterexample (unlike in the case of a general NFA) is polynomial (even linear)...
Is the following statement correct? If a decision problem is NP-complete, the corresponding optimization problem can not be solved in polynomial time.
I'm new to DFS algorithm and I'm trying to figure it out. The main concepts I get from it is that you have a stack of nodes, and they have a value, and can contain children-nodes (Even called branches or leaves) that can contains nodes with values. So let's say that I have a Tree containing 15 nodes like this. I would...
There are several graph traversal algorithms in computer science ( vis. depth first, breadth first, etc. ). Furthermore, each of these algorithms can be implemented in pre-order, in-order, and post-order. What do those terms mean? How do I properly categorize an algorithm as pre-order, in-order, or post-order?
I understand how one can generate a latent vector space from a collection of words or documents, using something like Glove, word2vec, doc2vec, etc. I don't understand how this representation can be turned into features for something generating these documents at a "higher level", like a user or a product. Here's a con...
Multi Key Multi Value Dictionary is a dictionary in which each value is associated with a set of keys and each key is associated with a set of values. Several values can be associated with the same key, and several keys can be associated with the same value. Let's define a $get$ operation over Multi Key Multi Value Dic...
The Problem Suppose we have an array A[1...n] of integers, with values ranging from 0 to K (so 0<=A[i]<=K for each i). We need to describe an algorithm to find an (X,Y) partition from the set {1,2,...,n} such that |Sx-Sy| is minimum, where Sx and Sy are the sums of the elements in X and Y. i.e., if A=[1,3,1,1], then X=...
I apologize for the long title, but I really didn't know how to write it different without lacking informations about the content. I recently had an university exam about Parallel Algorithms. One exercise asked me to write an algorithm to determine if the elements of an array, let's call it A, were repeated an equal nu...
Suppose you have a minimization problem $\Pi$. You know that finding a feasible solution to $\Pi$ is NP-hard. You have designed an algorithm $\mathfrak{A}$ to solve $\Pi$ and you prove the following: If $\mathfrak{A}$ finds a feasible solution to $\Pi$, then its value is upper bounded by $\rho\mathit{OPT}$ for some $\...
Formulation This problem has four entities: A universe: $U = \{1, 2, ..., n\} $ of $n$ elements, indexed with $u$ A set of available colors: $C \in \{1, 2, ..., m\} $ with $m$ colors, indexed with $c$ A collection of sets: $S = \{s_1, s_2, ..., s_k\}$ where there are $k$ sets, indexed with $i$. These sets contain elem...
What would be the most space-efficient way to represent a multiset (a set that can contain duplicates) using a (static) bit string (bit vector, bit array, etc.)? All of the elements in the multiset would be integers from a limited range. My current approach is to find the greatest frequency and allocate that number of...
I would like to know cases that an algorithm runs without any data entry.
I have a directed, unweighted graph that obeys the following rules: The number of nodes and edges is finite Each node can eventually be reached from any other node by some path Each node has an equal number of incoming and outgoing edges Like this: I am trying to develop and algorithm that starts in any node and tra...
Apologies if I butchered the question, I wasn't quite sure how to word it. In the Ramakrishnan text (2nd edition) on page 423 (in the section on functional dependencies) this statement is made: If $X \rightarrow Y$ holds, where [$X$ is the set of key attributes and] $Y$ is the set of all attributes, and there is some ...
I've tried searching this up, but from my what I think it is. It means there are no duplicate elements (ie. all elements are unique elements)?
For instance let's say that I have a Interval class, that has startPoint and endPoint fields, getter and setter methods (functions) accordingly. and I need to create a method that returns boolean value of startPoint == endPoint. And have a question regarding naming point. How to call this method? isEmpty() or isZeroLen...
Can someone please explain to me how the Wikipedia example on the left for a balanced binary tree is correct? One common balanced tree structure is a binary tree structure in which the left and right subtrees of every node differ in height by no more than 1 For node ABCDE, isn't the height of left subtree 2 and the h...
What is the reason to study planar graphs and algorithms on such graphs (as well as algorithms allowing to check a graph's planarity)? Where in industry this knowlege is needed? I know that planarity arises in microchip design ("wires" intersection). I also found the following excerpt from a lecture notes: The study o...
Background: This is to be seen in the context of formal languages, very beginner-level. My professor claims that concatenation is not distributive over intersection, meaning that $L \circ (L_1 \cap L_2) \neq (L \circ L_1) \cap (L \circ L_2)$ and $(L_1 \cap L_2) \circ L \neq (L_1 \circ L) \cap (L_2 \circ L)$. While it s...
The lemma 13.1 of CLRS proves that the height of a red black tree with $n$ nodes is $$h(n) \leq 2\log_2(n+1)$$ There's a subtle step I don't understand. The property 4 reported at the beginning of the chapter states: If a node is red, then both its children are black. And because of such property it is later stated ...