Aman Kumar has Published 91 Articles

C++ Program to find kth Smallest Element by the Method of Partitioning the Array

Aman Kumar

Aman Kumar

Updated on 20-May-2025 18:48:23

354 Views

In this articles we will find the kth Smallest Element by Partitioning the Array in C++, let's see input/output scenario: Input / Output Scenario Following is the input-output scenario: Input: arr[] = {7, 2, 1, 6, 8, 5, 3, 4} Output: 3 In the above scenario, after sorting the ... Read More

C++ Program to find the maximum subarray sum O(n^2) time (naive method)

Aman Kumar

Aman Kumar

Updated on 20-May-2025 18:47:14

388 Views

A subarray is a contiguous slice of an array, and maintains the order of elements naturally. (i.e., the elements of the subarray occupy consecutive positions). For example, the subarrays of an array {1, 2, 3} are {1}, {1, 2}, {1, 2, 3}, {2}, {2, 3}, and {3}. Input / Output ... Read More

C++ Program to Implement B+ Tree

Aman Kumar

Aman Kumar

Updated on 16-May-2025 17:14:30

3K+ Views

A B+ tree is an m-tree that consists of a root, internal nodes, and leaves. The root may be a leaf or a node with two or more children. A B+ tree is an advanced data structure that extends the B-tree by adding a linked list of leaf nodes. A ... Read More

Why is a C++ pure virtual function initialized by 0?

Aman Kumar

Aman Kumar

Updated on 16-May-2025 17:10:40

3K+ Views

In C++, the pure virtual function is initialized with = 0 to indicate that it must be overridden by the derived class and has no implementation in the base class. A pure virtual function is a virtual function in C++ declared in a base class that has no implementation within ... Read More

Default virtual behavior in C++ vs Java

Aman Kumar

Aman Kumar

Updated on 16-May-2025 17:05:01

253 Views

The default behaviour of virtual functions in C++ and Java is significantly different, especially in terms of the handling of method overriding and polymorphism. Default Virtual Behavior in C++ C++ methods are non-virtual by default. To enable dynamic polymorphism, the virtual keyword must be explicitly used in the base class ... Read More

Template Metaprogramming in C++

Aman Kumar

Aman Kumar

Updated on 16-May-2025 17:02:33

365 Views

C++ Template metaprogramming (TMP)Template metaprogramming (TMP) is a metaprogramming technique in which a template is used by the compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled. The best use of template metaprogramming is in C++. The ... Read More

C++ Program to implement Slicker Algorithm that avoids Triangulation to find Area of a Polygon

Aman Kumar

Aman Kumar

Updated on 16-May-2025 16:58:55

189 Views

In this article, we implement a C++ program to find the area of a polygon using a slicker algorithm that avoids Triangulation to find the area of a polygon. What is Slicker Algorithm The Silcker algorithm is a method for calculating the area of a polygon by performing a series ... Read More

Print a character n times without using loop, recursion or goto in C++

Aman Kumar

Aman Kumar

Updated on 16-May-2025 16:58:12

1K+ Views

In this article, we will see how to print a character n times without using loops and recursion in C++. Input/Output Scenario Let's see following input output scenario − Input : n = 10, c = 'i' Output : iiiiiiiiii Input : n = 5, character = 'j' Output ... Read More

C++ Program to Check if a Point d Lies Inside or Outside a Circle Defined by Points a, b, c in a Plane

Aman Kumar

Aman Kumar

Updated on 16-May-2025 16:57:30

320 Views

In this articles, we implements a C++ Program to check if a point d lies inside or outside a circle defined by points a, b, c in a plane using the following equation: s = (x-xt)^2 + (y-yt)^2 – r*r Where equation contains the following points: ... Read More

C++ Program to implement Gift Wrapping Algorithm in Two Dimensions

Aman Kumar

Aman Kumar

Updated on 16-May-2025 16:56:07

566 Views

Gift Wrapping AlgorithmThe Gift Wrapping algorithm is also known as Jarvis's march. It is a method for calculating the convex hull of a set of points in a plane. It is essential to find the smallest convex polygon that encloses all the points. Why We Use Gift Wrapping Algorithm? Below ... Read More

Advertisements