instruction
stringlengths
35
11.4k
I've written a political quiz based on data from the public whip. They group politicians' votes by policy; each vote can belong to many policies. There are too many policies for me to ask a question for each one, and anyway some are duplicates and some policies' votes are subsets of other policies. In the past, I've...
I came across following problem: $S→ER$ $R→∗E\{print(′∗′);\}R∣ε$ $E→F+E\{print(′+′);\}∣F$ $F→(S)∣id\{print(id.value);\}$ Here $id$ is a token that represents an integer and $id.value$ represents the corresponding integer value. What does this translation scheme prints for an input "$2∗3+4$"? Here are things ...
Recursion schemes are structured methods for expressing recursive functions, of increasing interest due to their ubiquity in functional programming. For example, catamorphisms (familiar in the guise of 'fold' on lists) can be defined for all inductively-defined (i.e. algebraic) data types and in the particular case bel...
I'm trying to solve algorithm problem, so far no luck Lets imagine A is an employer and there are N employee currently on line (queuing) for receiving their paycheck of the month, and each of the employee are given the same base salary, $1000 each, but their bonuses are based on their performance and where they are rig...
given the language LRE= { 〈M〉 | L(M) ∈ RE } prove that the language can be found in R( which means it's decidable). if i use reduction, how can i use for example ADFA language to solve it? and is there any other way to prove it except for reduction? i'm studying to an exam so it would help me a lot.
I cant find a way to implement a certain solution. Let me flesh out the problem. Somebody gives you X amount of money and sends you to the shop to buy Y amount of items. You must spend as much money as you can and buy as many items as you can. You cant have more money they X. You cant buy more than Y amount of items. S...
Solving $T(n)=4T(n/4) +(n/\log n)^2$. When I looked at the question I thought that this can be solved by the 3rd case of the master theorem since $f(n)$ is polynomially larger than $n^{\log_ba }=n.$ But someone said that this is not polynomially larger since it has $(\log n)^2$ in the denominator. Then I tried the subs...
An example. I have bought a currency while the rate was 1.0. As soon as the conversion rate has increased to 2.0 I would like to sell the currency. Now, that would be an easy task to do. But we are not searching for "easy" tasks, are we? What if there was a way to determine, whether the rate is still growing or not? Fo...
You are given a number $k$ which specifies the number of consecutive balls you can paint in a go. You are given a string $S$ of length $l$. $l$ is the number of balls and each character in the string specifies the color of the $i^{th}$ ball. I want to know whether it is possible to color all the balls in the given patt...
I was given a question about SOM. There is a SOM which have 4x4 neurons and each neuron's x1 and x2 values (coordinates) given. Also neighborhood function and weight update rule given. How can i find and show the regions which are clustered by each neuron? Thanks for answers. Regards...
NFA (nondeterministic finite automata) accepts only finite words while a NBA (nondeterministic Büchi automata) accepts infinite words (and hence $\omega-$regular languages). I think the example automata accepts finite word like $A,B,A,B$. But it also accepts infinite words like $A,B,A,B,...$. How can i know if the exam...
Say I have three sets: A = [banana, apple, grape] B = [1, 2, 3, 4] C = [Alice, Bob, Carol] I need to design an algorithm that gives me the Cartesian Product A x B x C, but with any number of sets and any number of elements in each set. Another requirement is that the order of the elements in the Product is such: A x...
The Halting problem proof can be seen as the following programs: Ends(P, I) is a program that detects (returns true or false) if the program P will halt or not with the input I Diag( P ): is a program that 2.1 Halts if P( P ) doesn't halt 2.2 Doesn't halt if P (P) halts If we use (2) with input Diag it state: Diag...
I'm referring to a question already asked on stackoverflow: https://stackoverflow.com/questions/25988965/does-depth-first-search-create-redundancy However I'm not quite convinced by the answers provided there. Some iterative DFS implementations that I have seen (such as the one provided by Wikipedia) allow vertices to ...
Question: If you were on an island(Vertex) which are connected to multiple other islands, and to get from island A to B it takes time T and does damage D to your boat. What is the fastest route from A to B such that the total damage is strictly less than a given value H. I tried using Dijkstra's algorithm to build a su...
Two transactions $T_1$ and $T_2$ are given as: $$T_1: r_1(X)w_1(X)r_1(Y)w_1(Y)$$ $$T_2: r_2(Y)w_2(Y)r_2(Z)w_2(Z)$$ where $r_i(V)$ denotes a read operation by transaction $T_i$ on a variable $V$ and $w_i(V)$ denotes a write operation by transaction $T_i$ on a variable $V$. The total number of conflict serializable sche...
I have the language $\{ w \mid w \text{ contains an equal amount of symbols } a \text{ and } b\}$. I want to show that the language is in the class $\textsf{P}$. To do this, I must give an implementation level description of the relevant Turing machine. I'm not very knowledgeable on Turing machines, but I think I woul...
In several papers on type theory it's possible to see some sort of numerical notation for types based on the number of possible constructors for the type. For example, the unit type is usually written as $1$, as there's only one possible constructor for it; similarly, they use $2$ for booleans, $x + y$ for disjoint uni...
Disclaimer: First of all I've had a lot of trouble finding the right stack exchange site for this question and I don't know if it's correct here either. The Problem: I'm working on a search algorithm for a django powered website which allows people to write articles on various subjects and search for articles on the we...
I am struggling to create a smart algorithm. Currently I have produced one which is super-ugly and not efficient because I am casting numerics to strings back and forth, not really useful to share it here. The point of algorithm is to get a number 10^x which is smaller than a given one. Examples: 600 => 100 34.54 => 1...
I've been trying to get better at writing algorithms and came across a problem that was something like this: Given a list of words: search_list = ["this", "is", "an", "issue"] Find the closest occurrences of all of these words in another list, and return the first occurrence and last occurrence: given_list = ["this", ...
Cormen et al.'s "Introduction to Algorithms" says the following about the division method hash function $h(k)=k \text{ mod } m$: A prime not too close to an exact power of 2 is often a good choice for $m$. For example, suppose we wish to allocate a hash table, with collisions resolved by chaining, to hold roughly $n=2...
I am very much confuse that why complexity of this program is O(n)? int j = 0; int i; For (i = 0; i < n, i++) // O(n) { For (i = 0; i < n, i++)//O(n) { While (j < n)// O(n) { Statement; j++; } } } I am totally new to Algorithms. Any help and explanation will be app...
I stumbled upon this inequality over a course on Information Theory : If $Z\in\mathbb{N}​$ with finite mean, then $H(Z) \leq E(Z)\times h(\frac 1 {E(Z)})​$ where $h$ is the binary entropy function I have been trying to prove it using the log-sum inequality : $ \sum_i a_i \log \frac {a_i}{b_i} \geq (\sum_i a_i) \log ...
Less Hashing Same Performance: Building A Better Bloom Filter (Kirsch and Mitzenmacher) mentioned that we can use $ g_i(x) = (h_1 (x)+ih_2 (x))\pmod{p}$, where $h_1(x)$ and $h_2(x)$ are two independent, uniform random hash functions on the universe with range ${0, \dots , p − 1}$, and throughout we assume that ...
I have encountered the term many times, in various CS education materials: L2 CS162 (UC Berkeley): Memory-mapped I/O L4 CS162 (UC Berkeley): Memory mapped files L24 CS61 (UC Berkeley): “Memory mapped I/O”: Device control/data registers mapped to CPU address space Even, after googling "mapping", I got the art...
For some recursive questions that require recursing on an input with a small piece removed (hence linear in the size of the input), can we reduce run time by recursing on two halves of the input each time? For example, take this recursive reverse_string function ... def reverse_string1(s): if len(s) < 2: ...
I was asked to solve this code on piece of paper while having a debate in the class. We are all new to DataStrct/Algo. I came up with the answer $O(n^{48})$ which was proved wrong. I am not convinced with the answer they gave me which was $O(n^6)$. void main() { int i; for(i=1, i<= n^2; i++) for(i=1, i<=...
I study graph theory on my own using Diestel's Graph Theory book (with Algorithmic graph theory in mind). I don't understand what local property, global property, locality mean given a graph $G$. For example, on the page 5 it says The average degree quantifies globally what is measured locally by the vertex degree...
I found online solutions which prove the closure of NP under intersection in the following way: given machines $M_1,M_2$ for accepts nondeterministically languages $L_1,L_2$, we construct the following machine $M$ which accepts nondeterministically $L_1 \cap L_2$: $M$ = ”On input $w$: Run $M_1$ on $w$. If $M_1$ reject...
Given a DFA, it is possible to compute the automaton that recognizes the language of its substrings (you can compute it as the automaton that recognizes the suffixes of its prefixes). I would like to compute, given a DFA, the automaton of the substrings from position i to position j. For example, given the automaton of...
Actually this is a exam paper question I found during studying pipelined MIPS architecture.My idea is designers allow to occur hazards because of the cost to make complex design to prevent hazards,so it may be better to allow them than preventing them...It's just my idea..
i have read about data hazards and then came across that mips architecture doesn't allow WAR AND WAW hazards can someone please help me understand it? the reason is not given in the book the MIPS pipeline is divided into : 1.IF(instruction fetch) 2.ID(decode the instruction) 3.EX(execute instruction) 4.MEM(write or rea...
As we know for master theorem: T(n)=aT(n/b)+Θ(nd) this formate is required.. But for T(n)=2T(n/2)+2^n If I want to apply theorem what will be value of d here? We cant just take d=2 here..right?
So I stumbled upon a question here to find an asymptotic bound for the recurrence $$ T(n) = 4T(n/4) + \left( \frac {n} {\log n} \right)^2 $$ The solution shows a solution using master method to prove the answer as $O(n)$ However, I tried to solve it using substitution as: $$T(\frac {n} {4^i}) = 4^{i+1} T(\frac {n} {4^{...
Consider the following naïve argument that any algorithm solving SAT must take $\Omega(2^n)$ time in the worst-case scenario. Let $f(x_1,x_2,\dots,x_n)$ be a Boolean function in conjunctive normal form (CNF). The problem SAT is to determine whether there exists a $(x_1,x_2,\dots,x_n) \in \{0,1\}^n$ such that $f(x_1,x_2...
FingerTrees as implemented by Haskell's Data.Sequence use a branching factor of 2-3 for Nodes, and have Digits of size 1-4. Imagine we want to make the branching factor much wider -- perhaps to amortize per-node overheads better, or to improve lookup performance at the cost of update performance. For example, we might...
I'm reading the introduction to Godel, Escher, Bach and and there's heavy discussion of mathematical sets which contain themselves. Being a far better programmer than mathematician, I put it into terms I'm more comfortable with and started to think about arrays which contain/reference themselves. I know that recursion ...
I am currently learning about a CPU's status register and was confused about the difference between the carry flag and the overflow flag. Then I found article [1] which explains it very well, but I stumbled across one paragraph I don't really understand: The rules for two's complement detect errors by examining the si...
I am currently getting really confused of two documents I read: one is from Wikipedia that states: The opposite is sequential access, where a remote element takes longer time to access. and this Microsoft's document says: Accessing data sequentially is much faster than accessing it randomly because of the way in whi...
It is known that $\{ SUM, MULT \}$ is Turing-complete, i.e. every Turing machine has an equivalent circuit made up of $SUM$ and $MULT$ gates. By the way, I could not come up with designing $MOD$ function with $SUM$- and $MULT$-only circuit. How can one construct such a circuit? P.S. The Turing machine is simple. Assumi...
When we train a network, we usually have an error function which usually looks like this: $$Error = (output - target)^2$$ When we add a regularization term, it looks something like this: $$Error = (output - target)^2 + reg term$$ I understand that there are many different ways of defining the reg term, but in this exam...
It seems a lot of courses (like this and this) on theory/models of computation (and even formal languages) cover DFA, NDFA, PDA, and TM in the order of increasing computational power. This of course makes sense, but why aren't various other computation models included in general? For example, we could take the route fr...
Consider these matrices: $A=\begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}$ $B=\begin{bmatrix}-1 & -2\\-3 & -4\end{bmatrix}$ Using standard algorithm: $C=\begin{bmatrix}1*-1+2*-3 & 1*-2+2*-4\\3*-1+4*-3 & 3*-2+4*-4\end{bmatrix}=\begin{bmatrix}-7 & -10\\-15 & -22\end{bmatrix}$ Transpose B and do dot product row wise for A and ...
I'm revising for a test and having problems with a past question. It states that $f(x)=5x^2+4x+3$ is $O(x^2)$ and has a series of sub-parts asking if particular values of $C$ and $k$ (e.g., $C=12$, $k=0$) are witnesses of this fact (i.e., $f(x)\leq Cx^2$ for all $x>k$). My method so far has been to establish some "test...
Reading the Wikipedia page was a little dense for me. Can anyone offer a friendly explanation of what this means? It sounds like it saying that if you have two ordered collections, if they are "ordered by containment" then they will be in roughly the same order with each other?
I have checked many discussions for understanding this problem. I understand the reasoning , unfortunately there are some drawback in my understanding. The Blank-tape halting Problem Input: Turing Machine M Question : Does M halt when started with a blank tape? So this is the reduction : The construction of Mw is as f...
What are some examples of context-free grammars that necessarily trigger cubic worst-case complexity for GLR parsers? I have seen a mention of the example S $\rightarrow$ SSS | SS | "a" but I would be interested to find more information on this and also find proofs of their worst-case complexity. Can anyone refer to pa...
I read about virtual memory from L08/CS152 of U.C Berkeley and used to deep dive into the details of VM hardware implementation, yet didn't find any document or figure on the course specifying where the 4 “Base & Bounds“ registers (Data Bound Register, Data Base Register, Program Bound Register, Program Bound Register)...
Vertices in my graph are composed of {name, category} where category is one of {red, grn, blu, ylw}. Edges in my graph are weighted and directed. In the visualization, the thick end of the edge represents the destination. My graph has negative cycles, for example [A-red, B-red, C-blu, X-grn, D-blu, A-red] has a cost o...
Ive been playing around with the Intel Realsense R200 Camera. I am able to exact focal length in x and y i.e. fx and fy, but only "up to scale relative to pixel width and height, respectively" At the moment I dont see any way of querying the pixel dimensions in mm from the API nor can I find them in the tech specs. So...
Why do we need to learn MIPS Assembly language before learning computer organization? What are the implications of learning it first? As a computer scientist, why do we need to learn this one and where will these topics will become handy? with references: -Computer Organization and Design by Patterson and Hennessy -Int...
I was wondering if anybody knows if there is an algorithm for Subset-sum, preferably exact, having a $O(n)$ Time Complexity or near-linear ($n$ = number of elements in the input set) I remember that some time ago I read a paper (from Psinger? I can't find it again..) stating that there is a linear or near-linear time c...
I am currently trying to optimise the scheduler of FreeRTOS and in general Real-Time Operating Systems as a Project. In FreeRTOS, and I suspect other RTOS as well, we don't specify the deadline for the tasks, not to mention the tasks would mostly be periodic. How can we, if possible, generate the deadline for them? May...
Given a collection of sets $S_i$ of disjoint subsets $sub_i$ of a set $X$, find a set $A$ of disjoint subsets $asub$ such that each one of these subsets is subset or equal to at most one subset in each of $S_i$, i.e., for $S_1$ = $\{sub_11,sub_12,sub_13\}$, where $sub_11$, $sub_12$, $sub_13$ are disjoint, $S_2$ = $\{su...
My question is a bit on the philosophical side, and there is probably not one single 'correct' answer on this. Nonetheless, I'm curious to hear your opinion... I'm currently designing a convolutional neural network to locate features in images taken by a microscope. These features are geometrically quite simple and sim...
Is there a formal theory or framework described in text books that models access rights in a mathematical way. I would expect things similar to the following: We have data (objects). We have operations on these objects (CRUD, create, read, update delete) We have actors (users, principals) We might model access rights ...
This is an excerpt from the algorithms textbook How to Think About Algorithms by Jeff Edmonds (This book is a gem by the way). I get his conclusion about Merge/Quick/Heap sorts having $O(NlogN)$ operations with respect to $N$, the number of elements in the input list, and at the same time they are linear in the contex...
https://cseweb.ucsd.edu/~mihir/cse200/ss6.pdf shows $NP$ in $BPP$ implies $NP$ in $RP$ by showing $SAT$ is in $RP$ if $NP$ is in $BPP$ and since $SAT$ is $NP$ complete we have $NP$ is in $RP$. However since $UP$ does not have a complete problem and so can we still show $UP$ in $BPP$ implies $UP$ is in $RP$?
The steps in reversal of DFA are :- Make final state as initial state. If there are more than 1 final state, then make a new start state with epsilon transitions to these states. Change all initial states to final states Reverse the direction of edges. Now what if I have a state which is both initial and final ? Will...
Problem Statement. There are many interesting variations on the Tower of Hanoi problem. This version consists of $N$ pegs and one ball containing each number from $1, 2, 3, \dots$ Whenever the sum of the numbers on two balls is not a perfect square (i.e., $c^2$ for some integer $c$), they will repel each other with suc...
Consider from the Bitcoin white paper a graphic that includes dotted arrows, labeled "sign" and "verify": What does it mean to "sign" and "verify", as outlined in this paper? Are the terms "private key" and "public key" used in the same way that they are in the RSA encryption algorithm?
I just finished reading a white-paper from a recent AI startup. The company, Deep Brain Chain, wants to distribute neural network training over computers worldwide, using blockchain technology. Here is the whitepaper From my understanding of machine learning and artificial neural networks, the communication bandwidth i...
Let us consider school buses. Let a 'Bus Route' be a sequence of bus stops travelled by a single school bus (day after day). Let a 'Bus Stop' be a combination of Latitude (Lat), Longitude (Lon) and Time-of-Day (ToD). That is, a bus may stop at the same Lat/Lon to pick up kids in the morning and again in the afternoon t...
While reading about SIMD on Wikipedia, I noticed the use of the technical term Pool in the figure below: I didn't know what it means; so after searching for it, I found only this article. Yet the definition wasn't very clear to me: In computer science, a pool is a set of resources that are kept ready to use, rather...
Whát i mention here is for having 2x bus will increasing 2x memory access speed like 3x will have 3x memory access speed like that !
I would really appreciate if anyone could tell me how to generate CFG from this language. I am trying to learn the procedure of generating CFGs from CFLs and I am able to solve easier problems.. but I am really stuck on this one, I just can't get it how can I generate at two different positions at the same time. L = {0...
Comparison-based sorting algorithms are lower bounded by $\Omega(nlogn)$, where $n$ is the number of elements in the input list. However, when dealing with different models of computation, such as algorithms that deal with arithmetic operations (Euclid-GCD) or, $n$, the size of the input, is no longer the number of ele...
In the data bus all the registers are connected in and out with the data bus but the AC don't have it only out also the memory don't have a direct connection with it ? Please explain if you know
I want to modify the Naive algorithm to find out if there is any occurrence of the string P in T as a substring with at most one mismatch - where a mismatch is either one of the following: INSERT, DELETE, OR UPDATE. Let jTj = n; jPj = m. What will be the worst-case complexity in modified version? Can I use memoization...
I'm trying to think about an algorithm for this problem. I know there is an algorithm for the second cheapest MST in a graph, but if I understood it correctly it only solves cases in which every weight is singular. My question is how do I get the n'th (say 3rd) MST where duplicate weights count as same tree. I thought ...
Consider the language generated by the following grammar: $S \to aSBb \mid \epsilon$ $B \to aB \mid bB \mid \epsilon$ Is the above language context-free? The above language looks like $\{ w \in (a+b)^* : a^n w_1b w_2b ... w_nb \}$. I tried using the pumping lemma to show that this language is not context-free, but I ...
$L = \{ \langle M \rangle \mid M \text{ accepts two strings of different lengths} \}$. What is complement of this language? my attempt: the complement is: $M$ accepts no two strings of same length and this can be done by dovetailing different inputs on M but we can never say IT CANNOT ACCEPT TWO STRING OF SAME LENGTH...
I am blocked with this question for a long time. $L = \{w\# w ' |$ where $w < w'$ lexicographically, and $w,w'\in \{0,1\}^* \}$ I am trying to find A Deterministic Turing Machine for L. A Non-Deterministic Turing Machine for L. Example $01\#111 \in L$ since $ w=01$ and $w=111$ and $01 < 111$ $1\#011 \notin L$ si...
An algorithm is a “unambiguous specification of how to solve a class of problems... calculation, data processing and automated reasoning tasks” Are the class of problems an algorithm can solve more abstractly considered decision problems? Is the ultimate reason for a calculation, data processing or automated reasoning ...
In the book "Parameterized Complexity Theory" by J. Flum, and M. Grohe, there is a definition on page 7: Definition 1.10. Let $(Q, \kappa)$ be a parameterized problem and $\ell \in \mathbb{N}$. The $\ell$th slice of $(Q, \kappa)$ is the classical problem $$(Q, \kappa)_\ell := \{x \in Q\ |\ \kappa(x) = \ell\}$$ Which is...
Are grammars corresponding to DFAs unambiguous and those to NFAs ambiguous? According to what I studied, every DCFL is guaranteed to have an unambiguous grammar though there are multiple grammars generating them. Every regular language is also DCFL, hence they will follow the same, but I doubt if every grammar correspo...
The problem is defined as: pack a 3D space with a given list of 3 types of cuboids which are each assigned a value, trying to either completely fill the space or to achieve the highest total value of the packing. When researching knapsack problems all of the different variations I came across had a weight constraint a...
Find a context-sensitive grammar for language $L = \left\{ww \mid w \in \left\{a,b\right\}^* \right\}$ where $L \in DCSL \setminus CFL$. I find this task from old exam but there is no solution. I try for solve it for practice, I needed many hour for my solution I write here but I don't think it works.. But I think I ...
I was given the following method to argue that an algorithm $A$ has a worst-case running time of $\Omega(n^2)$: We need to argue that there exists an input $x$ of size $n$, the running time of $A$ with input $x$, i.e., $t(x)$, is at least $cn^2$, where $x>0$ is a constant. If you find a single input of size $n$ t...
The wiki article for Reed Solomon error correction includes the following statement near the end of this section: https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#Syndrome_decoding "The advantage of looking at the syndromes ... Another possible way of calculating e(x) is using polynomial interpolatio...
I'm trying to find the average-case number of times that max is assigned a value by the below algorithm find_max. find_max(L): max = -oo # negative infinity for k = 0 to len(L)-1: if L[k] > max: max = L[k] return max However, I'm struggling to come to a solution. So far, this i...
what is meant by EFFECTIVE ENUMERATION i have comes across this word when I was reading about enumerators for Turing machines is it same as LEXICOGRAPHIC ORDER? so effective enumeration is possible for recursive sets but no recursively enumerable sets? i came across this in this question of a competitive exam L1 is a...
Mathematically it seems so easy to use two elements of a vector as two arguments to a function. $$f(\boldsymbol{x_{i+1}},\boldsymbol{x_{i}})$$ In functional programming however a map (function) allows to work with one element at a time only, so one would need to create vector of pairwise 2-tuples from a single initial ...
I am studying different models of computation and how algorithms can be interpreted under different models. Here is a math(?) question that has been bugging me. Suppose we have $n = \Theta(N\log N)$ bits as the size of input and there are N elements in the input. (The implied assumption is each element has $\Theta(\log...
At the heart of NP-completeness is the idea that one can reduce instances of any problem in NP to, for example, 3-SAT. But this definition doesn't require that it must be possible to convert witnesses for yes-instances in polynomial time also. Does this fact follow regardless? I'm looking at this in particular from the...
I'm trying to understand how the syntax of some programming language is defined. I know that there are some parts of the syntax of programming languages that can't be defined using regular expressions (such as an equal number of opening and closing braces) and that this is why context-free languages like BNF are neede...
In order to show that a problem is NP hard one must provide a reduction from a known NP hard problem to this problem. My question is how to reduce 3SAT to INDEPENDENT-SET? 3SAT is a satisfiable 3 literals in a clause Boolean conjunctive normal formula. INDEPENDENT-SET is a set of vertices in a graph, no two of which ar...
I am trying to implement a secure elecetronic voting system. Therefore I found the Damgard and Jurik Cryptosystem. In their paper the authors describe a secure protocol for "A Length-Flexible Threshold Cryptosystem with Applications" (PDF). I am an experienced Java programmer with more than 10 years of professional ex...
I am in 11th grade. The only subject which I love the most is solving alegebraic equations and questions related to it. I enjoy doing trigonometry but hate the part of proving theorems. I opted computer science for the first time. This is just basic. But whenever I can't understand a CS question, I doubt that I should ...
How do I create a state transition table/array in actual code/pseudo-code? I haven't experienced the "ah-ha" moment yet with the state machine to coding (and I really want to). I've looked at several code sample and read blog posts, but it's not clicking yet. I'm looking for a pragmatic explanation of how the state tra...
I'm looking for a hint for solving the following problem : Given an array $A[1, \dots, k]$ of integers where $A[1] < A[2] < \dots < A[k]$ write pseudocode for an algorithm that determines whether $A[j]=j$ for some $j\in \{1,\dots,k\}$. Worst-case running time should be $\Theta(\log k)$. I shall find an easy to ca...
I have some difficulties in computing Hamming distance in following example: 11100000 00011100 10010010 01001001 I know the definition of Hamming distance (in case of two codewords) but how to proceed in above example. Can someone shed some light on how to compute d_min in above example? Regards
Most popular representation for the natural numbers in type systems is: Inductive nat : Set := | 0 : nat | S : nat -> nat. However, digital computers usually represent numbers as bit sequences, arranged into bytes. The above inductive definition is fine for highly theoretical needs and mathematical proofs, but q...
All metric spaces obey the triangle inequality which is, for three points $a,b,c$, that $$d(a,c) \le d(a,b) + d(b,c)$$ One interesting special case of a metric space is one endowed with an ultrametric structure, in which case the triangle inequality is replaced by the stronger inequality $$ d(a,c) \le \text{max} \{ d(a...
I'd read around on the interwebs, and a lot of the text indicated that many programming languages are generated by a context-free grammar, which leads me to 2 questions: Doesn't variable scoping require a context-sensitive grammer? Particularly, I'm thinking of the following valid C code: int main(){ int count=0; ...
From wikipedia In computational complexity theory, a numeric algorithm runs in pseudo-polynomial time if its running time is a polynomial in the length of the input (the number of bits required to represent it) and the numeric value of the input (the largest integer present in the input). In general, the numeric valu...
If I want a cuckoo filter to hold a dataset with N entries with a target false positive rate of ϵ, how do I select the sizes for the table, bucket, and fingerprint parameters?
Define languages L0 and L1 as follows : L0={⟨M,w,0⟩∣M halts on w} L1={⟨M,w,1⟩∣M does not halt on w} Here ⟨M,w,i⟩is a triplet, whose first component M is an encoding of a Turing Machine, second component w is a string, and the third component i is a bit. Let L= L0 ∪ L1. Which of the following is true? L is not even...
Given a system (S) that accepts a tuple of parameters ($\alpha, \beta, \gamma \dots$ etc). These parameters affect the performance of S in a different way. For instance, decreasing $\alpha$ would improve performance of S at some rate, whereas decreasing $\beta$ has a reversed effect. How can one define a performance me...