instruction
stringlengths
35
29.1k
I am learning about neural networks and have a couple of things I don't understand. Firstly, in competitive learning I understand that only the neuron with the strongest output is reinforced. That is done in a manners imilar to: Δwi*j = I(j)*h(i) Where w* indicates the 'winning' neuron, j indicates the input we are co...
Consider the following problem: Suppose you have $k$ nephews and $d$ dollars in your pocket all of which you need to spend. Given a set of $n$ toys with different prices, find whether there exists $k$ gifts with total cost exactly $d$. If $k=2$, is it possible to have an algorithm that runs in $o(n^2)$? If not, how t...
I have been examining the NP = P problem and I am wondering, why is proving or disproving NP = P hard? For example, why wouldn't a proof such as the following be adequate? Suppose a million doors were in front of me and I had to discover which door had a red ball behind it. In order to verify the solution, one would ha...
$$ f_1(n) = n^2 $$ $$ f_2(n) = n^2 + 1000n $$ Are the following statements true or false? $$ f_1(n) = O (f_2(n)), $$ $$ f_2(n) = O (f_1(n)), $$ Based on what I know about big O notation, I think the first statement is true and the second false, however my answer sheet says they're both true. Is that correct?
I've read the Wikipedia article explaining the complexity analysis of the Karatsuba algorithm, but I'm not fully grasping it. I seem to have gotten about 75% of the way to the solution on my own, but lack the last 25% to fully understand why the complexity is $O(N^{\log3})$ where the log function is base $2$. I worked...
Given an unsorted array of size n, it's obvious that finding whether an element exists in the array takes O(n) time. If we let h = log n then it takes O(2^h) time. Notice that if the array is sorted, a binary search actually takes O(h) time (which is polynomial) but the binary search cannot apply to an unsorted array. ...
I've been studying constructive type theory (CTT) and one of the things that I'm not clear on is the proof part: Proving the correctness of a program in a form of a proof that's nothing but the program itself (Curry-Howard Correspondence) Most examples that I've seen in books (e.g., Type Theory and Functional Programm...
Now my knowledge of this comes through watching The Imitation Game, a glance of a wiki article, and a couple of computerphile videos, so forgive me if it's obvious. While watching the Imitation Game, I couldn't help but think that the Bombe that was being developed was just doing a naive search through all possible com...
The following grammar is given: \begin{align*} M &\rightarrow d M d \\ M &\rightarrow e M e \\ M &\rightarrow f M f \\ M &\rightarrow \varepsilon \end{align*} I've checked it with the LL(1) table and there are ambiguous cell entries. Now, I've tried to convert it to LL(1), but without success. Is this not possible for ...
I have a language, for example $\{a^m b^n c^n \mid m, n \in \mathbb{N}, m = 2n\}$ $\{a^l b^m \mid l, m \in \mathbb{N}, l=4^m\}$ How can I see at a glance whether the language is deterministic context-free, context-free or not context-free? I'm not willing to try to prove the language to be context-free. I just wa...
What does the language {a, b, c}* exactly mean?
Is the wall-follower algorithm a poly-time algorithm (for Perfect Mazes)? In particular, are there poly time algorithms for solving the Perfect Maze problems? A perfect maze has the following properties: no inaccessible areas and is simply connected. no closed loops one and only one path from any point to any other p...
Given pseudocode: X is an array function FUN(X) l = length(X) if l <= 1 then PRINT("Hello") return end if p = l / 3 FUN(X[1...p]) FUN(X[(l-p+1)...l]) end function I now want to get the reccurence of this pseudocode. At the moment I have $$T(n) = 2 \cdot T(\frac{n}{b})\cdot O(1)...
I have a language $\{a^m b a^n | m+n \equiv 1 mod 3\}$ $m+n$ can be 1, 4, 7, 10, 13, 16, 19, 22, ... $m+n$ is the number of all $a$'s in the word How can I build a DFA for this language?
A few days ago this appeared on HN http://www.patrickcraig.co.uk/other/compression.htm. This refers to a challenge from 2001 - where someone was offering a prize of \$5000 for any kind of reduction to the size of randomly generated data (the entrance cost would be \$100 and the contestant could choose the file-size). I...
I have a series of about 50 images, each separated by a small rotation and taken from the same camera. The images are feature-dense, and I can calculate a homography from image-to-image easily. My question is, is there any way to determine the rotation matrix and/or intrinsic camera calibration parameters given just t...
What I have is the following: A mapping $f : key \rightarrow set$ that works in constant time An inefficient mapping $g : \{key\} \rightarrow \cup_{k \in \{key\}} f(k)$ where this union is slow Is there a data structure that would make things faster? I could precalculate for every possible set of keys the wanted outp...
I know that the definition of RE class is: $\ RE = \left \{ L \subseteq \Sigma ^{*} | \text{Exists M which accepts L} \right \}$ Can someone explain in the same notation the definition of co-RE.
Is there a regular expression of star-height 1 (i.e. without two nested Kleene stars) for the following language : $a^*(bb^*aa^*ba^*)^*$ ?
I'm having a really tough time trying to comprehend proofs via closure and pumping lemma. None of the examples I can find are similar to the one's im looking to prove. Can anyone explain if I'm totally missing the mark here or is this valid? Question: Prove that $$ L = \{0^x 1^y 2^{x+y} \mid x \ge 0 \text{ and } y \g...
How can we prove a program in repeat until using Hoare Logic? I've found a rule like this: {P} S {R}, {R ^ ~B -> P}, {R ^ B -> Q} for {P} repeat S until B {Q} But I still can't find any explanatiom how I can use this rule For example in this question: {x > 0 ^ y > 0} z:=0; u:=x; REPEAT z:=z+y...
Let's say I have a space with obstacles and I'm trying to control a robot's movement while avoiding obstacles. I also have a start state and a goal state. I use a search algorithm to find the shortest path from the start state to the goal state (actually I really don't care if the path is optimal or not at this stage, ...
Given an un-rooted tree with N nodes, numbered from 1 to N. Each edge of the tree has a positive integer, associated with it. We need to calculate the number of unordered pairs (S, T) of tree's nodes such that the greatest common divisor of all the integers associated with the edges of the path between S and T is equal...
Just like the title says. I need to use a SAT solver on a series of CNF formulas but not only do I need an answer of the type satisfiable/unsatisfiable but also some subset of clauses whose conjunction is still unsatisfiable (the unsatisfiability core). I have read somewhere that it is possible to hack the code of som...
Yesterday I was reading about Computability and they mention the Halting Problem. It got stuck in mind all day until I remember that some weeks ago, when learning Java, the IDE (Netbeans) show me a warning saying that my code was going to result in an infinite loop. My question is, why can't this problem, be solved ...
Suppose that $f, g$ are functions from the positive integers to the positive reals. Under what circumstances will $\log f(n)=O(\log g(n))$ imply $f(n)=O(g(n))$? It's easy to see that this isn't always true: If $f(n)=3^n$ and $g(n)=2^n$ then we know that $3^n\notin O(2^n)$, but taking logs gives $\log3^n = n\log 3$ and...
Suppose the usual dynamic programming algorithm for the knapsack problem. If we swap the max with an addition, does the modified algorithm compute all the solutions with benefit $\leq W$? I described the problem very briefly but I think anyone familiar with these notion wouldn't find any difficulty understanding wha...
Suppose there is an array of nonzero integer values A[n], which has a Fenwick tree representation F[n]. The most simplistic way to delete A[index] and update the values accordingly in F[] would be to perform update(index, -A[index]), then set A[index]=0. However, I could imagine that after a few deletes, the tree would...
If I have the following pieces to a train set: (12) Curve (4) Straight Such as this train set. I'm looking for an algorithm (to which I can write a program) that creates/lists all permutations. It's not as simple as just creating a list , such as the following, where s=straight and c=curve, and creating all permutati...
I've got following definition: Function $f$ is a valid mapping of word $w$ to regular expression $R$, if any of following conditions is true: $R = w$ and $f$ is the identity or $R = \epsilon$ and $w = \epsilon$; $R = R_1 + R_2$ and $f$ is a valid mapping of $w$ to $R_1$ or $f$ is valid mapping of $w$ to $R_2$; $R = R_...
I know that device drivers are attached to device controllers, which have their own registers and some local buffer storage. I'm wondering if I can think of device drivers as little state machines -- i.e. do they read and write to memory, or not?
Lets assume that we have access to a oracle (machine that determines without details) for $L^*$, can we calculate $L$ from this machine? The cost of operation is measured by number of queries from oracle. Can any property of $L$ like being prefix free or regular help? What if the language be finite and instead of $L^*$...
In RAID 6, there is a parity scheme that allows 2 concurrent disk failures. This requires 2 ‘syndromes’, one of which is simply XOR, as used for RAID 5's only parity. In trying to find out whether RAID 6 can support 3 or more parities, it has been disputed that there even exist any other parity syndromes.     I don't u...
With the initial condition being $a_0$ = 3, and the relation being $a_n = 2a_{n - 1}$, what would the solution be? Any help would be greatly appreciated.
How can I construct an LR($k$) grammar (which $k$ is not really of interest for now) for a given language, say: $$L=\left\{w \in \{a, b\}^\star \ | \ \exists u \in \{a, b\}, v \in \{a, b\}^\star: w = vu \wedge |w|_u \operatorname{mod} 2 = 0\right\}$$ ($|w|_u$ denotes the number of $u$'s in $w$). Please note that I don'...
Assume I have a multicore system and a critical section. I understand how disableling interrupts on a single core systems solves the critical section problem. So assume I could disable interrupts on all cores atomically (Why is that not possible?). Why would that solve the problem? As I understand, there would still b...
I got a bit of how Shannon explained to find the number of bits required to represent a message and Shannon's Entropy.But it's natural to know that to code alphabet letters you need 5 bits of information starting from 0000 to 11001. Is that because at his time no one knew how to represent bits in information that Shann...
Prove or disprove $\exists L_{1},L_{2}\subseteq\Sigma^{*}:\quad L_{1}\ne L_{2}\wedge\overline{L_{1}\cdot L_{2}}=\overline{L_{1}}\cdot\overline{L_{2}} $ Where $\cdot$ means concatenation, and over line is complement. Also, Let $\Sigma=\{a,b\}$.
I was trying to analyze radix sort in terms of time and space. Assume that we are given $n$ 32-bit integers which we would want to sort by looking at the least significant digits first. $k$ is the total amount of bits that you will be working with at every step. So at first you look at the first $k$ bits, and sort the ...
For the following $2$ cases: (1) $V = \emptyset, E = \emptyset $ (i.e. nothing at all) (2) $V = \{v_0\}, E = \emptyset $ (i.e. only 1 root node $v_0$) Are they considered a valid tree? It seems like different literature have different definitions. I recall that I have read a data structures and algorithms book that de...
Supposed you have $\langle a_1,a_2,a_3,a_4,a_5\rangle$ = $\langle 6,16,13,9,6\rangle$, how would you find a shortest possible sequence of comparisons that determines the order of elements?
Crossposting due to recommendation. I formulated a MIP problem which I didn't expect to be unimodular. The problem is to find a minimum complete sequence in a strongly connected digraph. That is, minimize the number of edges such that connectivity is preserved, using only previously existant edges. This will be a Hamil...
In a previous question of mine, I asked how efficient is the Least Significant Digit first radix sort algorithm for sorting 32-bit integers. It turns out that the bounds are: Time: $ \Theta (\frac{32}{k}(n+2^k))$ Space: $\Theta (2n + 2^k)$ I have read various articles online about the efficiency of sorting the numbers ...
I have a function $f: X \to \mathbb{R}$ where the domain $X$ is a (small) discrete set, such as $X = \mathbb{Z}^d \cap [-10,10]^d$ (i.e., the set of $d$-dimensional integer vectors all of whose coordinates are in the range $-10..10$, inclusive). I'm interested in computing a non-trivial lower bound on the value of $$\m...
When you have a cache mis, you need to fetch a block from RAM. If said block is 64 bytes big, do you need to have buses that are 512 bits (= 64 bytes) wide to transfer data from the RAM to the cache? And when writing to RAM do you write to the whole 64 byte block?
Say that I am given a cone, as specified by the extremal rays whose facets form its convex hull, what is the most efficient algorithm that finds the linear-rank inequalities whose intersection defines the interior of the cone? Also, what is its run time? I have a situation where I have on the order of several thousand ...
I am learning the basics of data classification using competitive learning, and am somewhat confused regarding the way this is implemented. I understand at the start an amount N of prototypes is randomly positioned in the input space. (Ie: weights of output neurons are randomly generated). Subsequently training the dat...
I have definitely checked out many different related posts. I have also done different sample problems from online sources as well from a similar problem. However, I am stuck on the problem below specifically. Given the following relation $R$ and the set of functional dependencies $S$ that hold on $R$, find all candid...
Here is a passage from Kozen's Automata and Computability (pages 145-146) that I'm confused about: Now we show how to convert an arbitrary grammar to an equivalent one (except possibly for $ \epsilon $) in Greibach normal form. We start with a grammar $ G = (N, \sum, P, S) $ in Chomsky normal form. This assumption i...
Let $\texttt{a[]}$ be a finite array. We want to check whether every number between $\texttt {min(a[])}$ and $\texttt {max(a[])}$ appears exactly once. An obvious solution is sorting the array in time $O(n\log(n))$ and go through the sorted array in linear time and check that $\texttt{a[k+1] == a[k]+1}$ for $0\leq\tex...
let's say we have a set of players that we want to match into teams of aproximatly same strength, so that no team is much stronger than another team. Each team consists of two players. One player is taking a defense position, another player is taking an offense position. The teams can decide for themself which of the p...
Here is the pseudocode for LSD radix sort from http://www.cs.princeton.edu/~rs/AlgsDS07/18RadixSort.pdf public static void lsd(String[] a) { int N = a.length; int W = a[0].length; for (int d = W-1; d >=0; d--) { int[] count = new int[R]; for(int i = 0; i <...
Linear programming (LP) is in P and integer programming (IP) is NP-hard. But since computers can only manipulate numbers with finite precision, in practice a computer is using integers for linear programming. Because of this, shouldn't LP and IP be in the same complexity class?
I need to find the time complexity of the following simple algorithm. Calculate the time complexity of the following algorithm: void f(int n) { int i, x; for (i = 1; i <= n; i++) if (i % 2 == 1) x++ } It obvious that the time complexity of this algorithm is $\Theta(N)$, but how I prove it formally? I ...
I was learning about Büchi Automata and couldn't understand a part where they were describing "Non-empty $\omega$-regular languages contain periodic strings" Let $A$ be a Büchi automaton and $s ∈ L^\omega(A)$. There is an accepting run $r$ of $A$ on $s$ such that $q ∈ \text{Inf}(r)$, for some $q$. Then, there exist fi...
I know that this problem is solvable in linear time with a merge but I want to get a sub-linear algorithm. What I came up is that, if a[k] < b[k] then the $k$th element can not be in the sub array a[0..k-1] or in b[k+1..n]. But I am not able to construct the recursive relation. What I came up is find(i,A,B): k=i/...
S. Wolfram has in has book "A New Kind of Science" listed 256 simple rules of cellular automata. Which of these rules could via iteration essentially contribute to render an input sequence more random in a certain sense? Rule 170, for examples, simply produces a left shift and evidently is not of use in this, if I don...
Show that proving 2SAT is not NP-Complete would prove that 3SAT is not in P. Or eqivalently - Show that proving 3SAT is in P would prove that 2SAT is NP-Complete. I can see there is an easy reduction from 2SAT to 3SAT and it seems like it is the key here, but I can't quite prove the statement above. Can anyone h...
Here, it is well known that the minimal number of givens for a size $9 \times 9$ board of Sudoku requires 17 "givens" in order to be solved (i.e., no puzzle can be solved with $\le 16$ givens). What is the minimal number of givens for a size $n^2 \times n^2$ board? Is there a table of "best-known" minimal values? I'm s...
I was reading the documentation for Julia's Dataframe package, and the package implements Dataframe by a series of a columns each of a single type. From reading the docs, it looks like that's how R implements Dataframes as well. Is there any reason this is a better way than having a Dataframe being a collection of tupl...
I'm not sure if this is on topic, but I've seen some hardware related questions here so I'll post it here anyway. If it's off topic I'll take it off. Compile this C code: int main() { unsigned long long int i; for (i = 0; i < 30000000000ull; ++i){} return 0; } with gcc cycleTimer.c. Then run /usr/bin/time -f "%...
Suppose a program was written in two distinct languages, let them be language X and language Y, if their compilers generate the same byte code, why I should use language X instead of the language Y? What defines that one language is faster than other? I ask this because often you see people say things like: "C is the f...
I was working in my project when I was struck by the question of whether it would be necessary, or at least cautious, prevent overflow and underflow in the calculation of these two distances. I remembered that there is an implementation of the calculation of the hypotenuse to prevent this. Most languages ​​implementers...
This paper adds effect handlers to a number of languages, including Haskell - and also adds a form of effect typing to Haskell. But what's the point of the latter? I know that effect types can be used in a metaprogramming context (e.g. in a compiler) to prove the soundness of optimisations, but are there any uses of ef...
Say I had an input $\langle3,17,15,9,1\rangle$, could I for example begin by comparing 1 with 3 so that 1 appeared at the start of the sorted sequence straight away or would I first have to compare 3 and 17 and then continue working from left to right with consecutive numbers? If the latter is correct, do I then have t...
Given some strings, is there some algorithm (and program that implement such an algorithm) that can create a regex which matches some of the given strings and not the other given strings? Note that the given strings are not all the strings that will be met by the regex. I hope the regex can generalize well on other s...
How can TSP be an NP-optimization problem ? The definition of an NP-optimization problem $\Pi$ states that for each instance $I \in \Pi$ , the set of feasible solutions $S_\Pi(I)$ is non-empty and that the size of each $s \in S_\Pi(I)$ is polynomial bounded in $|I|$, where $|I|$ denote the size of $I$. However, in th...
I'm having a really hard time understanding some of these concepts. I've read them over from several different sources and still can't reach the a-ha moment. I need to prove a language $L$ is not Turing-recognizable by giving a reduction from the following language: $$D = \{\langle M\rangle \mid M \text{ rejects input ...
Given a matrix $A \in \mathbb{R}^{n \times p}$ and a vector $x \in \mathbb{R}^p$, I am interested in computing the value of the mean matrix-vector product: $$v = \frac{1}{n} Ax$$ If I did this using standard matrix-vector multiplication, then it would take $O(np)$ operations. I am wondering if there exists an approxima...
Haskell's Data.Sequence uses Hinze-Paterson 2-3 finger trees to represent finite sequences. The types are defined below for concreteness. Currently, the library offers a stable sort via a list-based merge sort, and an unstable sort using a binary heap. I was thinking about whether it would be possible to write an effic...
It seems that the distinction between fibers and threads is that fibers are cooperatively scheduled, whereas threads are preemptively scheduled. The point of the scheduler seems like a way to make an otherwise serial processor resource act in a parallel way, by "time-sharing" the CPU. However, on a dual-core processo...
Given the limitations of greedy (i.e., not always finding the optimal solution), does sampling the data space in a randomized manner or some structured manner reduce or remove the limitations of greedy algorithm? I understand the answer to this is problem-specific, but given a problem that shows the limitation of greed...
While preparing for my data structures final I came across this problem: A - a given array of integers of length n. Propose data structure which supports the following operations: Init(A) - initialisation of the structure given the array A. Worst case complexity: O(nlogn). LengthOfLongest() - returns the length of the ...
this is my first question on this site. I‌ recently, study on NP. I have some confusion about this Topic, and want to propose my inference and some one verify me. I) each NP problem can be solved in Exponential Time. II) if P=NP then NP=NP-Complete. III) The following problem is in NP: given a natural number, determ...
I am recently learning about automaton and I was confused at an exercise that was given to me. In the lecture, we were given this exercise: Given a FA with transitions $$\begin{array}{c|ccc} & a & b & \epsilon \\ \hline q_1 & \varnothing & \varnothing & \{q_2\} \\ q_2 & \{q_3, q_4\} & \varnot...
Suppose I want to generate a $n$-dimentional (random) Lattice, and then output a list of all orthogonal vectors of length $d$. What are the possible algorithms to do this, in poly-time? one way certainly, is to output the weighted orthonormal vectors, $d.e_i$, where $e_i = \{0, 0, \cdots, i, \cdots, 0, 0\}^T$, but let'...
I am currently taking a course in computer networking and I am curious about the following situation: Given $n$ packets and a window size of $n$ (i.e., the number of packets is equivalent to the window size), what would happen in the following scenario?: Packet 1 is sent by Host A and the corresponding ACK is received....
I'm aware that there must be something wrong with my reasoning, but I'm not sure what and neither are a few other CS people I've asked. So here goes: Take the following problem for example: Let $x[n]$ be a real valued discrete signal of length $N$. It is known that the signal is of the form $$x[n] = sin(an) + sin(bn) ...
I am taking an algorithm analysis class and am stuck on one of my homework problems and would appreciate it if I could receive some guidance. The problem I'm stuck on is proving that the empty language and $\{0, 1\}^*$ are the only languages in P that are not complete for P with respect to polynomial-time reductions (p...
I've come across a problem which at first appeared to be a markov process however the transition matrix of the graph is non-stochastic. That is, the probabilities among edges leaving a node do not sum to 1. However,the probabilities on edges entering the node do sum to 1. Therefore the transpose of the transition matri...
The transitive reduction problem is to find the graph with the smallest number of edges such that $G^t = (V,E^t)$ has the same reachability as $G=(V,E)$. When $E^t \subseteq E$ it is NP-complete. When $E^t \subseteq V\times V$ but not necessarily of $E$, this problem is polynomial time solvable. I am wondering about th...
I ran into a fun interview question, yesterday. Can anyone help me? Suppose a binary tree with six nodes is given, such that each node has only a left child. With how many "right rotate" operations (without any left rotates), we can convert this tree to a tree in which each node has only a right child?
The Quadratic Knapsack problem, introduced by Gallo, is an optimization problem in the following form: $max \sum_{i=1}^n{\sum_{j=1}^n{q_{ij}x_ix_j}}$ $s.t \sum_{i=1}^n{w_ix_i} \leq c$ $x \in \{0, 1\}^n$ Where $n$ is the number of items, $c$ is the capacity (positive and integral) of the knapsack, $w_i$ are the positive...
The transitive reduction $G^t = (V,E^t)$ of a graph $G=(V,E)$ is the smallest graph with the same reachability as $G$ with the property $E^t \subseteq V \times V$. The minimum equivalent graph $G' = (V,E')$ is the smallest graph with the same reachability as $G$ with the property $E' \subseteq E$. Consider the case whe...
I should prove that $(A^+)^* = A^*$ in a very formal way, any hints?
Suppose that $A$ is a regular language. How can I show that $A^2 = A \cdot A$ is a regular language? Is there a construction?
Natural numbers are defined inductively as (using Coq syntax as an example) Inductive nat: Set := | O: nat | S: nat -> nat. Is there a standard way to define integers (and maybe other sets like rationals and reals) constructively?
So we have a lot of line queries in the plane, and for each line query we want to know the number of segments that intersect that line (are stabbed by the line) for a given set of segments in the plane *(not necessarily axis aligned). The set of segments is fixed but the number of query lines could be large. I was thi...
Given a set of strings $\{s_1, s_2, \cdots, s_n\}$, is there a way to encode them to a program $P$, such that given some string,$s$, the program can test the membership efficiently (deterministically or probabilistically), BUT no adversary can ever learn/extract any (member) strings from the program (in polynomial time...
I am writing a paper in which the worst-case analysis of a certain randomized algorithm is correct with probability $1-1/n$ (where $n$ is the size of the problem). I find myself writing, time after time, the following sentence: "With high probability, in the worst case, the performance of phase A is at most X". The ...
This question is not necessarily related to Christofides algorithm per se, I just ran into it when reading about it. I assume that a minimum spanning tree must have an even number of odd-degree vertices, since Christofides algorithm uses this fact to find a perfect matching between "the set of vertices with odd degree ...
How does one determine what memory cells (addresses) are being read into a cache? For example if we read at adress "C000EAFCH", which memory cells will be read into the cache if the cache is 64 byte and each cacheline is 8 byte? If we use direct mapping, would one say that there are the 4 previous bytes and the 4 next ...
The common examples of NP-hard problems (clique, 3-SAT, vertex cover, etc.) are of the type where we don't know whether the answer is "yes" or "no" beforehand. Suppose that we have a problem in which the we know the answer is yes, furthermore we can verify a witness in polynomial time. Can we then always find a witness...
I have found the following example: As an example consider the case when the input space $ {\mathcal{X}}$ consists of images of $ 16\times 16$ pixels, i.e. $ 256$ dimensional vectors, and we choose $ 5$th order monomials as non-linear features. The dimensionality of such space would be $\displaystyle \left(\be...
According to wikipedia, Cocktail-sort has an average performance of $O(n^2)$, whereas Comb-sort's average performance is $Ω(n^2/2^p)$, where $p$ is the number of increments. There's no explanation given for this substantial difference between two similar algorithms, both variants of Bubble-sort. Can anyone help explain...
I have only intro CS under my belt, so I'm looking for some fast advice. I want to write a scheduling algorithm for the following scenario. I have customers who have selected how many hours they want and what times they are available (choosing in 4 hour increments). I have 1 service person I then need to schedule to ma...
Here's what I have as the tweaked format I'm to use: S EEE MMMM (excess 8 format) s = sign bit, E = exponent bits, M = mantissa/fraction bits Otherwise, it follows the IEEE 754 in principle. The values: (-1)^s x 0.0: e == 0, && m == 0 (-1)^s x 0.M x 2^-2: e == 0, && M != 0 (-1)^s x 1.N x 2^(e - 3): 0 < e < 7 (-1)^s x ...
Can someone explain why pagerank defined for undirected graph with no damping factor is equivalent to the degree? $\sum_{j\in N(i)}{\frac{p(j)}{d(j)}} = d(i)$ I looked up every book I could, but they all say it's trivial and skip the proof, making me feel stupid.
In 1962, you could win a prize of \$ 10 000 (about \$ 80 000 in today's money) if you found the solution to an Euclidean travelling salesman problem defined on 33 cities. http://www.math.uwaterloo.ca/tsp/history/pictorial/car54.html Looking at the picture, the problem seems pretty easy. However I failed to find more de...
According to Wikipedia: ...metaheuristic is a higher-level procedure or heuristic designed to find, generate, or select a lower-level procedure or heuristic (partial search algorithm) that may provide a sufficiently good solution to an optimization problem... So a metaheuristic is something like a shaman (maste...