Arnab Chakraborty has Published 4293 Articles

Why C++ is partially Object Oriented Language?

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:15:05

2K+ Views

As we know some basic features of an object oriented programming language are the Inheritance, Encapsulation, Polymorphism. Any language that supports these features completely are known as object oriented programming languages. Some languages like C++ supports these three but not fully, so they are partially object oriented language. Let us ... Read More

Find maximum number that can be formed using digits of a given number in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:14:26

522 Views

Suppose we have a number of n digits. We have to find the maximum number that can be obtained using all digits of digits of that number. So if the number is say 339625, then maximum number can be 965332.From the problem, we can see that we can easily sort ... Read More

When should we write our own assignment operator in C++ programming?

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:12:49

228 Views

Here we will see when we need to create own assignment operator in C++. If a class do not have any pointers, then we do not need to create assignment operator and copy constructor. C++ compiler creates copy constructor and assignment operator for each class. If the operators are not ... Read More

Find maximum number of elements such that their absolute difference is less than or equal to 1 in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:11:28

346 Views

Suppose we have an array of n elements. We have to find the maximum number of elements to select from the array, such that the absolute difference between any two of the chosen elements is less than or equal to 1. So if the array is like [2, 2, 3, ... Read More

Sort in C++ Standard Template Library (STL)

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:09:23

698 Views

Here we will see how to use the sort() function of C++ STL to sort an array So if the array is like A = [52, 14, 85, 63, 99, 54, 21], then the output will be [14 21 52 54 63 85 99]. To sort we will use the ... Read More

Find maximum in a stack in O(1) time and O(1) extra space in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:07:51

600 Views

Suppose we want to make a stack that can store the maximum element in the stack. And we can get it in O(1) time. The constraint is that, it should use O(1) extra space.We can make one user-defined stack, that will store the max value, when one operation is performed, ... Read More

Complex numbers in C++ programming

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:06:32

1K+ Views

In this section we will see how to create and use complex numbers in C++. We can create complex number class in C++, that can hold the real and imaginary part of the complex number as member elements. There will be some member functions that are used to handle this ... Read More

Some useful C++ tricks for beginners in Competitive Programming

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:02:39

396 Views

Here we will see some good tricks of C++ programming language that can help us in different area. Like if we want to participate in some competitive programming events, then these tricks will help us to reduce the time for writing codes. Let us see some of these examples one ... Read More

Find length of the longest consecutive path from a given starting characters in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 10:01:27

168 Views

A matrix of different characters is given. Starting from one character we have to find longest path by traversing all characters which are greater than the current character. The characters are consecutive to each other.Starts from E.To find longest path, we will use the Depth First Search algorithm. During DFS, ... Read More

Comparing two strings in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 18-Dec-2019 09:56:31

444 Views

Here we will see how to compare two strings in C++. The C++ has string class. It also has the compare() function in the standard library to compare strings. This function checks the string characters one by one, if some mismatches are there, it returns the non-zero values. Let us ... Read More

Advertisements