Bubble Sort

Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. It examines all pairs of adjacent elements, swapping them when they are out of order. Algorithm : for i in 0 .. n-2 for j in i .. n-1 if (a[j] > a[j+1]) swap(a[j], a[j+1]) We need… Read More »

Insertion Sort

Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. For the 2nd, 3rd, 4th, etc. element: slide backwards into proper relative sorted position. This sort works on the principle of inserting an element at a particular position, hence the name Insertion Sort. Algorithm : for i in… Read More »

Selection Sort

In Selection Sort algorithm, First, find the smallest element and swap it with the first. Sort the rest of the list the same way. Algorithm : for i in 0 .. n-2 small := i for j in i+1 .. n-1 if (a[j] < a[small]) small := j swap(a[i], a[small]) Example : 30 64 26 46 109 21… Read More »

Comparisons between C++ and C#

1. C++ Programming Language : C++, as we all know is an extension to C language and was developed by Bjarne stroustrup at bell labs. C++ is an Object Oriented Programming language but is not purely Object Oriented. The language was updated 3 major times in 2011, 2014, and 2017 to C++11, C++14, and C++17. C++ can be… Read More »

Advantages of Linked List over Dynamic Arrays

Dynamix array is also known as Vector, Dynamic array is an array that resizes itself up or down depending on the number of content. Linked lists have both advantages and disadvantages. The advantage of linked lists is that they can be expanded in constant time. While creating dynamic arrays, we must allocate memory for a certain number of… Read More »

Vector of class objects in C++

Vector usually deals with primitive data types like int, string, double. However, there would be complexities and overhead arising when dealing with vector of class objects. For example, what will be output of below C++ program. How many constructors will be called here? How many constructors will be called? How many destructors will be called? The output of… Read More »

Career in C/C++

In this article, we will discuss the various opportunities available to a person who is well-equipped with the necessary skills in C / C ++ language. C and C ++ programming languages ​​are old, but still popular among computer science people. Even a person with a non-technical background has heard of these languages. C is popular due to… Read More »

Introduction to C programming language

C is developed by Dennis Ritchie in the year 1972. It is a procedural programming language and mainly developed as a system programming language to write an operating system. C was invented to write UNIX operating system. Linux OS, PHP, and MySQL are written in C. C has been written in assembly language. C is extremely popular, simple… Read More »

‘static’ keyword in C++

Almost each & every object oriented programming language is equipped with a special feature known as ‘static’ keyword. ‘static’ is such a keyword which can be used or written in front of any member variable or member function of a class. Now, what happens to that member variable or function if it is preceded by that ‘static’ keyword?… Read More »