• edited by
313 views
0 0 votes
Given a list $\text{A}$ of  $\text{N}$ elements and a number $\text{K}$, your task is to output the  $\text{N – K + 1}$ values listing the minimum among  $\text{A} [i]\cdots \text{A}[i+\text{K}-1]$ for every $1\leq i\leq \text{N – K + 1}$.

Provide an algorithm for this task, that runs in time atmost $\mathcal{O}(\text{N} \log \text{K}).$

Please log in or register to answer this question.

Position:
Show:

Related questions

0 0 votes
0 0 answers
410
410 views
admin asked Jul 22, 2022
410 views
Let $\text{A}=\left ( \sqrt{3} +\sqrt{2}\right )^{1000}, \text{B}=\left ( \sqrt{3} -\sqrt{2}\right )^{1000}$. Prove the following statements.$\text{A+B}$ is an integer.Th...
0 0 votes
0 0 answers
284
284 views
admin asked Jul 22, 2022
284 views
Imagine you are playing a computer game that consists of different types of coins. You have the power to cast two magic spells $s_{1}$ and $s_{2}$. Each spell consumes so...
0 0 votes
0 0 answers
373
373 views
admin asked Jul 22, 2022
373 views
A cut edge of a connected graph $\text{G}$ is any edge $e=\left \{ u, v \right \}$ of $\text{G}$ such that the graph $\text{G} -e$ obtained by deleting edge $e$ (and not ...
0 0 votes
0 0 answers
285
285 views
admin asked Jul 22, 2022
285 views
For a language $\text{L}$ over an alphabet $\Sigma$, define$$\text{SW(L)}:= \left \{ y \in \Sigma^{\ast} \mid \exists x \in \Sigma^{\ast}\; \text{s.t.}\; xyx \in \text{L}...