instruction
stringlengths
35
29.1k
In classical kD-trees, the splitting dimension is chosen using a simple and systematic rule: dimensions are taken in a round-robin fashion. But extra freedom is available because you could very well choose the splitting dimension at will on every level, and even differently on every node. Has this been investigated ? C...
What is known about the languages: $$S_f = \{ [M] \ | \ \exists{x} \ \text{s.t.} \\ M \ \text{accepts} \ x \ \text{in} \ f(|[M]|) \ \text{steps}, \\ \ |x| \leq f(|[M]|) \}$$ I used to think that in order to check whether a string $[M]$ is in $S_f$ you cannot avoid simulating $M$ on all possible $x$ whose length is less...
As described here the Takagi factorization of a square symmetric complex matrix $A=VDV^T$ where D is a real nonnegative diagonal matrix, and V is unitary. I'm wondering what the complexity of calculating this is for a $n\times n$ matrix? I would think $O(n^{2.8074})$, if using Strassen's matrix multiplication algorith...
I'm trying to understand Complexity of the hamiltonian cycle in regular graph problem [1]: I don't understand this part: Lemma 2.11: HC-3-regular-(n-even) is NP-complete The result is obvious since the number of edges of a 3-regular graph is (3/2) n. I don't understand what is the relation of the number of edges and ...
I have a flow question which I'm stumped on but seems like there should be an answer that I am not seeing. Consider a network with a start $s$ and an end $t$ and a bipartite graph $L \cup R$. $s$ is connected to all vertices in $L$ via edges with capacity $1$. All vertices in $R$ are connected to $t$ via edges with cap...
Is there an efficient algorithm for minimizing a deterministic PDA in terms of states? Is it even computable? I know that it is not possible to minimize a PDA in general, but my question is about deterministic PDA. For tools like lexer generators, where occasionally a counter or a stack would be needed to lex languages...
For a given integer exponent $e$, I want to identify all factors of an integer $n$ which are of the form $p^{e}$, where $p$ is a prime. So, for $e = 1$, this is equivalent to getting the unique prime factors, for $e = 2$ it's extracting all of the square factors, etc. Currently, I am doing this by iterating over the po...
Question I was asked: Does it make a difference if I say "The worst case run time is $O(n^2)$ vs the worst case run time is $\Theta(n^2)$?" To me, the only difference is that when we say $O(n^2)$, the function may also be $O(n)$, we do not know. But when we say $\Theta(n^2)$, we know for a fact the function is $O(n^2)$...
I was reading through Sipser's "Introduction to the Theory of Computation" and in it, he states that all computational models with unrestricted access to unlimited memory are "equivalent in power, so long as they satisfy reasonable requirements". He gives the example of an requirement which is that only a finite amount...
I have the following slide in my notes and I'm having trouble understanding how the three assertions are equivalent. I understand to a degree how the 2nd and 3rd assertions are equivalent, but the equivalence between the 1st and 3rd as well as the 1st and 2nd isn't really explained well here. Am I missing something? Is...
I'm looking for a data structure to help me solve the following problems: EDIT: This describes a skyline query. Given a set of points (x,y), find the subset of points where if you order strictly increasing by one dimension, we only take points that are also strictly increasing in the other dimension. We must be able to...
DOI: 10.3390/e24070884 provides pseudocode for computing the assembly index of an object. It is written as recursive algorithm, which might be fine. But I would like to implement an iterative version of this in Python which has a recursion depth limit. Although this limit can be changed within a given program, an itera...
I have a problem in a Data Structures course I am taking. The question is as follows: Given a number of variables $x_1,\dots,x_n$ and given $m$ equality and inequality constraints (in total $m$ constraints). Find if there exists a valid assignment that satisfies all constraints in $O((m+n)\log^*n)$ and in $O(m+n)$. For...
I have a pathfinding project and I want to use Kruskal's algorithm as a maze generator. I am using a rank-based disjoint set data structure to detect cycles, which seems to be the standard way. However, the mazes that I generate cannot be solved. Which leads me to think that there might be something wrong with my imple...
Roots of unity are trivial to find numerically--just evaluate $sin$ and $cos$ to whatever precision you require. But suppose (because it's true) that I want exact algebraic representations for symbolic manipulation. Well, I could cheat and use polar form, and store exact algebraic representations of the magnitude and a...
Recently, my girlfriend and I were trying to get out of the house, when I encountered a phenomenon which I thought might be analogous to a tradeoff in concurrent systems. Here's the real world setup. Processes Process A: Girlfriend orders coffee on phone. Process B: Girlfriend gets ready at apartment, and ideally driv...
I've seen some questions regarding the regularity of prefix language of non-regular languages (for examples, here and here). In both cases, the prefix language ended up just being the whole set of words $\Sigma^*$, for $\Sigma$ the alphabet over which the languages are defined. So I was thinking of examples where $\mat...
Is there an algorithm for enumerating a sequence of minimal-length substrings composed of terminal symbols within some CFG which are not substrings of any string in the language defined by that CFG? In other words, given a CFG, $G=(V,\Sigma ,R,S)$, find a sequence of increasing-length strings $E = \{e \in \Sigma^+ \mid...
If I reverse a single edge in a DAG, how can I efficiently propagate the effects of that (e.g. change other edges) such that I don't introduce any cycles by said reversal? Is there a named algorithm for this that I should look up? I see some other questions about reversing an entire DAG; I'm only concerned with a singl...
Consider the stable marriage problem with $n$ men and $n$ women. Let $A$ and $B$ be two stable matchings, and suppose that we form a new matching $C$ by assigning to each men his favorite partner between the ones he gets in $A$ and $B$. Prove that $C$ is also a stable matching. This is my attempt. I'm stuck at proving ...
In other words, if I have 10 arrays each with 10 of the same values but scrambled their order and heapified them all, is it possible to have different results?
The wikipedia for even-odd rule says On a simple curve, the even–odd rule reduces to a decision algorithm for the point in polygon problem. On a complex polygon, there are clearly false negatives in the holes. For example, the hole in the middle of a pentagram is within the boundary of the polygon, but any ray to the...
In [1], Corollary 2.3, after proving that HC-k-(n-even) for a fixed k >= 3, the paper says that HC-k-regular being NP Complete is an inmediate consequence of the former. Where: HC-k-regular-(n-even) means if the graph has a hamiltonian cycle in a k-regular graph with an even number of nodes. And HC-k-regular means the ...
Let $M$ be a collection of elements given in the form of the array such that membership of any element can be done in $O(1)$ time. Which means elements of array $M$ are $\{1,2,\cdots,n\}$ such that $1$ is stored at $M[1]$ and $2$ at $M[2]$ and so on. The goal is to sample an element from the array $M$. Note that we hav...
I've learned that finite automata doesn't have memory and hence languages, where there are comparison within the string, can't be considered regular. In our university there was a question where the following language was considered as regular in the solutions: $\{WXW^R | W,X ∈ \{0,1\}^*\}$ here, $W^R$ is the reverse o...
I have a question for my thesis research, but I am not able to find proof of this. Does anyone have any idea on what should be approach be in order to prove this? Question: Prove that L1 ∪ L2 ⊆ L1L2, if λ ∈ L1 ∩ L2
I'm just a beginner, I've started learning programming, CS, math, and Unix. I know how to code in Pascal and also study C. In the university a professional programmer, who teaches coding, said that literally everything in C is a side effect. Accessing a volatile object, modifying an object, modifying a file, or callin...
Suppose we want to prove by induction that $f(n) \in \Theta(g(n))$. How should the induction proof be set up? I'm tempted to say that the base case should prove that $f(1) \in \Theta(g(1))$ and the inductive step should be to prove that if $f(k) \in \Theta(g(k))$ for some $k\in\mathbb N$, then $f(k+1) \in \Theta(g(k+1)...
Trying to solve the recurrence, but no clue how to deal with the (loglogn)^2 part
Fano's inequality says the following: Theorem: Let $X$ be a random variable with range $M$. Let $\hat{X} = g(Y)$ be the predicted value of $X$ given some transmitted value $Y$, where $g$ is a deterministic function. Let $p_e$ be the probability of making a mistake, i.e., $p_e = Pr[ \hat{X} \ne X ]$. Then $p_e \ge \fra...
I'm interested in characterizing the complexity of a decision problem related to path planning. For instance, consider the following problem: Given the current location and battery charge of an outdoor robot, does a trajectory exist such that the robot reaches a goal region without running out of energy? I assume the ...
I want to find the slope of the building with respect to the ground which means that I need to find how tilted is the building with respect to the ground through computer vision or any other techniques?
There is a relational schema :- person (id, name, phone no, address, email, position) so there will be the following functional dependencies FD1:id, phone no, email -> name, address, position FD2:id -> name, address, position, phone no, email FD3:phone no -> id, address, position, name, email FD4:email -> id, address,...
I was told that search algorithm such as IDA* or Beam Search with any inadmissible heuristic is not guaranteed to find a solution. Can someone explain why that is the case? I was thinking sure the solution may not be optimal as the agent is too pessimistic to try out a potentially optimal path, but as least it will try...
There is a counter that counts the number of items in the store. For every increase in item or item that has been inserted, the cost is a + kb where k is the number of digits that has been changed in the counter. For example, from 2999 to 3000 we have a + 4b as 4 digits has been changed and from 999 to 1000, we also ha...
flag=true for x=1 to n do { for i=1 to n do { for j=1 to n do { if flag=true then { for m=1 to k do { for l=1 to k do { some statements.... taking constant time } } } some other statements....taking constant time ...
Considering the runtime analysis (with the master theorem) of the function below $T(n) = 12T(\frac{n}{4}) + 2\sqrt{n} + \log^4(n)$. As I could not figure out a way to get the equation in the form $T(n)=aT(\frac{n}{b}) + \theta(n^d)$, I aimed to get the equation in the form of $T(n)=aT(\frac{n}{b})+\theta(n^k\log^pn)$ ...
Grinding through leetcode, I came across the question of the number of binary tree topologies for n nodes. When looking up the best solutions, I saw the same line of code in each solution: numberOfTrees += numberOfLeftTrees * numberOfRightTrees; Why is the number of left and right trees multiplied together? Whole solu...
The Total number of comparisons for the worst case in the "Brute-Force String Matching" algorithm is: (n-m+1) where n = lenght of string and where m = length of pattern, that all makes sense to me except I want to be SURE my understanding of the +1 is correct. Let me set up an example first: n = "four" m = "it" So we c...
Consider an algorithm that is tasked with searching the array A. Let n be the size of the array, let i be a random number between 1 and n. Finally, k is the target object we are searching for. If A[i] = k, we have a match. If A[i] != k, we pick a new random i. The algorithm terminates when we have established a match o...
I'm developing a functional programming language that offers Rank-n polymorphism. Like Haskell I don't want types to appear at the term level, but I have no idea to insert type abstraction and type application in a term afterward. For example, identity function is defined like below in Haskell. id :: forall a. a -> a i...
I'm newbie in algorithm time complexity. I had a function, f(n) = 2n2 - 4n. I have to proof that f(n) = O(n2). We can take it like this: f(n) = 2n2 - 4n $\le$ 2n2 + n2 $\le$ 3n2 What if I just omit the -4n? Because, 0 is the upper bound of -4n? So, it becomes like: f(n) = 2n2 - 4n $\le$ 2n2 + 0 $\le$ 2n2
Today in my algorithms class, my professor explained how in divide and conquer algorithms we do things in "parallel" although I felt it was not exactly in parallel. Then I remembered from OS the fork() system call that creates literally another child process and computes in parallel with the parent process. Can we comb...
I am a mathematician novice with the theory of computer science. During the course I took, we dealt with decisional problems (introducing D, SD, coSD classes language side, and P, NP, coNP, EXP, DP, AC0, complexity side) while we have only mentioned the function problems. I used the book Automata, computability and com...
I'm self studying Introduction to Theory of computation and I'm a bit confused about a problem definition. I'm trying to understand and verify whether my proof is correct or not. Question: Prove that the regular language is closed under perfect shuffle The perfect shuffle between two languages $A$ and $B$ is defined as...
I am learning about blockchain and I've read that blockchains are immutable. Suppose my health information is stored on a block and I have gotten diagnosed with a disease and now my information needs to be updated. I have read online (here) that to do this we have to create a new block with the updated data and the pre...
In divide-and-conquer, one uses the following formula to find the runtime: $$T(n) = aT(n/b) + f(n).$$ I am confused with the meaning of the constants $a$ and $b$, as well as by the question of how to find $f(n)$. The textbooks could not help me. In exercises, one usually gives this data and asks about the runtime. The ...
I know that Quicksort or MergeSort are faster than, say, Bubblesort or Selection sort. And I know why (complexity metrics) but I never been able to find out how could someone start with, for example Bubblesort, and then optimize parts of the code to end up with Quicksort or MergeSort… Is it even possible? Or it’s the c...
Given sorted $0\leq x_1 \leq x_2 \leq ... \leq x_n$ and $y_1 \geq y_2 \geq ... \geq y_n \geq 0$ non negative integers accessible through oracles, with the additional constraints $x_{i+1}-x_i \leq 1$ and $y_i - y_{i+1} \leq 1$. Can we approximate the minimum of $x_i + y_i$ with $o(n)$ oracle queries to $x_i, y_i$ values...
I have an example problem we are doing where we have xy. The special string I picked for the specific question was 0^p 1 1 0^p. My question is that when we "pump" Y, only part of y gets pumped so that the string results in 0^p+k 1 | 1 0^p. Why do we only pump the first half of Y if the whole special string is equal to ...
I am interested in the formula of modularity difference between two partitions considered in the Louvain algorithm for community detection in graphs. I give a formal expression of this question below. Consider an undirected graph $G$ with vertex set $V$. If $G$ is weighted, $\omega(u,v)$ denotes the weight of the edg...
(Short discaimer: I'm a mathematician by education (category theory, algebraic geometry) and so mostly unaware of how different fields in CS relate to each other. I'd be very happy to just get some directions. Also I'm not sure if the tags I added to the question are all correct.) My question is concerned with informat...
I have always assumed that "Linked List" is something in the lines of struct Node { SomeClass payload; Node * next = nullptr; Node * prev = nullptr; } This implies the restriction of working with objects of only one type. Considering lists are horrible in access time I doubt anyone really constructs them o...
I am taking a class in computer science and I am not sure about the following. When one transforms $247_{10}$ into its binary counterpart one gets $11110111_2$. However, the same binary number corresponds also to$-9$ when the 2-complement representation is considered. How does the computer know which of the two numbers...
I am looking for a long list of words/terms which are related to aligning one string to another. String Metric Edit-Distance Bioinformatics Needleman–Wunsch Algorithm Sequence Alignment Global Alignment Local Alignment Levenshtein distance Hamming distance Damerau–Levenshtein Jaro distance Did I miss any? What would ...
Is the complexity of $F(n) = n \cdot n^{\log_3 2}$ allowed to be written as $O(n)$, or must you specify and say $O(n^{1.63})$, or even must you write $O(n^2)$ since it is an upper bound?
I was wondering if anyone can point me to a data structure that supports the following operations. Goal is to create a data structure $D$ that stores 64-bit integers and provides the following operations: min() in $O(1)$ worst-case time max() in $O(1)$ worst-case time predecessor($x$) find the greatest element $y \in ...
Faster CPUs solve the same computational problems in shorter time frames. The same applies to faster GPUs. Therefore, replacing with faster components can reduce the computer's power consumption. On the other hand do some components need more electrical power for instance for ventilation. How do you estimate which comp...
I noticed that when you compress data they can compress multiple files and since all files are made up of bytes how do these compression algorithms keep track of them? What seperators do they use? From my understanding it goes like this, for example I have an array [1,2,3] and another array [4,12,6] and I store them in...
I'm required to describe an implementation of a data structure that holds key,value pairs, which can be signed integers. We need to be able to init() in O(1), insert(x) in O(logn), delete(x) in O(logn) and sumPrevious(x), which returns sum of values of the keys that are smaller than key 'x', in O(logn). An AVL rank tre...
I am trying to understand how (n-m+1) (n being the string and m being the pattern) is derived. As in, how could you determine a formula for the number of comparisons in the worst case of a brute-force string matching algorithm. Here is a look at (n-m+1) being mathmatically derived (where I'm at), that I found: In the ...
Let $\mathcal{A} \subseteq \mathcal{B}$ given as a collection of arrays. The degree of an element $a \in \cup \mathcal{A}$, is the number of sets of $\mathcal{A}$ that it contains - that is, $d_{\mathcal{A}(x)} =|D_{\mathcal{A}}(x)|$, where $D_{\mathcal{A}} =\{A \in \mathcal{A} \mid a \in A\}$. The algorithms is as fol...
I am currently experimenting on compression algorithms, I am using proven algorithms and I am just trying to see if I can make some things more efficient, so I am very sorry if this is a stupid question. I am trying to decode an array from a string for example I have [123, 4, 12, 7, 51] so if I turn this into a string ...
I want to analyse the time complexity for Unsuccesful search using probabilistic method in a Hash table where collisions are resolved by chaining through a doubly linked list. And the doubly linked list is kept in sorted order (Ascending). I proceeded in the following way: We will stop if the element in the linked list...
We know that if $T_1 = \{e_1, \dots, e_n\}$ and $T_2=\{f_1, \dots, f_n\}$ are MST then if we order the edges such as $$w(e_1) \le w(e_2) \le \dots \le w(e_n)$$ $$w(f_1) \le w(f_2) \le \dots \le w(f_n)$$ then $w(e_i)=w(f_i)$ for all $i\in [n]$ This also (trivially) implies that $w(e_1) \le w(f_i)$ for all $i\in [n]$ Doe...
In relational databases, what are the practical or theoretical ways to reduce the size and spatial complexity of intermediate indexes or tables* at execution time (so for example to reduce the size of intermediate indexes when running a join on a time series data with millions of entries). Additional research papers or...
In the comparison sort model of sorting, the fastest possible algorithm is order $n \log(n)$, where $n$ is the number of input numbers. What is the time complexity of sorting a list of natural numbers, each represented as a string of ones and zeros, and separated by commas? For example, the input $11,1,10$ would be sor...
I'm reading Algorithm Design and Application, by Michael T. Goodrich and Robert Tamassia, and sometimes the pseudo-code in this book doesn't make sense at all. At chapter one they show us 3 solutions for the famous maximum subarray problem. I understood completely the first and second solutions, but the third one (the ...
A post claims 5 of the trees shown in the following figure are all binary search trees I guess the author's making a mistake, since the 2 trees on the right ARE NOT binary search trees. As an example, in the last tree pointed out by red rectangle, the key 1 is in 2's right subtree, which doesn't satisfy the binary-sea...
What is the time complexity of the best-known algorithm to search for the largest complete bipartite subgraph (not induced subgraph, since not all edges have to be considered) in a given graph? A complete bipartite graph $G = (V, E)$ can be partitioned into two subsets $V_1$ and $V_2$ such that each vertex of $V_1$ is ...
In order to show that Lambda calculus and Turing machines are equivalent it is sufficient to show that you can simulate one in the other [both ways]. We can observe it in action. Can one do the same on general recursive functions [ie mathematical functions as defined by Godel] Are there any reference reading materials?...
How to determine if an integer x > 0 can be represented as 20n + 50m + 100k, where n,m,k >= 0 and are integers.
Given some ordered list of $n$ items, I obviously have $n!$ possible arrangements. However, as a heuristic in some larger algorithm that needs to find the optimal order, I want to do some quick local exploration. One option is to walk through all possible removal & insert operations at $O(n(n-1))$. A similar option is ...
This video claims that the Mersenne-Twister is based on the Linear Congruential Generator. The math in the Mersenne-Twister original paper is a bit too much for me. I have not seen that claim explicitly made in the wikipedia article for Mersenne-Twister or in some of the other sources I consulted. Is the Mersenne-Twist...
Is this language context free? $L = \{a^kb^lb^ka^l \ | \ k,l \in \mathbb{N}\}$ Using Pumping Lemma and $z = a^nb^nb^na^n$ I find it contradicting PL. If $z = uvwxy$ and $|vwx| \leq n$, follows: $vwx$ is in either $a^n$ or $b^n$, second $b^n$, or second $a^n$. After pumping form of the word changes and thus pumped wor...
I'm trying to optimise (to a certain precision) a monotonic function for many points (100+). I know a-priori that the function is continuous, with some parts zero derivative. I know that all points lie within a range [a, b]. My current approach is to sample the range [a, b] with N points, and then find the closest init...
We know that computer programs are either AOT compiled, JIT compiled or interpreted And we also know that AOT compiled programs usually get compiled from its high level source code into machine code Now the question is, if machine code is so hard to understand and write, why the idea of compilers wasn't to translate pr...
I understand that if f(n) ∈ O(g(n)) and f(n) ∈ Ω(g(n)), we can conclude that f(n) ∈ Θ(g(n)). But what if we have an algorithm where the Big-O and Big-Ω are different? For example f(n) ∈ O(n^2) and f(n) ∈ Ω(n). Then what would be its Big-Theta notation? To me, it seems that both f(n) ∈ Θ(n^2) and f(n) ∈ Θ(n) would be te...
There are many posts here and elsewhere asking for algorithms to simplify simple arithmetic expressions. For example, this question asks how to simplify the expression $axc + byc + ayc + bxc$. Symbolics and xcas are two examples among many of Computer Algebra Systems (CAS) that can do this. But Symbolics and xcas perfo...
Let's assume I have the following regular language: L = {1,0}*{010}{1,0}* I would like to convert this to regex for a program. Would the equivalent regular expression for this be: ((0+1)*(010)(0+1)*) or ((0+1)*(010)(0+1)*)* Or is it something else completely?
Consider the reduction $A_{TM} \le_m \overline{E}_{TM}$, where $$A_{TM} = \{\langle M, w \rangle \mid \text{TM $M$ accepts $w$}\}\text{, and}$$ $$\overline{E}_{TM} = \{\langle M \rangle \mid \text{TM $M$ accepts some string}\}$$ Then define the mapping reduction, $f(\langle M, w \rangle)$ as follows: Construct a new TM...
consider $g$ and $f$ and $h$ as $ \begin{align*} g(m) &= \begin{cases} 1 & if\;program\;m\;halts\;on\;input\;m \\ 0 & otherwise \\ \end{cases} \end{align*} $ $ \begin{align*} f(m,n) &= \begin{cases} undefined & if\;m=n \\ 1 & if\;program\;m\;halts\;on\;input\;n \\ 0 & otherwise \\ ...
We want to show that the following function $F$ is primitive recursive (using the primitive recursion scheme) : For all $x,p,a\in \mathbb N$, $F(p,a,0)=g(\eta^{p}(a))$ $F(p,a,x+1)=h(\eta^{(p-(x+1))}(a),x,F(p,a,x))$ where $\eta, g : \mathbb{N}\to \mathbb{N}$ and $h: \mathbb{N}^3 \to \mathbb{N}$ are primitive recursive ...
I designed this FSM graph to demonstrate a DFA that would accept any string that is of length 5, must contain a d, can only have as and/or bs before the d, and can only have bs and/or cs after the d. Here is what I came up with: I was wondering if there is any way to improve the graph, by, for example, using fewer s...
a formulation on an example: let's have on a grid: a position of a bee queen Q (source node), a set of positions of free cells to lay an egg E (destination nodes), and a set of positions with worker bees W (moveable obstacles). the queen and workers can move to 4 orthogonally neighboring cells (left, right, up, down)...
Here is a problem inspired by the game Across the Obelisk. 4 players have decks of cards. Each card has an integer value between 0-9 on it. The decks can be any size, and there's no other restriction on the card values - each possible card-value can be represented any number of times, including 0. The game chooses an ...
I recently was constructing boolean logic for all sorts of examples from Morris Mano's "Digital Logic and Circuit Design". I noticed that it is possible to construct a boolean logic wrt the inputs which depends on the current state. My question is that is it possible to construct a boolean logic which depend on the pre...
Problem is to decide if it is possible to partition a given array nums into k partitions. I've written a brute force backtracking algorithm. How do we analyse this algorithm to calculate average runtime (average over all possible inputs -input may be such that it ends up "back-tracking" multiple times or possibly none)...
I have system of two polynomial two variables, second order; monomials are {${1,x,y,x^2,xy,y^2}$} I want find special systems of polynomials: two or more roots in specified range, two root close to each other, roots on boundary search range, etc. I can set one root to specified position by setting first term of polynom...
Suppose we want to create a priority queue with 2 operations: insert and extract almost min. Extract almost min operation selects either the first minimum or a second minimum item from the structure randomly, removes that item from the structure and outputs that item. How can we prove that both of these operations cann...
Let $P$ be a indexable set(array) of points in $\mathbb{R}^3$ s.t. $P = \{p_0,p_1,p_2,...,p_n\}, p_i \in\mathbb{R}^3$. I want to sort $P$ so that every 4 consecutive points forms a non-coplanar tetrahedra/3D-simplex/triangular pyramid (whatever you personally call it), I know there will be left over points, so I want t...
I am reading an algorithm book. Any comparison sort must make $\Omega(n\log(n))$ comparisons in the worst case to sort $n$ elements. Can we create a decision tree for any comparison sorting algorithm even if it is very complicated for $n$?
I have a list of values: [value1, value2, value3], and I am trying to generate all combinations of replacements with some default value (DEFAULT). Basically, result like this. [value1, value2, value3] [DEFAULT, value2, value3] [value1, DEFAULT, value3] [value1, value2, DEFAULT] [DEFAULT, DEFAULT, value3] [value1, DEFAU...
According to this, a weighted schedule is considered NP-complete (not solve-able in polynomial time) if it has groups of 3 or more intervals: https://en.wikipedia.org/wiki/Interval_scheduling#NP-complete_when_some_groups_contain_3_or_more_intervals But I don't understand the explanation at all. Why are 3 grouped interv...
I'd like to know if there's a non-recursively computable language that can be accepted by the Turing machine. From the following definition of the recursively enumerable language: and from the fact that recursively enumerable = Turing recognizable (from wiki) I think the answer is non-recursively enumerable language c...
In the ideal world, systems are designed using immutable data structures. However, when you dive deeper into lower levels of abstractions, you realize that at some point a library written in C is being used to performs some tricks that merge the unmutable with the mutable. Now, I am not intrested in whether or not I sh...
It is known that the complexity class P is equivalent to the class of problems decided by polynomial-time uniform familiy of circuits. When stating the complexity of algorithms as this family of circuits, this complexity is usually stated in terms of the depth and size of the circuit. What I have not understood well is...
Someone who was explaining to me the master theorem said that for the case 1, we compare the $n^{\log_b(a)}$ and $f(n)$. If the growth rate of $n^{\log_b(a)}$ is greater than the growth rate of $f(n)$ then we subtract an epsilon to have this equality: $$f(n) = O(n^{(\log_ba) - \epsilon})$$ My question is, doesn't the n...
I think that I have found an issue with the proof of the halting problem, which would cause the entire proof to be invalid. To ensure I understand, here is Turing's proof of the halting problem being unsolvable. Proof: Assume the function $h(x,y)$ determines whether the function $y(x)$ halts on input x, $h(x,y)$ retur...
I have two non-convex polygon which intersect one another. I have written program years ago to find union polygons. I described that I has been used algorithm Weiler-Atherton. But in Wikipedia I found that Weiler–Atherton algorithm is for clipping - is Weiler-Atherton for polygon union or I have mistaken the name? This...