After discussing with some friends on StartupSeeds, I came up with a generalized random sub array algorithm.
This algorithm can be implemented with different data-structures, and it’s complexity is \(O(n)\) or \(O(k\log\space k)\) for 2 specific implementations.
We need a data-structure that can contain integers.
It must have 2 methods which are add [...]
Today I came across an algorithmic problem.
I wanted to choose a random sub array of size \(k\) from an array of size \(n\), while maintaining its order.
For example, if we have the array \(\{0,1,2,3,4,5,6,7,8,9\}\) a possible result for \(k=4\) is the array \(\{1,4,7,9\}\).
I came up with an algorithm with average [...]
In this article I would like to analyze the performance of one of the best sorting algorithms I know: Quicksort.
When I first saw the algorithm I was also told that on average it has \(O(n\log n)\) time complexity, however I never saw a proof until today.
Today I read
PHP 5.3 extended the Standard PHP Library, it came with some new-fancy data structures such as SplStack, SplMaxHeap and many more.
In this article I would like to focus one of them – SplFixedArray.
In PHP, arrays are one of the most fundamental data structures.
We use them everywhere.
Categories
