Sudhir sharma has Published 951 Articles

Balance a string after removing extra brackets in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:56:41

232 Views

A string is an array of characters. In this problem, we are given a string which has opening and closing brackets. And we will balance this string by removing extra brackets from the string.Let’s take an example, Input : “)Tutor)ials(p(oin)t(...)” Output : “Tutorials(p(oin)t(...))”To solve this problem, we will traverse through ... Read More

Average of max K numbers in a stream in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:52:36

267 Views

The average of number in a stream means calculating the average after every insertion. But in this problem, we need to find the average of max K numbers in a stream i.e. only k numbers of the array are considered for calculating the average. When we add a number if ... Read More

Average of a stream of numbers in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:48:19

891 Views

Average of numbers is the sum of numbers divided by the total number of numbers.In this problem, we are given a stream of numbers. And we will print average of the number at every point.Let’s take an example of how it works −We have a stream of 5 number 24 ... Read More

Associative arrays in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:44:35

3K+ Views

In c++ programming language, an associative array is a special type of array in which the index value can be of any data type i.e. it can be char, float, string, etc. These associative arrays are also known as maps or dictionaries. Also, the indexes are given a different name ... Read More

Array Type Manipulation in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 10:34:14

3K+ Views

The array is a data structure in c++ that stored multiple data elements of the same data type in continuous memory locations.In c++ programming language, there are inbuilt functions to manipulate array types. Some functions can also be applied to multidimensional arrays. The array header file contains functions to manipulate ... Read More

Arithmetic Number in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 08:31:57

438 Views

The arithmetic number is a number which has the average of all positive divisors is an integer i.e. for a number n if the number of divisors can divide the sum of divisors then n is an arithmetic number.Let’s take an example to understand the concept better, Input : n ... Read More

Apothem of a n-sided regular polygon in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 08:17:10

305 Views

n-sided regular polygon is a closed figure of n sides that has all sides and angles of equal length. The below figure shows a 6 sided regular polygon commonly known as hexagon.Apothem is a line in the polygon that connects the center of the figure to the side. And it ... Read More

An interesting time complexity question in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 08:09:38

1K+ Views

Time complexity can be defined as the time required by the algorithm to run its average case.Let's see and calculate the time complexity of some of the basic functions.Methodvoid counter(int n){    for(int i = 0 ; i < n ; i++){       for(int j = 1 ; j

An interesting method to print reverse of a linked list in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 08:05:25

200 Views

A linked list is a data structure that stores data elements in linked form. Each node of the linked list has a data element and a link.Print reverse of a linked list is a common problem that needs to be addressed in problem solving. So, here we will learn an ... Read More

An Insertion Sort time complexity question in C++

sudhir sharma

sudhir sharma

Updated on 24-Oct-2019 08:01:24

1K+ Views

What is the time complexity of insertion sort?Time complexity is the amount of time taken by a set of codes or algorithms to process or run as a function of the amount of input.For insertion sort, the time complexity is of the order O(n) i.e. big O of n in ... Read More

Advertisements