instruction stringlengths 0 29.8k ⌀ |
|---|
Why is the strongest postcondition for a program that just allocates x "exists x :: P" |
|hoare-logic| |
The more accurate time complexity analysis for Radixsort gives time complexity as $O(kn)$-time where $k$ is number of digits, or keys (radix is defined as the base by which digits or keys are formed, hence the name radix sort).
For example, if you are given numbers 1 to $n$ in an unsorted list, then radix-sort wil... |
null |
Suppose that we are given a graph $G = (V,E)$ and a number $n$. The problem is to find an independent set $I$ with $|I| = n$, such that number of vertices covered by $I$ is maximized (that is, the number of vertices adjacent to at least on vertex from $I$). My question: suppose that this problem's name is $\tt{BIVC}$; ... |
The following excerpt is from page 39 of the 4th edition of *'Introduction to Algorithms'* (emphasis added):
> 2.3.2 Analyzing divide-and-conquer algorithms
>
> [...]
>
> A recurrence for the running time of a divide-and-conquer algorithm falls out from the three steps of the basic method. As we did for insertio... |
Clarification of divide-and-conquer recurrence explanation in 'Introduction to Algorithms' (CLRS) |
|algorithms|algorithm-analysis|recurrence-relation|recursion| |
null |
null |
Yes, "straightforward solution" refers to the base case (and also "brute-force solution" on your slides). You need at least one base case (there could be more than one in some cases), otherwise recursion never ends and your recurrence equation is wrong. Now, the base case is often assumed to require $O(1)$ (constant ti... |
If radix sort is implemented using counting sort as the auxiliary stable sort the analysis is as follows. Let $n$ be the numbers to be sorted, $d$ the number of digits in each input number and let the range of the digits be $0,1,\cdots,k$. Then the worst case running time is $O(d (n+k))$, so that when $k = O(n)$ the co... |
(This is a copy of the answer to the same question on the general StackOverflow)
There exist algorithms that can add a vertex with all its edges to a graph with a known MST in linear time, which is faster than Prim or Kruskal. Probably the most neat algorithm proposed in the paper below [1] uses just one cleverly de... |
null |
If radix sort is implemented using counting sort as the auxiliary stable sort the analysis is as follows. Let $n$ be the numbers to be sorted, $d$ the number of digits in each input number and let the range of the digits be $0,1,\cdots,k$. Then the worst case running time is $O(d (n+k))$, so that when $k = O(n)$ the co... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
As far as I can determine by looking for examples with Google, the answer seems to be: it can be done, but please don't.
Regarding context-sensitive rules, Chomsky wrote: *Rules of this kind are quite common in actual grammatical description* (on p. 363 of: [Handbook Of Mathematical Psychology Volume II, Chapter 6][... |
> However, I think the worst case would also occur if there is only one element on one side of the pivot each time and the rest on the other side.
Yes, however..
> Is there a point, i.e. a factor of how unbalanced one side is compared to the other
When expressed as a factor, the point where it becomes quadrati... |
I was reading the book "Types and Programming Languages" by Benjamin C. Pierce, paying attention to proofs so I could learn proof techniques.
In the parts discussing the simply typed $\lambda$-calculus, I came across a theorem called "Uniqueness of Types", and its proof details are not given, so I tried to write down ... |
Is this a correct way of using structural induction to prove type uniqueness? |
|proof-techniques|type-theory|induction| |
I am motivated by the idea of generating “words” or “pairs” in a programming language or set of commands.
For example, consider any arbitrary REST API.
Beyond requesting the original URL endpoint, assume the structure of the API commands are keys and values (a dictionary of parameters).
Some of the parameters ... |
What would be the logical requirements on a language, in order to do direct meta-programming in it? |
|proof-techniques|software-verification|code-generation|reversible-computing|meta-programming| |
I know P is closed under all Boolean operations, but what about NP?
is NP closed under set difference and symmetric difference? |
is the class NP closed under set difference? |
|complexity-theory|computability|np| |
It is unknown whether $\mathsf{NP}$ is closed under set-difference.
If $\mathsf{NP}$ were known to be closed under set-difference then we would know that $\mathsf{NP} = \textsf{co-NP}$.
Indeed, for $L \in \textsf{co-NP}$, $L = \Sigma^* \setminus \overline{L}$ where $\overline{L} \in \textsf{NP}$ and hence $\textsf... |
null |
I know P is closed under all Boolean operations, but what about NP?
is NP closed under set difference and symmetric difference?
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/k87Uc.png |
I know P is closed under all Boolean operations, but what about NP?
is NP closed under set difference and symmetric difference?
is this table accurate?
[![][1]][1]
[1]: https://i.stack.imgur.com/k87Uc.png |
Typcial links are unidirectional, which has the drawback that the link
will point to invalid if its target is moved or deleted.
Bidirectional links would provide the possibility to update.
Moreover: If the target of a link is a location (folder etc.)
a bidirectional link would allow to show the "back-link" at the t... |
Bidirectional links in file systems? |
|filesystems| |
|operating-systems|filesystems| |
Typcial links are unidirectional, which has the drawback that the link
will point to invalid if its target is moved or deleted.
Bidirectional links would provide the possibility to update.
Moreover: If the target of a link is a location (folder etc.)
a bidirectional link would allow to show the "back-link" at the t... |
*Hint*: Finding an independent set of size $n$ is $\mathsf{NP}$-hard.
This much is sufficient to prove that your problem is $\mathsf{NP}$-hard as well. |
I was thinking about this question and thought about it for quite a while but couldn't come up with an answer.
Firstly, we fix an integer $N$ and a set $S$. We consider "cycles", which are tuples in the form of $(a_1, a_2, \cdots, a_k)$, where $k$ is not necessarily $N$, such that
1. All elements do not exceed $N... |
I was thinking about this question and thought about it for quite a while but couldn't come up with an answer.
Firstly, we fix two sets $R$ and $S$. We consider "cycles", which are tuples in the form of $(a_1, a_2, \cdots, a_k)$, where $k$ is not necessarily $N$, such that
1. All elements belong to $R$. That is, ... |
null |
null |
null |
Partitioning a graph into connected pairs and triplets |
We need to partition an undirected graph into connected subgraphs of size between $2$ and $k$, where $k$ is an integer.
When $k=2$, the problem is equivalent to the [perfect matching problem][1] which is known to be solvable in polynomial time.
When $k=3$, the problem is similar to the [partition into triangles p... |
The CS50 course by Edx that I am pursuing has this statement in their Week 4 practice set:
*A 24-bit BMP file, then, is essentially just a sequence of bits, (almost) every 24 of which happen to represent some pixel’s color.*
If I understand correctly,
101010101110101010101011 will represent a color.
How the... |
How to visualize 1 pixel? |
|c| |
If you think about the sample image provided as a grid of colored squares then the first pixel is the most upper left square and the sequence of bits represents that pixel color.
For each pixel you have 24 bits, assuming the color is expressed as RGB, then you have 8 bits per color channel. So 1 byte per color (from... |
null |
I wrote the following table for all the closures in those classes.
is anything there incorrect?
also, would appreciate help with coNP and coRE closures. couldn't find much information about it online.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/p1qVL.png |
P NP R RE closures |
|complexity-theory|computability|np|p-vs-np|recursively-enumerable| |
null |
null |
Minimum equivalent depth-d expression ($MEE_d$) is defined as:
Given a depth-d Boolean formula $F$ and an integer $k$, is there an equivalent depth-d formula of size at most $k$? For every $d\geq3$, the problem $MEE_d$ is $Σ^P_2$-complete under polynomial-time Turing reductions.
Now, the depth of the formula is ... |
A doubt regarding the Minimum equivalent depth-d Formula problem |
|complexity-theory|time-complexity| |
null |
This is a bit of a different question than those usually posted here; I hope it is on-topic enough, as it is specifically concerning computer science. It's been bothering me for a while, and my efforts to find discourse on this elsewhere have failed:
What are some good introductory experiments or research projects ... |
Looking for good introductory experiments / research projects |
|education|research| |
Given a set of k array**K = [k1 ,k2 ,k3 ,... ,kn]** ,we want to build a tree such that its root node is k_m ,where m is the highest value in the list and its connected to every other node and again every node is connected to every other node : Ex-
This is a example of such tree made out of array of 4 arrays:
[![Thi... |
Complexity of building a certain-type of tree and traversing such tree? |
|complexity-theory| |
Given a set of k array**K = [k1 ,k2 ,k3 ,... ,kn]** ,we want to build a tree such that its root node is k_m ,where m is the highest value in the list and its connected to every other node and again every node is connected to every other node : Ex-
This is a example of such tree made out of array of 4 arrays:
[:
- Interaction Nets
- Interaction Combinators
- Implementation of a low-level language for interaction nets, Shinya Sato
- Inpla, Interaction Nets as Programming Language
- Towards a Programmi... |
Explanation of a simple example of how an interaction net computes? |
|programming-languages|interaction-nets| |
null |
Hello fellow computer science enthusiasts,
I am seeking assistance in designing an algorithm for an intriguing problem I've encountered. I have a specific scenario that I would like to share with you, and I'm hoping someone can provide valuable insights to help me get started.
In the context of surveillance, I am... |
Efficient Algorithm To Find A Path Which Covers Maximum Area Along Polygonal Perimeter For Surveillance Application |
|algorithms|complexity-theory|graphs|formal-languages|time-complexity| |
In the context of surveillance, I am working on a project where I need to find an algorithm to determine a path along a polygonal perimeter that covers the maximum surveillance area possible. The given inputs for the algorithm include a root node, a target node, and the polygonal perimeter representing the boundaries o... |
In the context of surveillance, I am working on a project where the goal is to find an algorithm that determines a path along a polygonal perimeter, connecting a root node to a target node, while maximizing the surveillance area covered within the polygon. The given inputs for my algorithm include a root node, a target... |
null |
Given a set of k array :
**K = [k1 ,k2 ,k3 ,... ,kn]**
we want to build a tree such that its root node is k_m ,where m is the highest value in the list and its connected to every other node and again every node is connected to every other node : Ex-
This is a example of such tree made out of array of 4 arr... |
I have been recently thinking about activation functions and the explainability.
For sigmoid and tanh activation functions, I am thinking of them to be similar to logistic regression as the output of the activation function is very close to binary. So, to me the neural network is making simultaneous decisions and th... |
meaning behind activation function |
|machine-learning|neural-networks| |
$$N_{m+1}=1+\sum_{i=1}^mN_i,\\N_1=1$$
so that by subtraction
$$N_{m+1}-N_m=N_m$$ which is obviously a geometric sequence,
$$N_m=2^{m-1}.$$
The creation and traversal time are both $O(2^m)$. |
I think what you could do is do a semantic relation first, such as find similarities between the terms first then do the encoding. So if you use a pre-trained model such as BERT or GPT, then you can find the semantic similarities of the symptom terms first. Then after finding the similarities you can group them togethe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.