Arnab Chakraborty has Published 3734 Articles

Binary Search Tree insert with Parent Pointer in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:53:29

896 Views

We can insert new node into the BST in recursive manner. In that case we return the address of the root of each subtree. Here we will see another approach, where parent pointer will need to be maintained. Parent pointer will be helpful to find ancestor of a node etc.The ... Read More

Array Index with same count of even or odd numbers on both sides in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:43:06

187 Views

Here we will see one problem, suppose one array is given. There are n elements. We have to find one index, where frequency of even numbers of its left and the frequency of even numbers of its right side are same, or the frequency of odd numbers of its left ... Read More

Area of the Largest square that can be inscribed in an ellipse in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:32:24

160 Views

Here we will see the area of largest square that can be inscribed in an ellipse. The square in ellipse will be like below −The area of ellipse is −Now, if x and y are same, thenSo area is −Example#include #include using namespace std; float area(float a, float ... Read More

Area of the circumcircle of any triangles with sides given in C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:28:26

177 Views

Here we will see how to get the area of the circumcircle of any triangle whose sides are given. Here the side AB is a, BC is b and CA is c, the radius is ‘r’.The radius r is same as −Example#include #include using namespace std; float area(float ... Read More

Addition and Subtraction of Matrix using pthreads in C/C++

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:19:09

983 Views

Here we will see how to perform the matrix addition and subtraction using multithreaded environment. The pthread is used to execute multiple threads simultaneously in C or C++.There are two matrices A and B. Order of each matrix is (m x n). Each thread will take each row, and perform ... Read More

C/C++ Program to Find sum of Series with n-th term as n power of 2 - (n-1) power of 2

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:15:14

199 Views

Here we will see how to get the sum of the series with n-th term as n2 – (n-1)2. The recurrence relation is like below −Tn = n2 − (n−1)2So the series is −We need to find S mod (109 + 7), where S is the sum of all terms ... Read More

Hidden tricks of C++ related to STL

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:07:31

290 Views

Here we will see some hidden tricks of C++ related to STL.Assign value of pairs using braces ‘{}’. We can use them to assign into tuples also.pair my_pair = make_pair(10, 20); pair my_pair2 = { 10, 20 }; //using braces pair my_pair3 = { 10, { 'A', 20 } }; ... Read More

Types of Polymorphisms - Ad-hoc, Inclusion, Parametric & Coercion

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 07:01:05

4K+ Views

Here we will see different types of polymorphism. The types are −Ad-HocInclusionParametricCoercionThe Ad-Hoc polymorphism is called as overloading. This allows function with same name to act in different manner for different types. The function and the operator both can be overloaded. Some language does not support operator overloading, but function ... Read More

A Puzzle using C Program

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 06:57:35

748 Views

Here we will see one C puzzle question. Suppose we have two numbers 48 and 96. We have to add the first number after the second one. So final result will be like 9648. But we cannot use any logical, arithmetic, string related operations, also cannot use any pre-defined functions. ... Read More

3-Way QuickSort (Dutch National Flag)

Arnab Chakraborty

Arnab Chakraborty

Updated on 20-Aug-2019 06:56:42

2K+ Views

Here we will see the quicksort technique but we will use three-way quicksort. The basic quicksort technique is just finding an element as pivot then partition the array around pivot, after that, recur for sub arrays on left and right of the pivot.The three-way quicksort is similar, but there are ... Read More

Advertisements