Linear Algorithm

We put some algorithms on linear collection into tango.linear.*. To use linear collection type, please go to tango.type.Stack, tango.type.LinkedList...

A overview of time complexity is listed below:

Call Time Complexity
validPopStackSeries O(N)\text{O}(N)
medianMaintenence O(NlnN)\text{O}(N \ln N)

validPopStackSeries(push: [], pop: []): bool

Returns true iff we can get the pop series from the push series, using a stack.

medianMaintenence(arr): []

For each time tt we visit arr from 00 to n1n-1, we maintenence the median of all [0,t][0, t] elements from input, and push this median into output array.

results matching ""

    No results matching ""