Sunidhi Bansal has Published 1085 Articles

Product of non-repeating (distinct) elements in an Array in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 13:24:19

214 Views

We are given with an array of repeating or duplicate elements and the task is to find the product of all those elements which are non-repeating or distinct in the given array and display the results.ExampleInput-: arr[] = {2, 1, 1, 2, 3, 4, 5, 5 } Output-: 120 Explanation-: ... Read More

C++ Program for Bisection Method

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 13:04:12

17K+ Views

Given with the function f(x) with the numbers a and b where, f(a) * f(b) > 0 and the function f(x) should lie between a and b i.e. f(x) = [a, b]. The task is to find the value of root that lies between interval a and b in function ... Read More

C++ Program for Priority Scheduling

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 12:43:48

12K+ Views

We are given with the n number of processes i.e. P1, P2, P3, ......., Pn with their corresponding burst times and priorities associated with each process . The task is to find the average waiting time ,average turnaround time and the sequence of process execution using priority CPU scheduling algorithm.What ... Read More

C++ Program for Best Fit algorithm in Memory Management

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 12:30:51

5K+ Views

Given two arrays containing block size and process size; the task is to print the results according to Best Fit algorithm in memory management.What is Best Fit Algorithm?Best Fit is a memory management algorithm; it deals with allocating smallest free partition which meets the requirement of the requesting process. In ... Read More

C++ Program for Optimal Page Replacement Algorithm

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 12:20:43

4K+ Views

Given page number and page size; the task is to find number of hits and misses as when we allocate the memory block to a page using Optimal Page Replacement Algorithm.What is Optimal Page Replacement Algorithm?Optimal page replacement algorithm is a page replacement algorithm. A page replacement algorithm is an ... Read More

Java Program for credit card number validation

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:42:07

6K+ Views

Given a long number containing digits of a credit card number; the task is to find whether the credit card number is valid or not with a program.For checking a credit card is valid or not, the following are the validations we have to be sure for declaring the result.A ... Read More

C++ Program for Derivative of a Polynomial

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:32:06

5K+ Views

Given a string containing the polynomial term, the task is to evaluate the derivative of that polynomial.What is a Polynomial?Polynomial comes from two words: - “Poly” which means “many” and “nomial” means “terms”, which comprises many terms. Polynomial expression is an expression containing variables, coefficients and exponents, which only involves ... Read More

C Program for focal length of a lens

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:20:43

410 Views

Given two floating values; image distance and object distance from a lens; the task is to print the focal length of the lens.What is focal length?Focal length of an optical system is the distance between the center of lens or curved mirror and its focus.Let’s understand with the help of ... Read More

Program for Mobius Function in C++

Sunidhi Bansal

Sunidhi Bansal

Updated on 20-Dec-2019 11:17:22

462 Views

Given a number n; the task is to find the Mobius function of the number n.What is Mobius Function?A Mobius function is number theory function which is defined by$$\mu(n)\equiv\begin{cases}0\1\(-1)^{k}\end{cases}$$n=  0 If n has one or more than one repeated factorsn= 1 If n=1n= (-1)k  If n is product of k ... Read More

C Program for Hexagonal Pattern

Sunidhi Bansal

Sunidhi Bansal

Updated on 21-Nov-2019 12:28:19

2K+ Views

We are given with an integer ‘n’ and the task is to generate the hexagonal pattern and display the final output.ExampleInput-: n=5 Output-:Input-: n = 4 Output-:Approach we are using in the given program is as follows −Input the number ‘n’ from userDivide the entire pattern into three parts i.e. ... Read More

Advertisements