Monthly Archives: March 2013

Given an array A[] and a number x, check for pair in A[] with sum as K

Let’s say the array is of size N. The naive way to solve the problem, for each element checking whether k-element is present in the array, which is O(N^2). This is of course far from optimal and you might not … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Casting Operators of C++ (Static Cast).

This is the first casting operator provided in c++. Syntax for using this operator is var=static_cast<type_id>expression static_cast can perform conversions between pointers to related classes, not only from the derived class to its base, but also from a base class to its derived. … Continue reading

Posted in cpp facts | Tagged | Leave a comment