instruction stringlengths 35 29.1k |
|---|
I have a sorted list of numbers. I know they can be divided into two parts. I also know the sum of those 2 parts. I want to know what these subsets are. How can i find them?
The size of my list can be ~ 10^6. The sum of my subsets can be ~ 10^24.
Is there a better way to find my subset with a time complexity of O(n*sum... |
Given the condition: $T(O(1)) = O(1)$ and $T(n) \leq \sqrt{n}T(\sqrt{n}) + n$. I need to solve this recurrence relation. The hardest part for me is the number of subproblems $\sqrt{n}$ is not a constant, it's really difficult to apply tree method and master theorem here. Any hint? My thought is that let $c = \sqrt{n}$ ... |
The solution for solving the following recurrence with the substitution method involves adding the a constant inside the recurrence, which is confusing to me. This is question 4.3-2 in the CLRS textbook.
Show that $T(n)=T(n/2) + 1$ is $O(lgn)$
The solution states that the guess should be $T(n) \leq clg(n-2)$. I underst... |
In the ABC-partition problem, there are three sets $A, B, C$ with $m$ positive integers in each. The sum of all integers is $m T$. The goal is to construct $m$ triplets with the same sum $T$, each of which contains exactly one integer from $A, B$ and $C$.
The problem "feels" NP-hard, but I could not find a proof for th... |
I have taken a course "Programming for Performance" in my college and in the first week of the course, I have come across vectorization and Asynchronous Parallelism. But I am unable to figure out what is the relation and difference between the 2 of them. In the slides, the professor has provided something like this-->
... |
Consider two strings $S$ and $T$ of length $n$. Here both the strings $S$ and $T$ consists of only
( and ) that is made of parenthesis. I need to find a string $w$ which is balanced parenthesis and it should be sub-sequences of both $S$ and $T$ among all those strings $w$ i need the maximum length strings.
This problem... |
There is this general sentiment about neuromorphic computers that they are simply "more efficient" than von Neuman.
I've heard a lot of talk about neuromorphic computers in the context of machine learning.
But, is there any research into performing logic and maths in general on such computers? How would one translate a... |
Is machine epsilon the largest relative error in representing a number as a floating point number?
There are so many definitions of machine epsilon. I'm starting to get confused.
Isn't the machine epsilon the smallest?
|
If Mac OS, Linux, and Windows (mostly) all use Intel's 8086 64 bit instruction set, why can't we compile 8086 64 assembly from any operating system to any other operating system? (e.g. compile a Mac OS executable from assembly in Windows). Surely it would just be a matter of knowing what the machine code is for any giv... |
In what cases is solving Binary Linear Program easy (i.e. P complexity)?
The reason I'm asking is to understand if I can reformulate a scheduling problem I'm currently working on in such a way to guarantee finding the global optimum within reasonable time, so any advice in that direction is most welcome.
I was under th... |
I'm currently doing some research on signal processing and I got a dataset which includes the signal in itself and its "translation".
So I want to use a Many-to-Many RNN to translate the first into the second.
After spending a week reading about the different option I have, I ended up learning about RNN and Seq2Seq mo... |
I came across Strassen's algorithm for matrix multiplication, which has time complexity $O(n^{2.81})$, significantly better than the naive $O(n^3)$. Of course, there have been several other improvements in matrix multiplication since Strassen, but my question is specific to this algorithm.
If you see the algorithm, you... |
I as studying VCdimensions and growth functions and found the following example on Wikipedia:
The domain is the real like $\mathbb{R}$. The set H contains all the real intervals, i.e., all sets of form $\{c \in [x_1, x_2] | x \in \mathbb{R}\}$ for some $x_{0, 1} \in \mathbb{R}$.
For any set C of m real numbers, the int... |
I have been enjoying Pascal van Hentenryck's Discrete Optimisation course and we're in Week 4 on the wonders of Local Search algorithms for combinatorial optimisation.
I'm wondering how important the initial configuration is to the quality of solution achievable in a fixed time or, somewhat equivalently, how quickly a ... |
I have heard that there are sets that are not computable, but are lower in degree than the halting problem.
How does this not contradict Rice's theorem? Are there any concrete examples of such sets?
|
If we (scientists) came up with a way of representing numerical timestamps as letters hence reducing the number of bytes needed to represent timestamps, would that mean an improvement in internet speed as less data needs to be serialized?
|
While trying to understand complexity I run into an example of going through records organized in following way:
data = [
{"name": "category1", "files": [{"name": "file1"}, {"name": "file2"}],
{"name": "category2", "files": [{"name": "file3"}]
]
The task requires to go through all file records which is straight fo... |
"Cookies" are a user-facing computing construct. They are codified in many technical specifications, including the earliest reference in an HTTP spec, RFC 2109, published February 1997.
Many claim the use in HTTP followed from UNIX "magic cookies." Eric Raymond provided a definition of what a "magic cookie" is:
Someth... |
I have a Boolean formula in conjunctive normal form (CNF)
$$(a\vee b \vee c) \wedge (a \vee b \vee \neg c) \wedge (x \vee y)$$
I know that this can be simplified to $(a\vee b)\wedge (x \vee y)$.
Is there an algorithm to decide if a CNF is already in the reduced form or not?
Is there an algorithm that can do this redu... |
Is there an easy to use software that implements term-rewriting? Or do I need to write my own parser for it?
I am looking for something that will take in a fixed set of user-specified rules and will be able to reduce arbitrary terms under those rules. Is there a standard tool for doing such rewrites?
|
Recursive
class Solution {
int ans;
public int rangeSumBST(TreeNode root, int L, int R) {
ans = 0;
dfs(root, L, R);
return ans;
}
public void dfs(TreeNode node, int L, int R) {
if (node != null) {
if (L <= node.val && node.val <= R)
ans += no... |
Merge sort always divides array of size $n$ into parts each of size $n/2$. It then merges these two parts. So its recurrence relation is $T(n)=2T(n/2) + O(n)$. What if there is an algorithm which is guaranteed to partition the array into two parts of sizes $n/100$ and $99n/100$? So its recurrence relation will be $T(n)... |
Let $\chi$ be an instance space and $H \in \{0, 1\}^\chi$ a class with finite VC-dimension. For each $x \in X$ we consider $z_x\colon H \rightarrow \{0, 1\}$ s.t. $z_x(h) = h(x), \forall h \in H$.
Let $Z = \{z_x:H\rightarrow\{0,1\}\mid x\in\chi\}$. Is $\mathit{VCdim}(Z)<2^{\mathit{VCdim}(H)+1}$?
The only thing that co... |
I have the following question :
\begin{align}
L_2 = \{a,k\ \mid \text{ a is a 3DNF (disjunctive normal form) and} \\
\text{there exists an assignment $z$ satisfying exactly $k$ clauses in }a\}
\end{align}
I know that $L_2 \in$ NPC.
Show that $L_2 \in$ NP is relatively easy, I'll skip that part.
I try to show that $L_2 ... |
Given a sequence of integers $A_x$ of length $n$ such that $1 \leq A_x \leq N$,in one step we can remove an element, but when we remove an element we also delete all adjacent numbers which have the same value as the element we remove. We want to count the minimum number of steps to remove all elements.
For example, if ... |
I watched the Crash Course playlist of Computer Science. It was teaching about RAM, CPU, Storage etc but I felt it was way too fast and only people who have studied the course first hand understood it better.
So I wanted to ask what CS couse actually teaches the details of CPU, RAM and how it is build from the scratch ... |
Currently, I haven't learned about a functional language that can achieve the same performance as C/C++. And I have learned that some languages that favor functional programming to imperative programming, such as Scala and Rust, use imperative ways to implement their library functions for better efficiency.
So here com... |
Problem
I'm working on an app that involves shuffling and distributing playing cards to players. As a challenge, I tried to solve this problem in a way that doesn't require a trusted intermediary.
In other terms, the task is to find a distributed algorithm that
uniquely assigns $n$ agents numbers $1..n$
allows each ag... |
Could someone explain how to calculate the Big O notation for a runtime of a snippet of a code?
for (int i=0; i<list.length; i++) {
for (int j=0; j<list.length; j++) {
for (int k=0; k<list.length; k++) {
if (k%2==0) {
list[i] += list[j];
} else {
list[i]... |
Formally a consensus protocol must satisfy the following three properties:
Termination
Eventually, every correct process decides some value.
Integrity
If all the correct processes proposed the same value "v", then any correct process must decide "v".
Agreement
Every correct process must agree on the same value.
"... |
I have an assignment to draw the heap after an ArrayList and a LinkedList is created.
public static void main(String[] args) {
List list = new ArrayList();
list.add(0);
list.add(1);
list.add(1);
list.add(2);
}
and
public static void main(String[] args) {
List list = new LinkedList();
... |
Given a fixed dimension $d$, say $d=2$ we want the following:
Input: $A_1\ldots A_m$: $m$ arrays of length $n$ of integers
Each input array $A_i$ must be a permutation of the numbers $1..n$, so in each array each number from $1$ to $n$ appears exactly once.
Output: For each tuple (pairs in the case $d=2$; triplets in t... |
I've been pondering this question for a long time, that $a^ib^jc^k, i < j < k$ is a context-sensitive language, how we can prove it to be context sensitive or
which grammar can generate such a language.
|
While working on a practice problem I "organically" came up with a method that does well at solving my load balancing problem. I do not know what the official name is for it, but I would like to read more on it, I think maybe it is a greedy algorithm similar to the least connections algorithm.
Given m resources and n c... |
Having mis-read What course in CS deals with the study of RAM, CPU, Storage? I now wonder what course in CS deals with time and space complexities including GPUs, CPU caches in multiple levels, seek times on hard disk vs. SSDs, and bandwidth to disk and RAM.
I was taught the big O-notation but it never took into accoun... |
Let’s make a big list of algorithms relying on abstract algebra. This will help us see how ubiquitous algebra is in algorithm design. I’ll start with two: one is the General Number Field Sieve, the other is Babai’s graph isomorphism algorithm.
|
I am studying Pumping Lemma for Context Free Languages, wherein, I am slightly confused in a question where one of the case doesnt obey all rules but another case does. What's the conclusion? Do we call it a contradiction and declare the language is not context free or do we say there is no contradiction?
If its the fo... |
I'm a student studying a data mining course and have come across a problem.
I need to explain the problem with the help of an example scenario as I do not know how to explain the problem in any other way.
I have n 'manufacture dates' (classes). On a particular day, y identical balls are to be segregated into these n cl... |
I know, that the following is: O(n^2),
int count = 0;
for(int i = 0; i<array.length(); i++) {
for(int j = i+1; j<array.length(); j++) {
if(array[i] == array[j]) {
count = count + 1;
}
}
}
But, should something like count = count + 1; be taken into account?
For predicting or making up a c... |
How to prove that if $G$ is an acyclic transitive digraph, then the least independent sets into which all vertices of G can be divided is equal to the size of the longest paths to $G$?
|
Let $G=(V,E)$ be an undirected graph. Given a pair of vertices $s,t \in V$, how can we construct a semi-streaming algorithm which determines is $s$ and $t$ are connected? Is there any way to construct such an algorithm which scans the input stream only once?
Note that a semi-streaming algorithm is presented an arbitrar... |
I need to take an kth index element from array like data structure and delete it (k is any possible index). Array have O(n) for deleting elements, and List have O(n) for searching element. I would like to do both operations in O(logn) time.
Which data structure should I use to meet this requirement?
Clarification:
Dele... |
I'm working on a project compiling various versions of the Bible into a dataset. For the most part versions separate verses discreetly. In some versions, however, verses are combined. Instead of verse 16, the marker will say 16-18. I wonder if, given I have a lot of other versions that separate them discretely, I can t... |
I managed to find and understand algorithm for converting any $x \in \Bbb R$ from a decimal number to binary number.
But I have a hard time finding an algorithm for converting a binary number with infinite bits to a decimal number.
I will like to convert $(0.11001100...)_2$ to a decimal number.
|
So according to Wikipedia,
In the Notation of [Flum and Grohe (2006)], a ''parameterized problem'' consists of a decision problem $L\subseteq\Sigma^*$ and a function $\kappa:\Sigma^*\to N$, the parameterization. The ''parameter'' of an instance $x$ is the number $\kappa(x)$. A '''kernelization''' for a parameterized p... |
I got asked this question in an interview, where they showed me graphs of CPU being overused and RAM being normally used, and graphs of vice versa. What deductions can we make from this, and how can we fix both scenarios?
I mentioned that this was a multiprocessing vs multithreading argument. Is this true?
|
Below is the lambda expression which I am finding difficult to reduce i.e. I am not able to understand how to go about this problem.
(λx.λy.yx)z (λw.w)
I am lost with this.
if anyone could lead me in the right direction that would be much appreciated
|
So lets say I'm writing an algorithm that takes a vector as input. I want to know that I'm writing this algorithm correctly however so I of course write tests to see if the output equals what I expect on specific inputs. In fact I might do this for all vector sizes under a certain size, but I would never enumerate all ... |
I read that for the euclidean Steiner tree problem it is known that it is NP-hard, but not known whether it is in NP or not. [Wikipedia]
Shouldn't the euclidean version obviously be in NP since the metric Steiner tree problem is in NP and a non-deterministic TM that decides the metric Steiner tree problem could also de... |
I figured out a solution to a recurrence relation, but I'm not sure what the constant should be for the last step to hold.
$T(n)= 5T(n/4) + n^2$
Guess: $T(n) = O(n^2)$
Prove: $T(n) \leq cn^2 $
Breakdown
$ T(n) \leq 5(c(n/4)^2) + n^2 $
$ = (5/16)cn^2 + n^2 $
$ \leq cn^2 $
For the last step to hold I'm not sure what the ... |
Let $M_1$ be an inclusion-maximal matching in $G$ (that is, there is no matching which strictly contains it), and $M_2$ a maximum-size matching in $G$. How to prove that $|M_2| \le 2|M_1|$?
|
I’m attempting to write a heuristic for an implementation of A* search. The problem involves rearranging cells in a 3D grid until they match a particular solved state. I’m looking for options for a heuristic that does the following:
Given a set S containing N start coordinates and a set G containing N goal coordinates,... |
An SUBSET-SUM instance is a list of $n$ integers $\{ a_1, a_2,... a_n\}$. To evaluate a subset is to output the sum of a subset.
However, I want to know, is it possible to create a new instance $T$, the same size as the original set $S$, that any subset in $S$ that evaluates to $W$, the corresponding subset in $T$ (the... |
I have m bins (sums) and n summands. Each summand goes into a bin. In order to minimize the standard deviation, I have a greedy algorithm that appears to accomplish this. I am not sure of the name, but would like to know more. All m bins must have a sum greater than zero at the end of the algorithm.
It seems simple:
so... |
I am trying to execute the following algorithm shown in the image from my course slide. I am trying to get the table shown in the image:
1st Iteration
L2: 1:CS=A, SL = A, NSL = A
L3: while NSL!=[]: true
L4:
L6:no children: false
L17:NSL =BCDA
L18:CS:=B
L19:SL=BA
L20, L21
2nd Iteration
L3:While NSL (true)
L4:
L6:no ch... |
We know [Ben-Or 1983] that deciding whether all elements in an array are distinct requires $\Theta(n \log(n))$ time; and this problem reduces to finding the most frequent element, so it takes $\Theta(n \log(n))$ time to find the most frequent element (assuming the domain of the array elements is not small).
But what ha... |
From my understanding, malloc and-the-like allocate contiguous blocks of memory. It then returns to you the start address of the memory block.
This (and other things) leads to memory fragmentation where, after allocating/freeing many times, you have holes where there is unused memory that can't be accessed.
I am imagin... |
Let us say that I want to compute $f(x) = \sqrt{x^{2}+1}-1$ for small values of $x$ in a Marc-32 architecture. I can avoid loss of significance by rewriting the function
$$f(x)=\left(\sqrt{x^{2}+1}-1\right)\left(\frac{\sqrt{x^{2}+1}+1}{\sqrt{x^{2}+1}+1}\right)=\frac{x^{2}}{\sqrt{x^{2}+1}+1}$$
Even though I can solve th... |
Suppose that the problem of maximizing a real function $f$ over a certain domain $D$ is NP_HARD. What can be said about the problem of maximizing $f-g$, with $g$ being another function over $D$? Is it possible to characterize $g$ in relation to $f$ in a way that can be assured that maximizing $f-g$ is also NP-HARD?
|
Say you have 3 objects, a global MemoryStore, which has an array of MemorySlabCache objects, and each MemorySlabCache has an array of MemorySlab objects. Sort of like this:
class MemoryStore {
caches: Array<MemorySlabCache> = []
}
class MemorySlabCache {
size: Integer
slabs: Array<MemorySlab> = []
}
class Memor... |
A sequence is called good if it contains at least one pair of numbers which are adjacent and equal. A good sub-sequence of an array is a sub-sequence of that array which is good and has maximal length.
Now you are given two arrays $S$ and $T$ with integers. You need to find a sub-sequence which is common to both arrays... |
Answer is c). I understand that the expression evaluates to true but what does signed/unsigned have to do with booleans?
|
Regarding this question: Rummikub algorithm.
I was reading the first part of the solution in the posted answer (specifically, when there are no jokers involved, all tiles are distinct and only four colours are involved). Then, I reached the part in which the says that the algorithm runs in $O(ABCD(A+B+C+D))$ time, whic... |
I've been looking into reductions to/from the TQBF language and have managed to get stuck on something that is almost certainly not true (or, if it is true I'm missing a significant computational cost associated with it) with respect to simplifying TQBF instances.
For the sake of simplicity, let's restrict attention to... |
The definitions I've stumbled across seem to indicate they express the same idea. That's that the relationship between record types is determined by their fields (or properties) rather than their names. Their Wikipedia pages also seem to indicate the same idea:
A structural type system (or property-based type system) ... |
I am trying to solve the following exercise given here.
Consider the following number representation. How to define the addition?
|0| = λx.x
|1| = λx.λx.x
...
|n + 1| = λx.|n|
The successor and predecessor operators are easy to define:
Succ n = λx.n
Pred n = n (λx.x)
An "obvious" solution for defining the addition i... |
Recently, I was facing some problems in effectively proving the following :
Consider the alphabet Σ ={0,1,2,...,9,#}, and the language of strings of the form x#y#z, where x,y and z are strings of digit such that when viewed as numbers, satisfy the mathematical equation x+y=z.
For example, the string 123#45#168 is in t... |
Consider an MDP defined as the tuple $\langle S,A,R,P,\mu,\lambda\rangle$ where $S$ is the state space, $A$ the action space, $R:S\times A\times S\to\mathbb{R}$ the reward function, $P$ the transition probabilities, $\mu$ the initial state distribution, and $\lambda$ is the discount factor.
Let the decision horizon be ... |
I learned that when you have a binary heap represented as a vector / list / array with indicies [0, 1, 2, 3, 4, 5, 6, 7, 8, ...] the index of the parent of element at index i can be found with
parent index = floor((i-1)/2)
I have tried to explain why it works. Can anyone help me verify this?
Took reference from Why doe... |
I always considered Symmetric TSP to be inapproximable in general, and thus by extension Asymmetric TSP as well. Once you add the condition of the triangle inequality however, you obtain Metric TSP (which can be Symmetric or Asymmetric), which is approximable (e.g. Christofides algorithm).
However, I'm having doubts af... |
The game on the graph $G$ is defined as follows. Initially, the chip is located at one of the vertices (let's call it the starting one). The players take turns, on each move it is necessary to move the piece along any outgoing edge to the vertex, where the piece has never been.
The one who cannot make a move loses. How... |
While searching for an answer to this question I found out that there is an unambiguous grammar for every regular language.
But is there a regular language for every unambiguous grammar? How can I prove that this is/isn't true?
|
The floating point representation of a real number $x$ in a machine is given by $fl(x)=x(1+\delta),\: |\delta| = \frac{|x^*-x|}{|x|} \le \epsilon$.
But I do not find this equation very insightful. Insert $\delta = \frac{x^*-x}{x}$ in the equation and you get $x^*$. So $fl(x)$ is just $x^*$. Why write $x^*$ in this fanc... |
I'm currently trying to improve my algorithm skills and I was trying a simple algorithm :
Given a list of integers. We want to find the one that is the closest to 0. If we have a number and his opposite, we want to return the positive one.
My current complexity on this algorithm is O(n). Is it possible to get a lower o... |
I understand any fraction to be a quotient of integers which isn't 0, but after coming across the term "float" in various programming languages (such as JavaScript) I misunderstand why it is even needed and we don't say a fraction instead.
What is the difference between a fraction and a float?
|
today in my class my professor mentioned that
Cache misses becomes more expensive as the speed of the processor increases
But he didn't explain the reason. I searched this statement over the internet and found no answer whatsoever.
According to me, this statement is true because, when the speed of the processor increa... |
For example, for a boolean matrix of size $3x4$, the column sum vector $C = (3, 3, 0, 0)$ and the row sum vector $R = (2, 2, 2)$ form a match because I can construct the boolean matrix:
$$
\begin{matrix}
&
\begin{bmatrix}
1 & 1 & 0 & 0\\
1 & 1 & 0 & 0\\
1 & 1 & 0 & 0
\end{bmatrix}
&
\begin{pmatrix}
2\\2\\2
\end{pmatrix... |
Given a SUBSET-SUM instance $S$ with a weight $W$, is it possible to create, in polynomial time, a new non-empty instance $T$ (at most the same length as $S$) with weight $M$, that for each non-empty subset of set $T$ and its sum $s$, it has a unique $(s-M)^2$, and that a subset of $T$ adds up to $M$ iff a subset of $S... |
You are given $n$ rows of positive integers of length $k$. We define a weight function for every subset of given $n$ rows as follows - for every $i = 1, 2, \dots, k$ take the maximum value of $i$-th column, then add up all the maximums.
For example, for $n = 4$, $k = 2$ and rows $(1, 4), (2, 3), (3, 2), (4, 1)$ the wei... |
This is similar to a previous question I asked, but doesn't seem aminable to the same technique. Given a regular language $A$, show the following language is regular:
$$
\{x|\exists y \; |y| = 2^{|x|} and \; xy \in A\}
$$
I'm aware of the notion of regularity preserving functions, and that it would suffice to show that... |
I have a set of $n$ elements. Of these elements $b\ll n$ are blue and $r=n-b$ are red. I want to find all blue elements.
My only way to discriminate between red and blue objects is by asking a blackbox that takes a fixed number $k$ of elements (with $n \gt k \gg 1$) and returns an approximation of how many of those ele... |
A set-family (a set of sets of elements) is called tree-able if the elements can be arranged on a directed tree such that each element appears in exactly one node, and each set in the family corresponds to a path from the root to a leaf. For example, the following family is treeable:
{ {1, 2, 6}, {1, 3, 4, 5, 6} }
A p... |
what is the meaning of postcondition and weakest postcondition in terms of programing and what are weakest postconditons of following statements.
1. a=2*(b-1)-1 {a>0}
2. b=(c+10)/3 {b>6}
3. a=(a+2*b-1) {a>1}
4. a=2*b+1;b=a-3 {b<0}
|
I've been trying to implement the Three-stage Algorithm to compare its results with our new proposed algorithm with different datasets than those mentioned in the article. I've succeeded in implementing the first two stages.
The third stage, however, is what I couldn't understand. To be precise, I couldn't understand h... |
First of all, I now know that 'dynamic' has nothing to do with the dynamism of a dynamic programming algorithm. But I didn't before I studied them, and I was kind of disappointed that they all seem to rely on a pretty basic recursion. Are there any problems with more interesting optimal substructures?
|
I have an optimization problem, where i need to find set of tickets for certain period, such that sum of prices for these tickets is minimal.
Algo should accepts list of trips and list of tickets as input. And output list of tickets with min possible sum price with conditions that this list of tickets covers all trips.... |
The vertex of a binary tree is called an single child if it has a father's vertex but does not have a neighbor.
The root is not considered an single child.
let mark in numOnly a number of vertices in T that hold the attribute "single son ", and ‘with n we mark the total number of vertices in the T tree.
i need to pro... |
I've only learned bit of category theory, but so far its relation to type systems seems mostly descriptive. For example, you really don't need to know about coproducts to come up with the idea of union types.
I'm looking for references to ideas in computer science that were arrived at due to results in category theory.... |
Suppose $L$ is an arbitrary formal language over a finite alphabet $A$, and suppose that $L$ is closed under prefixes (i.e. if $w \in L$, and $u$ is any prefix of $w$, then $u \in L$).
Knowing only this, can you give any positive or negative decidability or complexity results about $L$?
Thanks! :)
|
I have been doing LeetCode and tackled the problem of the 3Sum and first I tried to do a O(nlogn) solution and after seeing the proposed solution I see that the solution is $O(n^2)$ or $O(n^2 \times \log n)$ and not only that but the problem is a highly researched topic so I don't think I found a better solution but ca... |
I have been working on a project that simulates an online bank. At this point, I'm implementing the code used to create user accounts. Each account will have a sortcode and account number, I have designed an algorithm that can generate a unique number in a range then check if it isn't in the list of account numbers and... |
If I have a recurrence relationship like this:
$$T(n) = T(n/5) + T(4n/5) + \Theta(n),$$
how would I analyze its rate of growth?
I believe I can't use the master theorem. I tried to draw a tree but some of the branches terminate earlier. There's a way to calculate the big-O notation by assuming $T(n) \le 2 T(4n/5)$, but... |
I'm reading a textbook which desribe VM as:
a data structure stored in physical memory known as a page table that maps virtual pages to physical pages. The address translation hardware reads the page table
each time it converts a virtual address to a physical address. The operating system
is responsible for maintainin... |
Given a tree
To search for value 1, I do the following splay operations:
i) Zag on 7
ii) Zag on 1
And hence obtain 1 in the root. But why would this be incorrect?
i) Zag on 1
ii) Zag on 1
The final tree in this case is different.
|
A very small question on this proof, which I found as Theorem 3.21 in Sipser's, and in my lecture notes.
In the "only if" direction, we assume that a Turing machine $M$ recognizes some language $L$. We list all the strings in the input alphabet (in lexicographic order, say) as $s_1,s_2,s_3,\dots$
We then construct an e... |
What do the following mean, in the context of greater than, or smaller than?
$$
O(n \log n) > O(n)
$$
$$
O(nlogn) < O(n^2)
$$
|
I'm looking to compare 2 unweighted directed graphs and get an (ideally differentiable) similarity score. Both graphs describe a trajectory in a 2d space.
The reference graph is a step by step guide to an end location. The nodes have a value which corresponds to a precise action such as forward 1m, left 30 degrees. The... |
I know that the regularity condition for master theorem Case#3 stating that [$af(\frac{n}{b}) ≤ cf(n)$ for some constant $c < 1$ and all sufficiently large n] always holds when the $f(n)=n^k$,$f(n)=\Omega(n^{\log_b a+\epsilon})$. However, I have tried to prove this statement, and was unable to do so.
The question is ho... |
Error detection and correction codes require many bits of redundancy for correcting even a modest number of erroneous bits. However, we often have out-of-band methods to determine when and where the errors occured, such as if we observe a voltage spike that exceeds the usual signal levels.
Are there any well-establish... |
I saw this question in test. It says that insertion and deletion is easier in B+ tree compared to B tree. The given reason for this was the key to be deleted must be present in leaf node in B+ tree but the it could be anywhere in case of B tree.
But what i think is, for deletion in B+ tree, we have to go all the way do... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.