instruction stringlengths 0 29.8k ⌀ |
|---|
This is algorithms and data structures assignment and I have been thinking 3 days about it.
You are given N sections, placed on numeric axis. Numeric axis is divided by unit intervals. Each section in described by two integers - coordinates of left and right endpoints and it covers corresponding number of intervals. ... |
It’s difficult. I wouldn’t be surprised at all if it is NP-complete. Many NP-complete problems you can start with things that must be optimal. Like remove all sections covered by another section. Then take all sections that must be optimal: If yo find the k smallest intervals, then take all intervals that are the only ... |
The problem is _rename registers_.
An out-of-order processor that is told “add register r2 to r1” will not actually modify r1 but find a new register rx, set rx = r1+r2, and from then on uses rx instead of r1. This is done because there might be other unfinished instructions that still need to use the original value... |
Insertion sort is faster than quicksort if o(log n) (that is little o, not Big O) items are in the wrong place. It will move o(n log n) items. This is slower than better methods which run in O(n) if the number of items in the wrong place is O(n / log n).
Binary insertion would use log n steps to find where to inser... |
**Description of the problem:**
Alice and Bob are both given as input the same graph and vertex $x$ and $y$ respectively. In the graph there are no self-loops and the given vertex can be the same.
Prove that communication complexity between Alice and Bob for deciding whether $x$ and $y$ are neighbours is at leas... |
How to translate the problem into a Communication Matrix? |
|complexity-theory|communication-complexity| |
null |
Your reasoning is well-founded, but begins from different axioms than the ones Deutsch is using. The concern you're raising boils down to "how can _any_ infinite set exist given there is only a finite amount of matter in the (observable) universe?" This is the line of inquiry that leads to [mathematical finitism](https... |
Your reasoning is well-founded, but begins from different axioms than the ones Deutsch is using. The concern you're raising boils down to "how can _any_ infinite set exist given there is only a finite amount of matter in the (observable) universe?" This is the line of inquiry that leads to [mathematical finitism](https... |
{"Voters":[{"Id":6553,"DisplayName":"Pseudonym"}]} |
Consider the following decision problem:
Given $([b_1, \cdots, b_n],t)$, where $[b_1, \cdots b_n]$ is an array of natural numbers each less than $n^c$ and $t$ is a target natural number, do there exist natural numbers $f_1, \cdots f_n$ such that
1) $f_i \le b_i$ for all $1 \le i \le n$
2) $\prod_{i=1}^{n} f_i = t... |
null |
> The program is designed to start with values for $x$ and $y$. The variables $u1$ and $u2$ are intended to represent $x$ and $y$ in ascending order.
Provide suitable preconditions and postconditions for the program.
Then, using Hoare logic, prove the correctness of the program.
Specify all proof obligations... |
null |
The program is designed to start with values for $x$ and $y$. The variables $u1$ and $u2$ are intended to represent $x$ and $y$ in ascending order.
Provide suitable preconditions and postconditions for the program.
Then, using Hoare logic, prove the correctness of the program.
Specify all proof obligations a... |
> The program is designed to start with values for $x$ and $y$. The variables $u1$ and $u2$ are intended to represent $x$ and $y$ in ascending order.
Provide suitable preconditions and postconditions for the program.
Then, using Hoare logic, prove the correctness of the program.
Specify all proof obligations... |
I wanted to see what models would be best suited for providing a image (see the link below) and having the model perform a image to text (OCR of some kind) and laying out the contents of the image in a "question" "answers" format.
This gets more tricky as I would like to include pictures between the question and ans... |
Reading and answering a text question from a image? |
|machine-learning|artificial-intelligence|computation-models|image-processing| |
null |
I have a large set $\mathbf{V}$ of vectors in $\mathbb{R}^d\setminus\{\mathbf{0}\}$ and need to find a vector $\mathbf{u}$ that maximizes $\sum_{\mathbf{v}\in\mathbf{V}}\mathbf{1}_{\mathbf{u}\cdot\mathbf{v}>0}$, which is to say the count of vectors in $\mathbf{V}$ that have a positive dot product with $\mathbf{u}$. Alt... |
null |
null |
i saw this comment here : https://cs.stackexchange.com/questions/163375/david-deutsch-says-number-of-atoms-in-universe-is-finite-but-then-says-numbe
> ""stating there are an infinite number of programs but that a program
> cannot be infinitely long is a contradiction" That's not a
> contradiction. There are an inf... |
is this a contradiction? "stating there are an infinite number of programs but that a program cannot be infinitely long is a contradiction" |
|turing-machines| |
I am very new to competitive programming , so I wanted to know a few things about the informatics olympiads like - What are the resources and books to prepare for the competition. Also can anyone help me which problems should I solve from codechef,hackerrank etc websites because I was unable to find Olympiad problems a... |
How to prepare for informatics olympiads and acm icpc? |
|reference-request|books|programming-contest| |
write an algorithm that takes an arbitrary natural number and outputs wether or not the number is a complete squere(I need the chart of the algorithm) |
how to write an algorithm that outputs whether or not a number is complete squre |
|algorithms| |
null |
{"Voters":[{"Id":48921,"DisplayName":"kodlu"}]} |
It just means that it is not possible to write down all programs of finite lengths. You’ll probably run out of atoms at programs of length 200 or 300. |
I have a computer science problem that seems relatively simple.
1. We are given a number of 2D rectangles that we want to place next to each other on a 1D line (without rotating them). The 1D line has a certain finite length. The rectangles width is randomly and uniformly distributed between 0.1 - 10 units. The hei... |
Yes, it becomes clear if you see the error ratio:
$$r_T := \frac{T}{\log T} \ .$$
$r_T$ is a monotonic (strictly) decreasing sequence and $\lim\limits_{T\to 0} r_T = 0$, but $r_T>0 \ \forall \ T > 1$. This means that the error ratio becomes smaller and smaller as the number of iterations grow, until it becomes ne... |
Yes, it becomes clear if you see the error ratio:
$$r_T := \frac{T}{\log T} \ .$$
$r_T$ is a monotonic (strictly) decreasing sequence and $\lim\limits_{T\to 0} r_T = 0$, but $r_T>0 \ \forall \ T > 1$. This means that the error ratio becomes smaller and smaller as the number of iterations grow, until it becomes ne... |
null |
PSSM or PWM ([Positional Weighted Matrix][1]) is a common thing in biological science, used often to observe the distribution of letters inside a group of strings of the same length. It's composed by log-odds of observing a letter inside a given positions, so the value of each cell in the matrix could be either a posit... |
Generate paths of fixed length across a weighted matrix (defined in $\mathbb{R}$) whose weights' sum falls into given interval |
|algorithms|dynamic-programming|matrices|knapsack-problems| |
null |
I have a computer science problem that seems relatively simple.
1. We are given a number of 2D rectangles that we want to place next to each other on a 1D line (without rotating them). The 1D line has a certain finite length. The rectangles width is randomly and uniformly distributed between 0.1 - 10 units. The hei... |
null |
This is not a contradiction: the two numbers are unrelated.
Atoms are objects that we can observe and count in the physical world, The number of atoms in the universe is a physical property of the natural world, as described by physics.
Programs, as described in this textbook, are not physical entities; they are ... |
As a beginner to competitive programming, I want to know a few things about informatics Olympiad such as the resources and books needed to prepare for the competition. I also want to know which problems should I solve from CodeChef, HackerRank, etc because I was unable to find Olympiad problems and most of the problems... |
How to Prepare for Informatics Olympiad and ACM-ICPC? |
null |
null |
The initial approach of finding a natural number $i$ that satisfies the condition $n / i - i = 0$ may be correct, but inconvenient as we will need to handle floating point division. An alternative condition would be to use the definition of a perfect square itself, $i \cdot i = n$.
The initial approach of checking e... |
The initial approach of finding a natural number $i$ that satisfies the condition $n / i - i = 0$ may be correct, but inconvenient as we will need to handle floating point division. An alternative condition would be to use the definition of a perfect square itself, $i \cdot i = n$.
The initial approach of checking e... |
> The program is designed to start with values for $x$ and $y$. The variables $u1$ and $u2$ are intended to represent $x$ and $y$ in ascending order.
Provide suitable preconditions and postconditions for the program.
Then, using Hoare logic, prove the correctness of the program.
Specify all proof obligations... |
null |
$\mathsf{PH}[1]$ is a variant of a polynomial hierarchy in which each machine can only call its oracle once. $\Sigma^{\mathsf P}_{poly(n)}[1]$ is a polynomially "tall" tower of $\mathsf{NP}[1]$ oracles. Each of these oracles can accept an input no longer than $n+o(n)$.
Quite trivially, $\mathsf{PH}[1]\subseteq\maths... |
Properties of $\mathsf{PH}[1]$ and $\Sigma^{\mathsf P}_{poly(n)}[1]$? |
|complexity-theory|time-complexity|complexity-classes|space-complexity| |
Recall some terminology: Let $\mathsf P$ be a finite set of **propositional atoms**, and let $\Phi$ be a proposition over $P$ that is generated from $\top$, $\bot$, $\neg$, $\wedge$, and $\vee$. Then:
* A **satisfying assignment** for $\Phi$ is a function $\varsigma:\mathsf P\to\{\bot,\top\}$ such that $\varsigma\vD... |
SAT for clauses of the form "At most m out of n are false" |
|satisfiability|propositional-logic| |
$\mathsf{PH}[1]$ is a variant of a polynomial hierarchy in which each machine can only call its oracle once. $\Sigma^{\mathsf P}_{poly(n)}[1]$ is a polynomially "tall" tower of $\mathsf{NP}[1]$ oracles. Each of these oracles can accept an input no longer than $n+o(n)$.
Quite trivially, $\mathsf{PH}[1]\subseteq\maths... |
$\mathsf{PH}[1]$ is a variant of a polynomial hierarchy in which each machine can only call its oracle once. $\Sigma^{\mathsf P}_{poly(n)}[1]$ is a polynomially "tall" tower of $\mathsf{NP}[1]$ oracles. Each of these oracles can accept an input no longer than $n+o(n)$.
Quite trivially, $\mathsf{PH}[1]\subseteq\maths... |
I remember in a Computability Theory class building a state machine for an assignment that required many 'go-back' transitions on $\Sigma - symbols$ for all symbols not already handled. This was very verbose and seemed to be a thing people would run in almost all states in any sort of parser.
Is there an agreed-upo... |
Is there a symbol in FA/FSM for everything else |
|finite-automata|notation| |
null |
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
</head>
<body>
<p>
Postcondition $u_1 \leq u_2$ would work, and make in the beginning of the program assertion $ \text{True... |
the 24 hour clock/timer on my BEMER PEMF device's microprocessor is keeping erratic time lately. Shortly after I reset to the correct time, it fails to keep accurate time.
I'm wondering if exposing the motherboard will allow me to easily identify and replace the clock chip? I am a newbie and have never done componen... |
clock chip (not the CPU clock) replacement on my BEMER medical device |
|computer-architecture| |
null |
I'm learning about Reed-Solomon codes so apologies if this is a basic question. The alphabet size $q$ in RS codes grows with the block length $n$ - in particular, we have $q \geq n$.
But intuitively, what's the reason behind this constraint? This is introduced as a part of the definition in the notes I'm reading an... |
Why, for Reed-Solomon codes, does the alphabet size depend on block length? |
|coding-theory|error-correcting-codes| |
It's possible to construct SAT problems that are solvable in quasipolynomial time, but they are also solvable in polylogarithmic space. Consider, for example, the following problem:
> Let a set $S$ consist of $\mathcal O(\log^k n)$ variables. Suppose a boolean formula $\varphi(S, X)$ in 3-CNF form such that $\forall... |
Are there any SAT outside of $\mathsf{RP}$ variants that are solvable in quasipolynomial time? |
|complexity-theory|time-complexity|satisfiability| |
From the book "Fabric of reality" by David Deutsch.
> We know from quantum theory that all such variables are quantized, and therefore that, no matter how the computer works, the set of possible programs is discrete. Each program can therefore be expressed as a finite sequence of symbols in a discrete code or compu... |
null |
null |
I understood now (after ["program has a finite size"][1]) - this is "potential/unrealized vs actual/realized infinity" problem.
I, like Zeno in Zeno paradox with Achilles vs turtle, was thinking that something is an actual/realized infinity, while in reality it is potential/unrealized infinity.
Let me explain.
... |
I don't think this is entirely a matter of opinion like the other commentor has said. Personally I've competed in a lot of algorithm-based contests since I was young, I've been a math tutor for 5+ years, and I've taken educational psychology classes in university to help myself "learn how to learn."
I think there ar... |
I don't think this is entirely a matter of opinion like the other commentor has said. Personally I've competed in a lot of algorithm-based contests since I was young, I've been a math tutor for 5+ years, and I've taken educational psychology classes in university to help myself "learn how to learn."
I think there ar... |
null |
Is it possible to write a piece of code that will run forever without using a loop? |
Can code "run forever" if it contains no loops? |
|halting-problem|loops| |
I write this question because my professor in Algorithm Analysis briefly mentioned some property related to the countability/uncountability of the set of strings/problems/algorithms and the consequent inability to have an "algorithm that can solve it all" which I didn't fully understand...
As I understand: A decisio... |
Small doubt concerning cardinality of set of problems and algorithms? |
|algorithms|decision-problem| |
I write this question because my professor in Algorithm Analysis briefly mentioned some property related to the countability/uncountability of the set of strings/problems/algorithms and the consequent inability to have an "algorithm that can solve it all" which I didn't fully understand...
As I understand: A decisio... |
I write this question because my professor in Algorithm Analysis briefly mentioned some property related to the countability/uncountability of the set of strings/problems/algorithms and the consequent inability to have an "algorithm that can solve it all" which I didn't fully understand...
As I understand: A decisio... |
I write this question because my professor in Algorithm Analysis briefly mentioned some property related to the countability/uncountability of the set of strings/problems/algorithms and the consequent inability to have an "algorithm that can solve it all" which I didn't fully understand...
As I understand: A decisio... |
I don't know what is the definition for a reduction to be decidable. I would expect it is one of the following two:
Defn 1: $\to$ is decidable iff there is an algorithm $A$ that always halts and, on input $x$, either outputs some $y$ such that $x \to y$; or, if no such $y$ exists, outputs $\bot$.
Defn 2: $\to$ i... |
Off the top of my head it's a "no, it can't run forever."
I first imagined some Python code in my head without any loops, and I thought, "it must come to an end"
But then I saw the Halting Problem tag, and I realized this would relate to turing machines, and it would give a more definitive proof as well.
All c... |
Off the top of my head it's a "no, it can't run forever."
I first imagined some Python code in my head without any loops, and I thought, "it must come to an end"
But then I saw the Halting Problem tag, and I realized this would relate to turing machines, and it would give a more definitive proof as well.
All c... |
Off the top of my head it's a "no, it can't run forever."
I first imagined some Python code in my head without any loops, and I thought, "it must come to an end"
But then I saw the Halting Problem tag, and I realized this would relate to turing machines, and it would give a more definitive proof as well.
All c... |
Correct. There are only countably many algorithms (only countably many Turing machines). Yes, this proves that there exists at least one decision problem that cannot be decided by any algorithm (in fact, that there are infinitely many of them).
Some decision problems have an algorithm that "solve" them; some do no... |
I don't think this is entirely a matter of opinion like the other commentor has said (though they are right, that it can be a bit opinionated or subjective, everyone finds different things easier/harder after all!).
Personally I've competed in a lot of algorithm-based contests since I was young, I've been a math tut... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.