Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 62 of 81

C++ Program for Coefficient of variation

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 741 Views

We are given with an array of float values of size n and the task is to find the coefficient of variation and display the result.What is the coefficient of variation?In statistic measure, coefficient of variation is used to find the range of variability through the data given. In terms of finance, coefficient of variation is used to find the amount of risk involved with respect to the amount invested. If the ratio between standard deviation and mean is low then the risk involved in the investment is also low. Coefficient of variation is the ratio between standard deviation and ...

Read More

C++ Program for Shortest Job First (SJF) scheduling(non-preemptive)

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 7K+ Views

Given process, the burst time of a process respectively and a quantum limit; the task is to find and print the waiting time, turnaround time and their respective average time using Shortest Job First Scheduling non-preemptive method.What is the shortest job first scheduling?Shortest job first scheduling is the job or process scheduling algorithm that follows the nonpreemptive scheduling discipline. In this, scheduler selects the process from the waiting queue with the least completion time and allocate the CPU to that job or process. Shortest Job First is more desirable than FIFO algorithm because SJF is more optimal as it reduces ...

Read More

Priority Queue using doubly linked list in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 828 Views

We are given with the data and the priority as an integer value and the task is to create a doubly linked list as per the priority given and display the result.Queue is a FIFO data structure in which the element which is inserted first is the first one to get removed. A Priority Queue is a type of queue in which elements can be inserted or deleted depending upon the priority. It can be implemented using queue, stack or linked list data structure. Priority queue is implemented by following these rules −Data or element with the highest priority will ...

Read More

Probability of getting a sum on throwing 2 Dices N times in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 402 Views

We are given with the sum and the number of times the pair of dice is thrown as an input and the task is to determine the probability of getting the given sum on throwing a pair of dice N times.Probability is the chances of getting the desired output from the set of data available. The range of probability lie between 0 and 1 where an integer 0 shows the chances of impossibility and 1 indicates certainty.ExampleInput-: sum = 12, N = 1 Output-: Probability = 1/36 Explanation-: if a pair of dice is thrown once then the combinations will ...

Read More

Product of lengths of all cycles in an undirected graph in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 278 Views

We are given with the undirected as well as unweighted graph as an input and the task is to find the product of the cycles that are formed in the given and display the result.ExampleInputIn the given figure, there are 8 nodes and out of that 5 nodes are forming cycle including 1, 6, 3, 5, 8 and rest of the node are not included in the cycle. So, the length of the cycle is 5 as it includes 5 node therefore product is 5In the given figure, there are 12 nodes and out of that 11(5 +6) nodes are ...

Read More

Product of all Subsequences of size K except the minimum and maximum Elements in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 250 Views

Given an array arr[n], containing n number of integers and an integer k for defining the size; the task is to print the product of all the subsequences of size k except the minimum and maximum elements.Let us assume we have a set of 4 elements {1, 2, 3, 4} and k as 2 so its subsets will be − {1, 2}, {2, 3}, {3, 4}, {1, 4}, {1, 3}, {2, 4}So excluding the maximum element 4, and minimum element 1, the remaining elements will be −2, 3, 3, 3, 2, product of which will be −2 * 3 * ...

Read More

Copysign() function in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 171 Views

Given the task is to show the working of copysign() in C++.The copysign() function is a part of the C++ standard template library. It takes two arguments and produces the result by combining the magnitude of the first value and the sign of the second value. or header file should be included to call this function.SyntaxThe syntax is as follows −copysign(x, y)ExampleInput: copysign(4, -5) Output: -4Explanation − The following example demonstrates how we can copy the sign of one value to the magnitude of another value. The sign of the second argument, that is “-“and the magnitude of the ...

Read More

iswlower() function in C++ STL

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 184 Views

In C++ standard template library(STL), iswlower() function is used to check if the given wide character is in lowercase or not, if not then the function will return a zero value. The characters with ASCII value from 97 to 122 i.e. a-z are the lowercase alphabetic letters. Iswlower() function is present in cctype header file in C/C++.Syntax of iswlower () is as followsint iswlower (wint_t c)Parameters − c is a wide character to be checked, casted to a wint_t, or WEOF where wint_t is an integral type.Return Value − islower() function return non-zero value when the string is in lowercase ...

Read More

const_cast in C++ - Type casting operators

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 2K+ Views

Given the task is to show the working of const_cast in c++. const_cast is one of the type casting operators. It is used to change the constant value of any object or we can say it is used to remove the constant nature of any object. const_cast can be used in programs that have any object with some constant value which need to be changed occasionally at some point. Syntax The syntax is as follows − const_cast(expression) Example Input: const int x = 50; const int* y = &x; cout

Read More

Probability of getting at least K heads in N tosses of Coins in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 610 Views

Probability is the chances of getting the desired output from the set of data available. The range of probability lie between 0 and 1 where an integer 0 shows the chances of impossibility and 1 indicates certainty.What is probability?Probability in mathematics gives us the tools that tell the uncertainty of the events and reasons. In other words we can say probability deals with calculating the likelihood of a given event’s occurrence, which can be expressed as a number between 1 and 0. For example: the probability of getting a head’s when an unbiased coin is tossed, or getting a 3 ...

Read More
Showing 611–620 of 809 articles
« Prev 1 60 61 62 63 64 81 Next »
Advertisements