Author Archive

Templates in C++

Written by Raza. Posted in C++

Templates in C++

A technique quite frequently employed in Object Oriented Paradigm and otherwise is known as Generic Programming. Generic Programming is a concept using which you a user can write a code which works well for many data types. In other words, it is type independent programming. A function made generic does not need to know what kind of data type it is receiving. Generic programming is made possible through a feature known as templates. Templates allow functions and classes to operate with these generic or types. I shall explain you why we need templates and how do we employ them.

The Basic Searching Algorithm: Linear Search

Written by Raza. Posted in C++

linear search algorithm

We search for different sort of things in our daily life. This search process is so common and typical that we do not realize how actually search is being performed. And that how the required key is brought out from the depth of information of the massive databases. In computer science, there are many methods for searching a key inside a list. Just like various sorting techniques, there are many searching algorithms as well. A basic and primitive searching method is to look at every element of the list and match the required information. This is known as Linear Search. I shall explain to you what linear search in essence is. 

Operator Overloading: Some Rules and Convention

Written by Raza. Posted in C++

mathematical operators

A week ago, we saw how to overload an assignment operator in object oriented paradigm. As a whole, operator overloading is an important and challenging task. Bjarne Stroustrup, the author and designer of C++ took considerable pain to ensure that user defined types become as close to the built in types as possible. Operator overloading is an offshoot of this. It saves time, energy, resources and many potential dangers to the program. There are certain rules and conventions while overloading operators. Some of them are described in this article.

Example and Source Code for Quick Sort

Written by Raza. Posted in C++

pivot value of list in quick sort

In the previous post I elaborated on Quick Sort and its basic principles, recursive technique, how to select the pivot and the comparison of quick sort and bubble sort. Today I shall explain a sample problem step by step and then write a source code for it. As I mentioned, I would be considering the first element of the list as the pivot. Watch for the next paragraphs for step by step procedure and source code.

The Basic Principles of Quick Sort Algorithm

Written by Raza. Posted in C++

quick sort algorithms

We left our series of Sorting Algorithms about two months ago. Till then we discussed many in-place sorting algorithms like insertion sort, bubble sort, selection sort and gnome sort. These all were the basic algorithms which were inefficient for sorting large lists. For large amount of data, very advanced sorting algorithms have been developed by the experts and a lot of research is still going on in this area. According to many, the fastest Sorting Algorithm in Computer Science is the Quick Sort Algorithm. I shall explain this brilliant algorithm to you in this article in detail. Afterwards we would together write a source code for that.