Tag: data structures
The Dictionary is an important data-structure and is a very handy tool to store a collection of key-value pairs. The Dictionary object can be created easily using Scripting language …
Quick Sort is a comparison sorting method, on average, the complexity is . In worst cases, e.g. when the array of elements are already sorted, it is degraded into …
The Iterator is an interface for external iterators or objects that can be iterated themselves internally. In PHP, it is defined as follows. Iterator extends Traversable { /* Methods …
A prime number is a positive natural number that is greater than 1 and no other divisors other than 1 and itself. For example, 2, 3, 5 are primes …
May 20, 2012
algorithms, beginner, code, codeforces, data structure, implementation, programming languages, python, string, technical
The problem is from codeforces: http://www.codeforces.com/problemset/problem/158/C Using a stack will help solve this problem. Luckly, python supports stack structure by using list. The append() and pop() are used to …