Gnome Sort, a Variant of Insertion Sort

Written by Raza. Posted in C++

The Gnome Sort Algorithm

Last time, we discussed a sorting technique known as insertion sort. It is a very good sorting procedure and the simplest sorting algorithm for short lists and small amount of data. For larger lists, it’s running time increases exponentially which renders it inefficient. A number of variations have also been introduced to insertion sort, some of which are more efficient and some are equally good. Shell sort and Gnome Sort are two such variations. I prefer Gnome Sort so I will explain it to you in this article.

Templates with Multiple Parameters

Written by Raza. Posted in C++

computers network binary code

We have learnt that Templates in C are a very powerful feature. They constitute the concept of Generic Programming or Type Independent Programming. Last time, we saw templates that have one parameter or one generic type. They have the limitation that only one type of data type can be processed at a time. To solve that problem, we use templates with more than one type of parameters. Such multiple type templates allow more than one type of data types to be process at once. 

Top 10 Online Resources to Learn and Improve C++

Written by Raza. Posted in C++

computer programming network

For Novice and Beginners, C seems a very difficult and challenging language to learn. I won’t say that this is incorrect in entirety though constant practice and hard work makes it easier to code in C .

Here I shall briefly describe some of the Online Resources which I have used personally and found extremely useful. These include resources for learning, debugging to problem solving.

Use of constructors in C++

Written by Hamza. Posted in C++

constructors in C++

A constructor in a class is a special function called at instantiation of an object, or declaration of an object. What it does is simple: it does everything that you require to be done automatically every time an object of your class is created. This helps us to avoid system crashes and makes sure that the object we create does not always create variable or data that is unacceptable for our program. This will become clearer to you as you read on. 

Use of Explicit Constructor in Our Class

Written by Raza. Posted in C++

explicit constructor c++

C++ is a very powerful and fast language. One potential danger because of this is the ability of language to call methods and convert data into other types automatically without asking the programmer. So the programmer has an added responsibility of keeping an eye on the compiler and watch out for all such errors. One such common problem is the implicit conversion through a constructor. To avoid that, we use an explicit constructor in C++. Let us see a sample code for that and then I shall explain to you what actually happens.