Given a sequence of $n$ non-negative numbers
$x=(x_1,\dots,x_n)$, where $x_i \ge x_j \ge 0$
for $i \le j$, the $w$-index (Woeginger,
2008) for $x$ is defined as
$$W(x)=\max{i=1,\dots,n: x_{j}\ge i-j+1, \forall
j=1,\dots,i}$$
Usage
index_w(x)
Arguments
x
a non-negative numeric vector
Value
a single numeric value
Details
If non-increasingly sorted vector is given, the function
is O(n).