Posts Tagged ‘cprogramming’

Selection Sort, the Basic Sorting Algorithm

Written by Raza. Posted in C++

selection sort algorithm c++


Selection sort is one of the basic sorting Algorithms. It is pretty simple to understand and very good to implement on small amount of data. However, it becomes quite inefficient when working with large lists.  

Selection Sort uses the concept of in-place sorting. It means that the data is sorted by shuffling it within the list. First I shall try to explain the algorithm and then together we would try to carve out of it a basic source code.

Best Online Resources to Practice C++

Written by Raza. Posted in C++

Students and newbies in C++ keep on looking forward to programming problems and quizzes which enable them to become a good programmer. There are some very good online forums where a wide range of problems with  different levels of difficulty could be found and practiced, I would share some of them here.

Function Template Specialization in C++

Written by Raza. Posted in C++

Computer with overloaded files

Templates are a very powerful tool in programming. They constitute the so called feature of Type Independent or Generic Programming. We have seen that using templates with multiple parameters or a single parameter, we can save our time and energy and write a code in a generic manner instead of writing it for each and every data type. However, as a thing becomes powerful, there are also certain potential dangers associated with it. One such scenario arises with templates quite frequently while its solution lies in template specialization. This type of specialization s known as Complete Specialization.

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.