instruction stringlengths 35 29.1k |
|---|
I need to build an enumerator for $$L=\{0^{3^n}| n\ge 0\}, \Sigma = \{0\}, \Gamma = \{0, x, \sqcup\}$$ that has at most 10 states, including print and halt states. I can ignore the halt state and any edge that leads towards it.
I tried to approach this in the simplest way i could think of, build a Turing machine that d... |
The definition of PPAD (Polynomial parity arguments on directed graphs) revolves around the definition of "End-Of-The-Line"
An exponentially large polynomial-depth arithmetic circuit, $f$, specifies a graph where every node has an in-degree and out-degree of at most $1$. Given that $0$'s in-degree doesn't match it's o... |
Grover's algorithm assumes $U_f$ computing a function $f$ as an oracle input. But in practice, an oracle isn't given. Instead a circuit computing $f$ is given. So let's assume a reversible circuit, $C \colon \{0, 1\}^{N + 1} \mapsto \{0, 1\}^{N+1}$ that computes $C(x, y) = (x, y \oplus f(x))$, where $f \colon \{0, 1\}^... |
Let $L$ be the language of infinite words in $\{0,1\}^\omega$ such that any finite prefix of a word in $L$ has at least as many $0$'s as $1$'s. Is $L$ büchi recognisable?
I think that $L$ is not $\omega$ regular, but standard tricks such as complementation or intersecting with some other language don't seem to work.
|
I'm having a hard time describing this problem without an example, so let's go with this: Say you have a program that is made up of many files. There are some files you could delete, and, while it might be crippled, the program could still run. We're assuming each file is independent from the others, so behind the scen... |
I am trying to figure out the solution to this problem:
In this problem we consider two stacks $A$ and $B$ manipulated using the
following operations ($n$ denotes the size of $A$ and $m$ the size of $B$):
PushA($x$): Push element $x$ on stack $A$.
PushB($x$): Push element $x$ on stack $B$.
MultiPopA($k$): Pop $\m... |
I know the answer if it was OR would be (1*01*01*)* U 0*10*10*, but with the AND I have no clue how this can be achieved. There are lot's concatenations that I can't cover by getting the regular expression.
|
I've tried to expand the recursion:
$$T(n) = T(n^{\frac{1}{2}}) + 5n = T(n^{\frac{1}{4}}) + 5(n^{\frac{1}{2}} + n) = T(n^{\frac{1}{8}}) + 5(n^{\frac{1}{4}} + n^{\frac{1}{2}} + n)$$
We have a total of $\lfloor\log_2(n)\rfloor + 1$ elements in the recursion. So we can easily find an upper bound:
$$T(n) = O(n\cdot \log_2(... |
Is it true or false that $n^{n} \in \mathcal{O}(n!)$ ?
Any suggestions how to prove/disprove this statement?
|
I am trying to come up with an algorithm to find the minimal representation of the transformation from a zero matrix to a target matrix.
Specifically, I have an empty matrix and can perform operations such as set(x1,y1,x2,y2) and unset(x1,y1,x2,y2) to edit submatrices.
I looked at some greedy algorithms and quadtree da... |
Consider this situation. A few clients are connected to a server over the internet.
I define network latency as the time between request leaving the client and reaching the server.
What distributions (i.e. gaussian, uniform, exponential) do network latencies typically follow?
|
I am working on a Genetic (or rather Memetic) Algorithm for optimizing a scheduling problem.
I have n orders to schedule and the solution representation is an array of n integers that specify when an order takes place.
Mutation probabilities are typically given as that, probabilities. This however leads to weird (?) be... |
I'm trying to find a problem description that is roughly akin to a budgeted min-cost max-weight bipartite matching where the capacities are greater than 1. Imagine a max-flow problem on a graph that looks like this:
Each node on the left is connected to a set of nodes on the right, but the nodes in that set on the rig... |
I am trying to detect forbidden moves for black in a game called Renju. First, here is an explanation of how Renju works.
Renju is a board game played on a 15x15 Go board. There are two players in the game, which we will call black and white, and they place stones of their color on the board turn by turn. Black starts ... |
I don't know if a solution to this problem is too complicated to figure out, but I've been banging my head on it for a couple weeks, so I'm hoping for an outside point of view.
I have a list of 88 files today from different sources:
Alpha sent 9 files.
Beta sent 7 files.
Gamma sent 19 files.
Delta sent 13 files.
Epsilo... |
I learned years ago that $IP \subseteq PSPACE$ since you could simulate all sets of messages and then determine the probability of success. But lately I’ve been looking at the standard proof of this and I'm having trouble with it.
Basically, I don't understand how we can apply this proof to zero-knowledge settings. For... |
Consider these 2 questions where recurrence relations can be applied:
Q1) Given an (nxm) where n denotes rows and m denotes columns of a grid, find the number of unique paths ($a_{n,m}$) that goes from the top left corner of the grid to the bottom right corner of the (nxm) grid. Rule: Can only move downwards or rightwa... |
This is usually shown by an application of the Statistical No Free Lunch Theorem.
But is this possible to show this by working simply with the definition of PAC learnability and the sample complexity VC bound.
In particular if it's PAC learnable we know that for any $\epsilon$ and $\delta$ we have a sample complexity V... |
I am looking for a solid reference (peer-reviewed publication) on the design and/or benchmarking of SAT solvers for random k-SAT ($4 \leq k \leq 8$) operating at satisfiability threshold.
The majority of published algorithmic works I know on SAT solving focuses on solvers running in polynomial time (at least empiricall... |
For example, using GHCi,
ghci> f x = x + 1
ghci> :t f
f :: Num a => a -> a
What is the type of the type signature f :: Num a => a -> a?
Motivation
I first encountered this question at work. Since I do not want to leak any information pertaining to my employment, I shall present a toy project instead.
Suppose that I h... |
Question is to construct a regex where all strings containing an even number of 0's:
By constructing DFA graphically, it is
$$(1^*+01^*0)^* $$
But it is also
$$1^*(01^*01^*)^*$$
Can we prove that they are equal algebraically?
|
Given a graph $G$, how can we generate all possible color vectors that could be generated via greedy coloring?
N.B. Greedy coloring takes a graph and an order of vertices. It traverses vertices following that order and, while visiting a vertex $v$, puts the minimum color absent in all neighbors of $v$.
If $G$ has $n$ v... |
Have seen library code for finding square-root, using the Newton Raphson method.
It uses a table of 256 entries, whose significance is unclear, as the initial guess should be dependent on the quantity (x), whose square-root need be found.
So, request if some details could be given.
It states about it, that :
Initial g... |
I expected CVC5 to produce a proof given the following problem in TPTP format.
Why does CVC5 give up on the TPTP problem, but works just fine on the same problem given in SMT-LIB2?
In human words, the problem says that all values X of type tA are in the unary relation rel. And given some arbitrary value a of that type,... |
I have problems to imagine a non-deterministic Turingmachine.
Let's make an example: There is the problem of a Vertexcover. Let $G=(V,E)$ be an undirected graph and $k\geq 0$. The question is whether there is a vertexcover $C$ of size $|C|\leq k$. My book says that this problem is in $NP$, because a Turingmachine could... |
Given two unordered partitions of the same string over a finite alphabet into substrings, how hard is it to reconstruct the original string? If multiple solutions exist, any one will suffice.
Under an unordered partition of a string I understand a multiset composed of the parts of any partition of this string into subs... |
Given is a multiset $S$, a finite set $T = \{t_1, t_2, t_3\}$, and an integer $k \in \mathbb{N}$.
Let $v(t_j)$ be a set of values $\in \mathbb{R^+}$ of length $|T|$ that can be assigned to $s_i$, and $c(t_j)$ be the cost of assigning $v(t_j)$ to $s_i$. Since $S$ is a multiset, assigning $v(t_j)$ to $s_i$ will affect ev... |
There are $n$ cities on a highway with coordinates $x_1$
, . . . , $x_n$ and we aim to build $K < n$ gas stations
to cover these cities. Each gas station has to be built in one of the cities, and we hope to minimize the
average distance from each city to the closest gas station. Please give an algorithm to compute the... |
I have been studying the Ackermann function, specifically the two-argument Ackermann–Péter version.
With the Ackermann function, I developed a problem I call the "Ackermann Decision Problem"
Given non-negative integers, x and y, does A(x,x) = y?
The naive solution to verify the Ackermann Decision Problem would be to ... |
I found this from this PDF (https://web.stanford.edu/class/archive/cs/cs161/cs161.1168/lecture9.pdf)
|
I have a pretty complex problem and I am using a rather complex ILP to solve it. In a special case of the problem the ILP is reduced to the following "simple" ILP. Additionally, I know that for this special case there exist polynomial time algorithms.
We have two sets of variables $V$ and $E$. $E$ can be split into thr... |
My problem is this: I have a list of $n$ items $N$ (think of them as the natural numbers $1,\dots,n$) and $m$ subsets of $N$ $S_1,\dots,S_m$ which may overlap. The objective is to find a partition of the $m$ subsets $(P_1,\dots,P_k)$ for any $1\leq k\leq m$ maximising the following quantity
$$
\sum_{i=1}^k\left|\bigcap... |
It is quite easy to prove that f(n) + g(n) ∈ Ω(h(n)), but I am having trouble with proving/disproving that f(n) + g(n) ∈ O(h(n)).
Someone suggested that this question answers mine, which it doesn't. As I've written above, proving that f(n) + g(n) ∈ Ω(h(n)) is easy. I am having trouble disproving that f(n) + g(n) ∈ O(h(... |
I am looking for a map-like data structure with the following properties:
it uses subsets of some set S as keys. The size of S is potentially unbounded, but does not change during the runtime
the values associated with the keys are generic objects - poiters/references. Their properties are not important for the data s... |
Let $\mathcal{F}$ be a family of pairs of the form $(A,b)$, where $A$ is an integer matrix and $b$ is an integer vector with the same number of rows. For every integer $k$, define $L(\mathcal{F}, k)$ to be the following family of decision problems.
INPUT: a pair $(A,b)\in \mathcal{F}$.
OUTPUT: "True" if there exists a... |
I have a total order represented as a Hasse diagram (basically a linked list of ordered elements) and a concurrency oracle.
The concurrency orracle is a function, that tells me which pairs of elements of the total order, are concurrent - should not be ordered.
My goal is to use the information provided by the oracle to... |
I'm generating biomes for my game and I would like to store them in a single RGB image like the one below. A color hue can then be mapped to an ID through a table lookup. The problem I face is that I would like the transition areas between the biomes to give an exact percentage of each biome's representation at any par... |
I'm getting to a problem while studying my computability and complexity exam.
If two languages A and B, such that A=B does that implies that coA=coB?
And in general if two language are describe by different TM such that they accept a certain input. One reject everything else, while the other doesn't define anything (lo... |
I feel this is a basic question but have been stuck at this for days. Consider an undirected graph with positive weights on its edges. The goal is to find is to get the shortest path between any two nodes in the graph, but considering that if there are more than one shortest path we return the path with the least numbe... |
The operation I'm interested in is a slight twist on your standard search-and-replace operation, in that instead of a single pair of arguments (replaceme and withme), it takes a keyed set of N [before, after] pairs as an argument, and for each pair in the set, replaces all instances of <before> in the string with <afte... |
Modern CDCL SAT solvers often can return partial assignments where missing literals mean that the value of that variable is not important for the satisfaction of the formula (i.e. it is a don't care).
What I can't understand is which guarantee do I have that such don't cares are identified.
So, are state-of-the-art sol... |
We know that there does not exist an FPTAS for the bin packing problem because it is a strongly NP-HARD problem, as the 3-partitioning problem which is strongly np-hard, can be reduced to the bin packing problem. Moreover, by corollary 8.6 of Vazirani's approximation algorithms book, there is no FPTAS for strongly NP-h... |
The title's a little provocative, sorry. In the categorical abstract machines (CAMs), technically there are no "right folds"; the only way to consume a list is from the "left" or "top" of the list. Less abstractly, a list like [1;2;3] (OCaml) or (list 1 2 3) (Scheme) can only be consumed by a CAM on a cons-by-cons basi... |
I'm interested in the theory of calculating the position of an element when the face of a cube is moved - like in a Rubik's Cup. That is, for example, I rotate the face of the cube - how can I mathematically write down:
all the displacements of its neighbors relative to each other
the entire cube as a whole
relative... |
Firstly, I've tried assuming $L$ is regular and find a contradiction with help of the pumping lemma's 3 conditions, I was not able to get to a contradiction.
I've tried thinking of a word $z\in \{0,1\}^*$ to attach to $wv^i$ and $wv^j$ for some $i\neq j$, and to combine that with the pumping lemma's $xy^2z\in L, k\geq... |
I was experimenting with the concept of threading in java, we have a method setPriority, using which we can set thread priority. In official documentation it is given as below,
But while seeing in actual execution, I observed something else, threads were executed normally as before without priority, on researching I f... |
Let $L$ be a language over $\Sigma=$ {$a,b,c$}
We define $\forall w\in \Sigma ^{*}$ the function $T$ s.t. $T(w)$ is the word we recieve after removing all instances of $a$ in $w$.
Let $T(L)=${$ T(w) : w\in L$}, we need to show that if $L$ is regular, than so is $T(L)$.
I've came to mind of an approach, which consists o... |
On Wikipedia the error rate for the minhash algorithm vs baseline jaccard similarity is stated as 1/sqrt(1/hashes).
But, how should one interpret this number in a practical scenario? It seems to me that this must mean avg(abs(minhash_similarity - jaccard_similarity)) rather than classification error, because classifica... |
To simplify it, it seems that we can do $(L+M^*)^* = (L+M)^*$, but I also need to prove it.$(L+M)^* ⊆ (L+M^*)^*$ seems straight forward. However, $(L+M^*)^* ⊆ (L+M)^*$ is what I couldn't figure out. Should I use $ (L^*M^*)^*$ instead of $( L+M)^*$? If I use it and do induction on k, $ u ∈ (L+M^*)^*$ and u = (v1+m1)...(... |
What is the complexity of the following (Python) code, that builds the list L of all subsets of size $k$ of a given set?
# arr: input array
# k : size of subsets
# tmp : current subset
# idx : current index in tmp
# i : current array element
# L : list of all subsets of size k
def subsets(arr, k, idx, tmp, i, L = []):... |
I am looking for a formula or program to help place people in classes based on their preferences.
The elements of the problem are:
There are 30 class choices a student can pick from.
There are 400 students that are asked to rank their top ten class preferences.
Each class (specialty subject, but a class by year or age,... |
How should datatypes be organised in a computer programme? Is it better to utilise arrays or linked lists? I'm not sure what the difference is, but I seem to recall hearing that arrays are quicker. Or perhaps it was connected lists? So, which one should I go with?
|
So i'm taking this class automata and complexity at georgia tech and we were given practice material for our exam.
one of the question is to give context free grammar for these two languages
and the answers are:
L1
L2
I can understand these and verify that these are indeed correct once I know the solution, but I'm ... |
I do not understand the "execution graph" (I think that's what it's called) of the following Non-Deterministic Finite Automata, given on pg 48-49 of Sipser's Intro to TCS (3rd edition):
And here is the execution graph:
Why after seeing a $1$ does state $q_1$ stem into three branches? And why after seeing a $1$ does $... |
The SAT problem is often explained in terms of truth tables. Given some random boolean circuit, calculate its truth table; does there exist an output of $1$ in the truth table?
But how about going the other way? A function problem that inputs a truth table, and asks you to construct a boolean circuit that computes that... |
Let $n$ and $r$ be positive integers. For i = 1,2,...,n, let $f_i$ be a univariate real-valued function defined in the integer domain and let $f_i(x_i)$ be $-\infty$ for negative integer $x_i$.
Any non-negative integer solution $(x1,...,x_n)$ that satisfies $\sum_{i=1}^n x_i = r$ is called a feasible solution. In addit... |
I have heard DNA being referred to as "code", this is because it is an instruction set which dictates the bodies' properties. However, DNA (as far as I have learned), has no conditional jumps or normal jumps.
After reading the article DNA computing on Wikipedia briefly, I cannot find whether computations with DNA is Tu... |
This approach has been on my mind for quite some time. I did come up with it myself, I searched some methods for determining prime numbers but never came across anything similar to this.
import math
n = int(input())
def is_prime(n):
x=n
i= 2
while(x>i):
if n%i==0:
return False
x ... |
Here is my LC-3 Assembly code.
It is designed to add up the 10 values in x3100 through x3109 and store them in x310A.
It correctly adds the values, storing the total in R0, however I cannot seem to get it to properly store that value in x310A.
.ORIG x3000
AND R0, R0, #0 ; use R0 to store total (start at... |
After having searched for a while, and after having read this
https://stackoverflow.com/questions/1592649/examples-of-algorithms-which-has-o1-on-log-n-and-olog-n-complexities
I was just wondering: is there some example of algorithm whose time complexity is ?$$O(n^{\log(n)})$$
Sorry for the arid question, I would just l... |
Question:
There are N soldiers standing in a straight line with ID 1 to N: [1,2,3,4,5]
You are given array of IDs of length K in the order they are called : [3,1,2,1]
When a ID is called the soldiers with that ID will attack the enemy and he will do the same damage as number of soldiers infront of him and will stand in... |
Is there any algorithm that can efficiently construct a generalized suffix tree or array (or something similar) for a set of strings represented by a prefix tree (trie)?
In particular, I'm wondering:
How time-efficient an algorithm for this can be
How space-efficient the resulting data structure can be
What algorith... |
Question is to simplify (LM*)* and I couldn't figure out a way to simplify it. Since (L+M)* = M*.(L.M*)*, I guess we can say that it cannot be simplified more. So how do we prove that they are the same and expression $(LM^*)^*$ cannot be simplified more
|
Given a set $S$, a value function $v(s)$ and a cost function $c(s)$ for all $s \in S$, and integers $B$ and $K$, the classic formulation of the Knapsack problem asks if there is a subset $S' \subseteq S$ in which $\sum_{s \in S'} v(s) \geq K$ and $\sum_{s \in S'} c(s) \leq B$.
Is there a variation/special case of the K... |
How is the number of collisions affected by the order of insertion of elements in a hash table using double hashing?
I've tried uing different hash function for double hashing with different set of values. The position of the elements in the hash table seem to change but the number of collsion remains the same so far.
|
See Guy Steele's slides for what I refer to by "Computer Science Metanotation", specifically the bits about BNF.
I often make use of the BNF syntax observed there, as a substitute for algebraic data types in functional programming languages. Alas, it loses quite drastically in appeal as soon as "fields" of function typ... |
Suppose there is an array having at most 10 elements between 1 to 10^18. Suppose the array has elements B1,B2,.Bn. We can choose sequence A1,A2,A3,..An such that 0<=Ai<=Bi. Count How many sequences satisfy A1|A2|A3|..|An=A1+A2+A3+..An, where | is bitwise OR.
|
I was reading Deterministic Black Box PIT Testing for Generalized Depth 3 Arithmetic Circuits - Karnin and Shpilka
In the Theorem 3.4 they told $rank(C|_V)\geq rank(C)$
We have $C|_V$ which is simple (i.e. $sim(C|_V)=C|_V$) and minimal and $C|_V\equiv 0$. Since $C\in\mathcal{F}$ and $\mathcal{F}$ is closed with respe... |
In the "First Draft" JvN described an adder circuit to do binary addition, which was a much faster way of doing computer addition than using decimal lookup tables as the ENIAC had done. JvN's main reference was McCulloch and Pitts' neuron model (although Eckert and Mauchly claimed it was their idea).
However, CS had de... |
I have two optimization problems $A$ and $B$, and I recently managed to show that there exist functions $f$ and $g$ that are computable in polynomial time, such that for any instance $x$ of $A$ there holds
$$OPT_A(x) + g(x) = OPT_B(f(x)).$$
I know that $A$ is NP-hard, which implies that $B$ must be NP-hard as well. How... |
I have experimented with a grammar that I could turn into a strict left-to-right finite state automaton driven algorithm (bottom up, table driven). The FSA could be complex, that's not a problem. It doesn't need to deal with infinite recursive structures.
I then moved the grammar into BNF, and built a standard SLR pars... |
TLDR; Looking for Explanation of Cook-Levin theorem palatable to CS first years who are theory averse
I'm a prof. teaching first year algorithms+programming and want to give my students a taste of deeper CS theory.
In the very last week of class, I want to cover (in two lectures) the key idea behind Turing Machines NP-... |
It seems useful to characterize terminating programs. While trying to formulate that as a well-defined question I was wondering about the following problem:
Is there a maximal decidable set of terminating programs?
A set is maximal if it is not the subset of another such set. A program may be a Turing Machine or an equ... |
Working on logic design in class, and I'm trying to figure out how to write a specific logic function [and by write, I mean something along the lines of (x NOR y) OR (a NOR b), for example]
It asks to assume 2 variables, X and Y, both of which consist of 3 bits (x2,x1,x0, and y2,y1,y0). I need to write a logic function... |
Layers: We shall denote in the following the layer number by the upper script $\ell$. We have $\ell=0$ for the input layer, $\ell=1$ for the first hidden layer, and $\ell=L$ for the output layer. The number of neurons in the layer $\ell$ is denoted by $d^{(\ell)}$. In particular, $d^{(0)}$ is the number of inputs and $... |
If you have an elimination rule for tuples which introduce the left and right pair into the type checking context, what do you do if the type of one of the elements is quantified and has been Skolemized. Isn't it impossible to prevent the Skolem type from escaping its scope here?
For example the sequent:
sk... |
The problem MATCHED is defined as follows: given an infinite set S of strings of arbitrary length over the alphabet {0, 1}, determine if there exists a character of length n over the alphabet {0, 1} such that for every string s ∈ S, s and w does not match.
My approach: TO prove MATCHED is in NP is easy. For NP Hard, I ... |
I was asking ChatGPT local history questions, because I knew many of the answers and could test the robot. But lots of details were wrong and while it can write citations, it won't disclose its training data i.e., I can't see its blind spots.
|
I just had an algorithms exam and had the following problem:
Supposed there are $n$ workers and $n$ objects. Each worker has a strength, $s_i$ and each object has a weight $w_i$. Each worker needs to be assigned to an object, and they can only be assigned to a specific object $w_i$ if $s_i \ge w_i$. There are also $k$ ... |
Where are these number patterns, Octal and Hex, being used? I read this but I want to know where they are used in programming.
|
Let n be an integer. How can I write finite automata for the language L?
L = {W∈{$0,1,2$}*| The $n_{th}$ from last letter in w is $0$}.
(Please suggest answers; not hints.)
Attempt
Using Regex, I could write it as $[012]*0[012](n - 1)$ - replacing n - 1 with the actual integer value. But I'm not sure of a good program... |
I have been studying the SMA* algorithm and I am having trouble understanding the backup operation. Specifically, I don't understand why the f value of a child node should be the maximum of its own f value and its parent's f value, as described in various pseudocode implementations such as the one found on Wikipedia (h... |
Let $f$ be a continuous real function on $[-1,1]$. The function is accessible via queries: for any $x$, the value of $f(x)$ can be computed in constant time.
If $f(-1)<0$ and $f(1)>0$, then by the intermediate value theorem, $f$ has a zero --- an $x \in [-1,1]$ for which $f(x)=0$. Suppose we want to find a zero approxi... |
While working with complexity classes, I've come along the definition of $DP$ (or $D^p$):
$$DP = \{L_1 \cap L_2 \mid L_1 \in NP \text{ and } L_2 \in coNP\}$$
I am interested in a different (and much shorter form) of describing this exact operation on class-level, rather than language-level
$$coNP\; ? \; NP = DP$$
Since... |
so I'm trying to write an algorithm in C to play the game of Reversi. I've already written in basic minimax algorithm yet I am not very satisfied with it. I want to implement alpha-beta pruning to my code to run at a higher depth. However, my code is only given 1 second to run and generate a move and I'm worrying that ... |
Advanced Topics in Types and Programming Languages gives this rule section 2.2 gives this rule for dependent function application:
$$\frac{\Gamma \vdash t_1 : (\Pi x : S.T) \quad \Gamma \vdash t_2 : S}{\Gamma \vdash t_1 t_2 : [ x \mapsto t_2 ] }$$
In "Modules Matter Most" Bob Harper gives this rule for ML functor app... |
Motivation
I want to draw pictures using indexed colors. As I have limited space for colors per-palette, I want to choose palettes in an intelligent fashion, based on the pictures I want to draw. The goal is to choose a palette so that I can draw as many pictures from a set of pictures I want to draw as possible.
Forma... |
I recently read about pathfinding algorithms on grids. It seems two of the most popular are Lee's algorithm and Hadlock's algorithm. Other than the space optimizations that these algorithms employ, it seems to me like both these algorithms are basically just the same as BFS and A* search respectively.
In Hadlock's algo... |
Can we create Xorshift generator, as Marsaglia in "Xorshift RNGs" does, using 64-bit numbers, but with period 2^96 or 2^128?
He proposed PRNG with period 2^96:
t=(xˆ(x<<3))ˆ(yˆ(y>>19))ˆ(zˆ(z<<6));x=y;y=z;return(z=t);
But this works on 32-bit ints, as I think. I can't generalize his work to create similar thing working... |
Is Dijkstra's shortest-path graph algorithm used in cheapest airfare calculators like Expedia or CheapAir?
|
The problem is as follows:
The input is an array $A$ of $n$ natural numbers such that:
(1) if the maximum occurs in $A[p]$ for an index $p$, then $$A[1] \leq \ldots \leq A[p-1] \leq A[p]$$ and $$A[p] \geq A[p+1] \ldots \geq A[n];$$
(2) if $A[i]=A[j]=x$ then $A[k]=x$ for $i \leq k \leq j$.
The goal is to find the maxi... |
Consider a graph with $n$ nodes and $m = \mathcal{O}(n^2)$ edges. The maximum capacity among all edges is denoted by $C$. The running time is given by: $\mathcal{O}(nmC)$
If I consider the input size in bits, it can be stated as: $\mathcal{O}(n \log n + m \log n + m \log C)$
Denote $v:= \log n, b:= \log C $.
Then it h... |
I'm reading a book which says that to transform a number from decimal representation to binary representation you have to follow these steps:
Take the integer part (the one before the point) of the number and transform it in binary like you normally do with integer numbers: that is the integer part of the binary repre... |
I've got homework to design NFA to accept a set of strings over {a,b,c} in which each string of the language satisfies: "cac" is a substring and "cc" is not a substring and the length of the string is even.
I tried to approach the problem by looking at the shortest strings of the language and building a template for th... |
Given a bipartite graph, find a set of nodes on one side that has greater cardinality than the set of its neighbours on the other side.
This is a conceptually simple problem, but I suspect it is actually quite difficult.
|
Assume we have a deterministic infinite automaton. $DIA = (Q, δ, q_0, F)$. Meaning there is no limit to the number of states. I want to prove or disprove that this module equals a normal DFA.
Attempt
I tried to disprove it using the language L = {$a^nb^n|0 < n ∈ N$}, but I am not sure if this is enough to disprove it.... |
Given a set of n points, and a number k decide whether there exist k straight lines such that all of the points are covered. Here a point is covered by a line if that point lies on that line.
I can formulate an ILP for the same. The problem seems to be hard. I want to formally prove its NP-Completeness.
Note that, for ... |
I was going through the main idea of solution to this problem. I could not assimilate the idea of reversing the edges and then using that graph to check if node 1 is reachable from all others.
How come reversing the graph not affect the original conditions and is applicable to be used for the intended purpose? Is this ... |
I have very large sets $A,B$ of 4-tuples of integers, and I would like to find $(x_1,y_1,z_1,w_1)\in A,(x_2,y_2,z_2,w_2)\in B$ such that
$$x_1x_2 + y_1y_2 + z_1z_2 + w_1w_2 = 0.$$
Of course the naive $|A||B|$-time algorithm is too slow for me. Is there a better algorithm?
In 2D you can normalize all the vectors then fo... |
I am watching MIT's Introduction to Data Structure and there is something I'm not understanding at the 14:48 mark
Why does the machine word size, w have to be >= lg(n) where n is the length of a static array?
As I understand a static array, [1,2,3] is stored consecutively in the RAM like:
$$|*|*|1|2|3|*|*|*|$$
If each ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.