instruction
stringlengths
35
29.1k
Given a positive integer $n$ I would like to compute $f(n)$, the maximum possible length of a binary sequence such that any substring of it (subsequence with consecutive elements), of length $n$, never repeats. For example, with $n = 1$, I have a maximum length of $2$, obtained with $(0, 1)$ or $(1, 0)$. For $n=2$ I th...
Could anyone give me a counterexample so as to understand the proof? Thanks in advance
I'm reading Computer Organization and Design Sixth edition by Patterson and they define clock speed as this: Almost all computers are constructed using a clock that determines when events take place in the hardware. These discrete time intervals are called clock cycles (or ticks, clock ticks, clock periods, clocks, cy...
I've faced this question in my homework, it's a bonus question so it's harder than I could do now with my current knowledge, so if anyone could help I'll be thankful. We're given $\Sigma=\{0,1\}^3$. We think of the 'letters' of the language as column vectors, so every $w\in\Sigma ^*$ is a matrix $M_w$ that consists of ...
Trying to wrap my head around lambda calculus but am really clueless right now. First of all, I'm really confused WHAT it's actually supposed to be. I've found these definitions: Lambda calculus (also written as λ-calculus) is a formal system in mathematical logic for expressing computation based on function abstracti...
The total number of ways a positive number $n$ can be partitioned is called the partition number $p(n)$. The best algorithm I found on the internet is a dynamic programming implementation of Euler's pentagonal formula. Is there any proof that there cannot be any better algorithm? Is there any better algorithm already?
I get why that would be true for EXP but cannot extend the argument to NEXP.
Given the language $D = \{x^n y^n y^m \mid n,m \geq 0\}$, I have applied the pumping lemma with $k>0$, $n=k$ and $m=0$ and found a word $z = x^{k+q} y^k$ with $q>0$ that does not belong to $D$. However, it is not sufficient to argue that the number of $x$'s and $y$'s is not equal and thus the word does not belong to $D...
I am trying to solve a problem in Sipser's Introduction to the Theory of Computation book, which reads: 4.22 A useless state in a pushdown automaton is never entered on any input string. Consider the problem of determining whether a pushdown automaton has any useless states. Formulate this problem as a language and sh...
According to Alan Turing, there are 2 types of problems i.e. NP Complete and non-NP Complete, then why do we promote Ubiquitous Computing and introducing sensors and embedded systems into our daily lives to solve problems? Would it be correct to claim that Ubiquitous Computing is a misnomer or Turing's theory of NP-com...
In the following lines I will present my question, whose content is divided in two parts: Preparation and Actual . (1) — Preparation Regarding the formal definition of the (one tape) general Turing Machine, I was able to rephrase the definition from the corresponding Wikipedia article ( https://en.wikipedia.org/wiki/T...
I am trying to find the indices of all the equal elements in a matrix $\left ( n\times m \right )$. For each pair of matching cell, I will perform a specific function on them. For example: $ \begin{bmatrix} 2 & 1 & 3\\ 4 & 1 & 5\\ 2 & 3 & 2 \end{bmatrix}$ The cell (1, 1) whose value is 2 matches with cells (3, 1) and...
In the book Computational Geometry, Algorithms and Applications there is an exercise asking: In the proof of the query time of the kd-tree we found the following recurrence: $$ Q(n)= \begin{cases}O(1), & \text { if } n=1, \\ 2+2 Q(n / 4), & \text { if } n>1 .\end{cases} $$ Prove that this recurrence solves to $Q(n)=O(...
What I want to achive ist the following: I have a 2D plane and on this plane I will have a potentially large amount of rectangles (these are specified with 2 coordinates spanning it) Whats the most efficient way to determine if a point is in one of the rectangles From some previous research I found that quad trees are ...
Context I work as a frontend developer, our main stack is Graphql & React that's relevant for this question. The data I'm requesting can be quite complex and very often combined with several resolvers. This is what I tried At first, I tried to work with such raw data, but UI was suffering in complexity. My solution to...
I just need help solving this problem. I know I'm supposed to be using the Master's Theorem but I don't know where to start
Problem 3.5 from book: "Algorithms for interviews". There are 51 states (+ Washington DC), each with different amount of votes. Find the number of votes of each state here Suppose there are two candidates in the presidential election. How would you programmatically determine if a tie is a possibility. The problem is in...
Consider the following algorithm: res := 0 for i := 1 to n do j := i while j mod 2 = 0 do j := j / 2 res := res + j What's its time complexity in terms of the $\Theta$ notation? What I have so far: The complexity is $\Omega(n)$ and $O(n\log n)$, but I'm having trouble finding a tight bound (accord...
I was browsing the architecture of a simple CPU but there is one thing a cannot understand. Why is there data from the ALU going to the program counter and what is that data for?
Using automata-lib 5.0.0 (Python library), I need help creating a Python program that simulates a PDA that only accepts the following language: L = {a^m b^n | 0 ≤ m != n} If you could provide any diagrams, or flowcharts to help me understand, they would be greatly appreciated.
Suppose we have a node x in BST, and let max and min be the largest and smallest keys in the subtree rooted at x respectively. Prove that for any node n outside this subtree, the key of n is either greater than max or smaller than min. How should I approach this problem? I get that there are basiclly 3 cases for x, x ...
If all words have the same frequency, is the generated Huffman tree a balanced binary tree? At the same time, is the generated Huffman tree a complete binary tree?
Consider a weighted graph $G=(V,E)$ of vertex set $V = \{v_1, ..., v_n\}$ and weighted edge set $E = \{\langle v_i, v_j, w(i,j)\rangle \mid i, j \in 1, ..., n\}$, where $w$ is the function that assign the weight of a certain edge. This function $w$ is symmetric. Suppose I want to partition the graph into multiple compo...
I read this discussion before. However i’m still confused. I used to think a language decided by a NTM if for every input $w$ in $\Sigma^*$, all of the branches in computation tree leads to a halting configuration, and $w \in L$ iff there exists an accepting path in its computation tree. But because me and the student ...
I have the following question: Consider relation R(A, B, C, D, E, F, H) with the following functional dependencies: A --> D, AE --> H, DF --> BC, E --> C, H --> E Consider three relational schema R1(A, D), R2(E, C), and R3(A, B, E, F, H). They form a decomposition for R. (a) Do the original functional dependencies ...
The $n$th slice of a set $A \subseteq \Sigma^{*}$ is defined as: $$A_n = \{x \in \Sigma^{*}\mid\langle n,x\rangle \in A\}$$ The definition of parameterization is as follows - $C$ parameterizes $D$ (also called $C$ is universal for $D$) if, $$\exists A \in C \quad\text{s.t}\quad D = \{A_n|n\in \mathbb{N}\}$$ However, I ...
Prove the following theorem Let A and B be two languages on an alphabet Σ. If A ≤p B and B ∈ P, then A ∈ P. Could anyone be able to prove it?
I'm new to this page and I used the search function, but did not find the exact question. I'm asking here because my classmates and I have been wondering about this, but did not find an answer. I have learned about Huffman coding and arithmetic coding in a CS course and I believed that given word occurences of $2^{-k}$...
Near the end of subsection 5.4.9 Disks and Drums in 5.4. External Sorting, a process is sketched in a paragraph headed Will Keysorting help?: Schematically, the process has the following form: stage input data sequence length i) Original file $(K_1,I_1)(K_2,I_2)\dots(K_N,I_N)$ long ii) Key file $(K_1,1)(K_...
I am trying to understand the actual reasoning behind creating a new dynamic array of double the size of the original array once it gets full as opposed to any reasonably random number (not too small that buffer is getting filled up too often neither it being too large that half the indices are empty). Apparently, it h...
Hello everyone I am having trouble solving this exercise question. I don't get it what do they mean by providing the value of input x ? It would be highly appreciated if anyone helps to clarify the question at least. Suppose it is claimed that a program computes HALT(x, x). Give a counterexample that shows the claim t...
Say that we have two deterministic space complexity classes $SPACE(n^k)$ and $SPACE(f(n))$ where $f(n) = n^{k-1}$ when $n$ is odd and $f(n) = n^{k+1}$ when $n$ is even. Obviously, if $f(n)$ were always $n^{k+1}$, we would able to say $SPACE(n^k) \subseteq SPACE(f(n))$ by the Space Hierarchy Theorem, and I believe that ...
Suppose given $n=2k$ numbers. We want partition numbers into two group $G_1,G_2$. Let $d_1$ be the largest value of absolute difference between each pair of numbers in $G_1$ and also $d_2$ be the same as $d_1$ but in respect to numbers in $G_2$. Our goal is each group contains exactly $k$ numbers and minimizing $d_1+d...
Modern CPUs (for a very wider range of "modern") use separate data- and instruction-caches. So at the core they (probably) have separate busses for data and instructions. Does that make the "core of the core" a havard architecture? Are modern CPU a mix of Havard and von Neumann?
Given a grid of integer values, $G = \{g_{i,j}\mid i<m,j<n\}$ I would like to compute a grid $H = \{\{x_{i,j},y_{i,j}\}\mid i<m,j<n\}$, in which each cell contains the coordinates of the cell in $G$ closest to ${i,j}$ and equal in value, i.e. find $x,y$ such that $g_{x_{i,j},y_{i,j}} = g_{i,j}$ and $(x-i)^2 + (y-j)^2$ ...
I have a combinatorial optimization problem that I try to solve using simulated annealing. It is about finding the optimal configuration of N points on a grid. I have the operation swap (swap one point with another one) and move (move one point to a new coordinate on the grid). I already implemented the simulated annea...
I want termination proof of divide and conquer approach to find max of array,I want equational proof in form of lemma.Below is my attempt.I have got accepted everything in dafny ,it is only pointing the termination proof as false.Below is the code- method maxofarray(a:seq<int>) returns (max1:int) requires |a|>=0 ensur...
Is the language $L = \{\langle M\rangle|L(M)=\{\langle M\rangle\}\}$ recursive? I've been trying for hours to find a way to prove or disprove that it is. My first attempt was to show it wasn't recursive using Rice's theorem but I'm not sure if one can create a Turing machine that only accepts it's own encoding? How wou...
I'm reading Sipser's "introduction to the theory of computation" book. Even though in many places the phrase "computational problem" appears there is no definition of it. How is it defined? Some other questions I thought about when trying the understand the nature of a "computational problem": Are there mathematical pr...
Suppose that the edge weights in a graph are uniformly distributed over the halfopen interval [0, 1). The question is, how can one sort the edge weights in linear expected time? I know the definition of expected time for inputs of size n is $\max_{I \in I_n} \sum_{R} P(R)T(I,R),$ where $I_n$ is the set of all input...
I am working on a problem in geometry and I encounter the following problem. Suppose given $n=2k$ points $P$ in the plane. And we want partition points into two group Is there an algorithm that decides whether we can $P$ into two groups the size of each group be exactly $k$ and diameter of each group be at most given...
Given CPU with: L1 cache: 4-ways, block size = 32 bytes , cache size = 64KB , LRU (Cache replacement policy). L2 cache: 2-ways, block size = 32 bytes , cache size = 512KB , LRU (Cache replacement policy). Array: int32_t A[2048][128]; so element size is 4 bytes. for(int k=0, k<50, k++) for(int i=0; i<2048; i+=Di) ...
Given finite sets $A,B,C$ of finite strings, does there exist some $x,y \in A$ and some $z$ such that $x.z \in B$ and $y.z \in C$ hold (where $x.z$ denotes the concatenation of $x$ and $z$)? That is, do $B$ and $C$ contain a pair of sequences with a common suffix such that the respective remaining prefixes are both con...
Bag of words model rank words in a particular document in such a way that If it is occurring into that particular document multiple times and it's frequency is low for other documents then it's weight is high. And It seems perfect. Where will it lack? Can someone please give me insight upon dis?
Consider a sequence of vertex and edge additions and removals to an initially empty (undirected, simple) graph. Is it possible to update the ordered list of vertex degrees in constant time (and space), for each addition or removal? How? Is it easier to update only the maximal degree (lower time or space complexity)? Ho...
Suppose we have an optimization problem where we want to find a binary matrix $A \in \{0, 1\}^{n \times m}$ that minimizes the score function defined as $$S(A) = \sum^n_i \sum^m_j f_{ij}(a_{i-1j}, a_{ij}, a_{i+1j}, a_{ij-1}, a_{ij+1}) $$ where all $f_{ij}$ are known, real-valued and bound within $[-w, w]$, except for e...
I'm looking for some resources on what happens on the low-level with databases. I've found that indexed data is looked up using b+ trees, but could not find anything on non-indexed columns. Is there any algorithm better than fetching values of every row?
I have a linear program over real variables for which it can be shown that all the vertices of the polytope describing its feasible region are integral. Obviously I can just solve this using a standard linear programming solver. However I would like to know if I can take advantage of the known integral nature of the fe...
The calculation of the period of the "modulo exponentiation" function: $$ f_a(r) = a^r (mod \ N) $$ is a step of the quantum algorithm for factorizing $N$, where $a$ is a number chosen with some limitation. The quantum circuit is able to find the period of $f(r)$ in time polynomial in the number of bits of $N$. This al...
In looking into the problem of low-rank matrix completion / relaxations of the general problem to derive exact solutions, many papers cite that the original formulation is NP-hard but I cannot find a proof of this fact. The problem is as follows. Given a matrix $M \in \mathbb{R}^{n \times m}$ of rank $r$ (again, assume...
If $f(n)$ and $g(n)$ are T, show that $f(n)^{g(n)}$ is Turing computable too. I started by designing this machine: on the first tape I have n written in unary ($1^n$). Then on the second tape I write $f(n)$ and on the third one $g(n)$. I have one additional tape and the one with output (write-only). The first step wo...
I am given an undirected connected graph with $n$ nodes, average degree $\sqrt{\log n}$, and each edge having integer weight in $\{1,..,5\}$. I am asked to describe MST algorithm which is as efficient as possible. I read https://en.wikipedia.org/wiki/Minimum_spanning_tree about Dense Graph and Integer weights, but it s...
Wikipedia gives the path cover definition as: Given a directed graph $G = (V, E)$, a path cover is a set of directed paths such that every vertex $v \in V$ belongs to at least one path. I'm reading the paper "On k-Path Covers and their Application" (Funke, S., Nusser, A., & Storandt, S. (2014)) and they gave the defini...
I am trying to work out some analysis for an algorithm I am trying to write, one step of what I am doing require knowing the answer to the above question. I know it might sound a bit simple, but I am not sure of the approach (formally using probability theory). Assume I have an algorithm that loops over a bitstring (x1...
I'm stuck on something in in Shan's article Shift to Control, about CPS. On page three he writes the CPS transform x --> (lambda (c) (c x)) (lambda (x) E) --> (lambda (c) (c (lambda (x) E))) (E1 E2) --> (lambda (c) (E1 (lambda (f) (E2 (lambda (x) ((f x) c)))))) Shouldn't the innermost expression on the third line be...
I have the following problem: Given a graph of persons and their relationships. Suppose I have a classification of the risk of some of those persons. How can I calculate the classification of the others? For instance, suppose I have a graph with 100 persons with the relations between each other (for example A is a fr...
Consider this kind of optimization problem: (1) The problem aims to minimize a value. Let n denote this value. (2) To determine whether n = 0 is a NP-Complete problem. It is obvious that this kind of problem is at least NP-Hard. My question is, can this kind of problem be approximated? It seems that for any polynomial-...
I've been following Automata and Formal Languages in my college and I came across this particular exercise. While the solution presented seems correct, I take on Automata Tutor trying this exercise a 0 out of 10. I can't understand what was wrong here cause overall it seems correct. Thanks a lot if you can help me.
I am trying to understand mathematical proofs and their applications to big-omega $\Omega$ and big-theta $\Theta$ notations. The first one is transitivity: $f \in O(g) \; and \; g \in O(h) \Rightarrow f \in O(h)$ I am having a lot of trouble with this and any help will be greatly appreciated.
Person $A$ is chasing person $B$. Both people can only travel between $n$ vertices of a graph by running through one of $m$ one-way pipes labelled $1,2,\cdots, m$. For each pipe we know the starting and ending vertex. Each pipe has two values $A_i, B_i$ which are positive real numbers and represent the multipliers of p...
I need a little help regarding this problem: Let L = {w ∈ {0, 1} ∗ : w has an even number of 0s and the last character of w is a 1}. Give the equivalence classes of the relation ≡L using regular expressions. What does it mean with equivalence classes? Is it right that i have found a regular expression for it: 1*(1010)1...
I encountered a problem, where I am given a (fully-connected) graph within a metric space, where each edge weight is either 1 or 2. My task is to prove that the following greedy algorithm gives a $\frac{3}{2}$-approximation for finding a TSP path: Start from an arbitrary node, pick the nearest neighbour node, go to thi...
I am currently reading Formal Methods - An Appetizer and am stuck in chapter 3 (Program Verification). I am unfamiliar with logic and I do not think I understand the $\vDash$ notation correctly. I tried to work through Definition 3.8 by giving myself a super-simple example: Let there be an edge $(q_1, \texttt{y:=1}, q...
I was studying Skip Lists in section 3.10 of Advanced Data Structures by Peter Brass and was confused about a detail of how the search algorithm in implemented. (This is self-study, not homework). The book explains the find algorithm for a Skip List as follows: ...any access to an item, given a query key, starts on th...
I'm taking a grad level algorithms course and we just ended the course talking about linear programming, and we had previously talked about the max flow/min cut problem. Our professor said that the max flow/min cut problem can be formulated as an LP problem. I asked the professor what the non feasible but locally optim...
What does the computer do when an I/O operation needs to be done during the process? Does the message that we need to do some I/O operation directly reaches the device controller or device driver? What does the operating system have to do with this?
So I have a complete digraph with non-zero positive edge weights. The nodes represent locations and edge weights are the travel times between the two corresponding nodes. I have 2 or more agents traversing the graph. The goal is that they visit as many nodes as possible within a certain amount of time. I have the follo...
A priority search tree is a binary tree satisfying the following: every node $u$ stores a point $p_u = (x_u,y_u)$ every nonleaf $u$ stores an x-coordinate $x_u'$ called the split-line coordinate. If $v$ is a descendant of $u, y_v\leq y_u$. If $v$ is in the left subtree of $u$, then $x_v < x_u$ and if $v$ is in the r...
Frog game initializes by placing one frog on every vertex of a simple connected graph $G$ with $n$ vertices. A move consists of moving all $x\gt 0$ frogs from one vertex to another non-empty vertex to which a path of $x$ unique edges exists. A vertex is solvable if there is a sequence of $n-1$ moves to move all frogs t...
The proof in the wikipedia article for the uncomputability of Kolmogorov complexity uses the fact that there are strings of arbitrarily large Kolmogorov complexity. What if we restrict to a finite domain so this no longer holds? Specifically, what if I am only interested in strings of length $\le N$, is there an algori...
Problem: Design a data-structure $BankAccount$ that supports the following operations in $ \underline{\text{constant time complexity}} $. Meaning $O(1) $. $Init()$ - initializes bank account $L$ with $0$ dollars. $Receive(L,d)$ - adds to the account balance $ d $ dollars. $Send(L,d)$ - decreases from the account balan...
I created an algorithm which I cannot resolve. Imagine you have list of number like: val list = mutableListOf(1, 2, 3, 4, 5, 2, 6, 7, 2, 9) And if some number is duplicated (in this case 2 is 3x times) we have to remove 3,6 and 9. I was trying to resolve it, but I can only remove 6 and 9 and even without whole solutio...
I am given the definition of a unit interval graph, e.g. $G = (V, E)$ such that $\forall v \in V$ there is a weight $x_v \in \mathbb{R}$ and nodes $u, w$ has an edge iff $|x_u - x_w| < 1$. I am asked to find a dominating set of minimum cardinality in $G$ greedily. And prove it is a dominating set and it is also optimal...
Is it possible to construct different systems of logic in Coq or Agda? I ask because I'm interested in using a proof assistant to construct (and verify) theorems in things like many-valued logics, relevant logics, and conditional logics in Graham Priest's 2nd edition of An Introduction to Non-Classical Logic (I keep go...
I'm having a problem determining whether [F(a, b, c) = a' + b] is functionally(logically) complete or not. I would really appreciate it if you could help me. P.S: I can't have 1 or 0 as input.
2nd year college student here, I have trouble finding for the regular expression for that grammar, any help would help :D Regular Language of the grammar: X → aY → ab X → bZ → ba X → aY → abZ → aba  X → bZ → baY → bab X → aY → abZ → abaY  → abab X → bZ → baY → babZ → baba X → aY → abZ → abaY  →ababZ → ababa X → bZ → ba...
We have this example: {true} assume x > 1; y := x * 2; z := x + 2; assert y > z; {true} They then show this: {true} wp(assume x > 1, x * 2 > x + 2) = x>1 -> x*2 > x+2 assume x > 1; wp(y := x * 2, y > x + 2) = x * 2 > x + 2 y := x * 2; wp(z := x + 2, y > z) = y > x + 2 z := x + 2; wp(assert y > z, true) = y > z -> true...
I had a question about EXP^P (EXPTIME with access to a P oracle). I thought I had read somewhere that EXP = EXP^P, and that seemed fairly intuitive to me: I thought "adding polynomial power to something that already has exponential power must not change a lot". Now I am questioning myself: I was searching for something...
Given a binomial heap of $n$ nodes (where $n$ divides by 3), how can I split the heap to three binomial heaps with an equal number of nodes (every heap contains $n/3$ nodes). The time complexity needs to be $O(\log n)$.
Again, I must apologize if this is "easily googlable". I have tried. My understanding is that the BIOS typically looks for the magic number 0x55aa at the end of a 512 byte sector (so bytes #511 and #512). Once it finds that, it begins executing that code. That code can then load the operating system. It finds this by c...
How can I represente finite language using set notation? G = {ab, bb}, which means G = ({a} ∪ {b}{b}) D = {ca, aa}, then D = ({c} ∪ {a}{a}). How about {aaac, aacc, abac, abcc}? Also, can I represent A = {ardor, ardour, glamor, glamour, labor, labour, neighbor, neighbour} as A = {ar, gla, la, neighb} ∪ {o{u}?r}?
As of now, the only method I know for evaluating postfix expression is using a stack. The following question was asked in a past semester: What are the two different methods of evaluating a postfix expression? I skimmed through online references but couldn't get any answer. Your answer could be of great help!
As you all probably know, Gödel’s incompleteness theorem states, that it will never be possible for mathematics to prove its own correctness. Mainly because that proof would be part of mathematics too, and hence need proving itself. And that leads to an infinite loop in logic. But I realized that a quine, as in, a prog...
I have been studying different topics within the realm of concurrent programming and came across "Lamport's bakery algorithm" which is based on the original version of the bakery algorithm by Peterson. While studying I came across a paper showcasing the following program: with a question for the reader reading "Show t...
I am trying to analyze a series that I found, in the analysis of an algorithm. And I was wondering if the following was true: $$\log_{2}{\left(\frac{1}{2}n\right)} + \log_{2}{\left(\frac{1}{4}n\right)} + \log_{2}{\left(\frac{1}{8}n\right)} + \cdots + \log_{2}{\left(\frac{1}{2^{log_{2}(n)}}n\right)} = \mathcal{O}\left(\...
I have a data structure supporting the operations Insert(X) and Remove-Min(). Remove-Min() is performed in $O(\sqrt{\log n})$. And I am supposed to show that the Insert is bounded by $\Omega(\log n)$. I would like to ask how to approach this problem. $O(\sqrt{\log n})$ never really occured to me and I do not know how t...
Given underirected $n$-regular graph with $2n$ nodes, I am asked to show it has a matching of size $n/2$. My attempt: At each step I will also remove the edge from the graph that I am adding to the matching $M$ edges. I start at random edge $(u,v)$ and add it to $M$. The degree of nodes $u$ and $v$ is now decreased. I ...
The following problem is a variant of the all pairs shortest path problem: Given a weighted, directed graph $G=(V,E), |V| = n,|E| = m,$ and an integer $\alpha\ge 1$, how can I find an efficient algorithm to construct an $n\times n$ matrix where the entry corresponding to vertices $u$ and $v$ is the minimum weight path...
Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal. This is leetcode problem #698. Below is code that I have written with backtracking to solve the problem (it is correct and passes all test cases). When we apply memoization...
i am looking to convert regular expression 0* 1* to deterministic finite automaton (DFA) I have tried creating the NFA for the regular expression as given in the above image, From the regular expression, the strings that can be created are {€, 0, 1, 001, 011, 0011, ………} My doubt is how do you even create DFA That can ...
Denote by $A(n,d)$ the maximal size of a binary code of length $n$ with distance $d$. How to show that $A(3k, 2k)=4$? From Plotkin bound: $$2k > \dfrac{3k}{2} \Rightarrow A(3k, 2k) \leq 4$$ But I don't know why here equality. I also tried to use Gilbert–Varshamov lower bound. But it doesn't help to obtain $A(3k, 2k) \g...
Is any technique present in this technical world regarding accessing data directly from any type of storing device without recovery it. For example if I deleted permanently data and then want to access it without recovering data using any software, but done some program as programmer and directly access that data witho...
Copy from Wikipedia Cycle sort is an in-place, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes to the original array, unlike any other in-place sorting algorithm. It is based on the idea that the permutation to be sorted can be factored into cycles, wh...
After reading a lot of materials related to the Primary key and Unique key, I am in doubt. Let us consider a primary key (AB) in table R (ABCDE). AB together can not be null as AB is a primary key. But, is it possible for a row that A is null? Or, B is null?
I'm working on my bachelor thesis (on Computer Science) and right now I'm having a problem about finding shortest path between two points on 3D triangular mesh that is manifold. I already read about MMP, but which computes distance function $d(x)$ between given point and vertex $x$ on mesh. I got to know that the prob...
Let $\Sigma$ be an alphabet of some symbols, and let $\mathrm{lcs}$ denote the length of the longest common subsequence of two or more sequences defined on $\Sigma$. For some $A,B,C\in\Sigma^{\star}$, given $\mathrm{lcs}\!\left(A,B\right)$, $\mathrm{lcs}\!\left(B,C\right)$ and $\mathrm{lcs}\!\left(C,A\right)$, what can...
I was self-learning the complexity theory using the Computational Complexity: A Modern Approach by Arora and Barak. When studying the Ladner's Theorem, the textbook mentioned a function $H(x)$ as shown below, and claim that the complexity of $H(x)$ is $O(n^3)$. But I don't understand how to proof this claim. In the boo...
(Most fair region) Let $P$ be a set of $n$ points in the two-dimensional plane. Each point in $P$ is either colored red or blue. Given an axis-aligned rectangle $R_{ab}$ of size $a\times b$ , design a fast algorithm to decide where to place $R_{ab}$ in the plane so that the absolute difference between the number of ...
How do I go about producing the context-free grammar for something like $\{a^i b^j \mid i<j\}$? If it was $i=j$, then it's simple. But for something like this, is there a process to achieve it, or does one rely on intuition and practice?
[My apologies, I am not a computer scientist, merely an interested amateur. I apologise if this question does not make sense, is a known result, or a duplicate] To quote Wikipedia: The halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program w...