Home Manual Reference Source

Function

Static Public Summary
public

rotateLeft(a: {[x: number]}, i: number, j: number, k: number)

Rotate array values k places to the left in-place in time O(j-i).

public

rotateRight(a: {[x: number]}, i: number, j: number, k: number)

Rotate array values k places to the right in-place in time O(j-i).

Static Public

public rotateLeft(a: {[x: number]}, i: number, j: number, k: number) source

import rotateLeft from '@array-like/rotate/src/rotateLeft.js'

Rotate array values k places to the left in-place in time O(j-i).

See http://prakhar.me/articles/the-string-rotation-problem/.

Params:

NameTypeAttributeDescription
a {[x: number]}
i number
j number
k number

public rotateRight(a: {[x: number]}, i: number, j: number, k: number) source

import rotateRight from '@array-like/rotate/src/rotateRight.js'

Rotate array values k places to the right in-place in time O(j-i).

See http://prakhar.me/articles/the-string-rotation-problem/.

Params:

NameTypeAttributeDescription
a {[x: number]}
i number
j number
k number