The Bubble Sort Algorithm

Written by Raza. Posted in C++

bubble sort

Two weeks ago, I explained to you a basic and easy sorting algorithm which was Selection Sort. Moving onwards, there is yet another basic algorithm by the name of Bubble Sort. It is known as Bubble sort because it brings the small values on the top of the list just like the light bubbles in water tend to come to the surface. Let us see how it works in depth.

Inside Swapping

Written by Raza. Posted in C++

swapping variables

So I have decided to put aside Sorting for some time and intended to discuss a few tidbits with you. This time I would share some interesting material on the swapping of two different variables. Swapping is one of the most frequently occurring processes taking place inside a Computer Machine. Then in many other Programs and Algorithms, swapping takes place as a sub-process. Sometimes it is user defined and sometimes not. So let us see how can we improve the swapping process.

Writing a Good Constructor

Written by Raza. Posted in C++

Constructor on work

Working with pointers in C requires a lot of practice to avoid memory leaks and dangling pointers. We discussed them in length in the previous post, Pointer Hazards in C . In object oriented paradigm, whenever you declare an object of user defined class type, a special function known as constructor is automatically invoked. Similarly when you want to copy an object to another object, copy constructor gets invoked. Writing an efficient and error free constructor is essential to the construction of a good program. In this post I shall explain how to write a good and efficient constructor and a copy constructor, paying special attention to pointer hazards.

Having Fun with CStrings

Written by Raza. Posted in C++

cstrings transferring data

After some really heavy programming concepts, let us explore some lighter side of programming for a while and then we’ll return back to where we started. This time we would have a go at  Cstrings. Cstrings are character arrays having a null terminator ‘\0’ at its end. Right. So lets see what we are trying to do.


Using Setters in C++

Written by Hamza. Posted in C++

setter in c++

After talking about constructors and destructors, next up in my series on object oriented programming is how to use setters. Setters are functions that are used to change the values of data members inside classes. They are very important, as they are the only route through which we can change the value of our data members after an object is instantiated.