Sunidhi Bansal

Sunidhi Bansal

809 Articles Published

Articles by Sunidhi Bansal

Page 49 of 81

C++ Program for Priority Scheduling

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 13K+ 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 is Waiting Time and Turnaround Time?Turnaround Time is the time interval between the submission of a process and its completion.Turnaround Time = completion of a process – submission of a processWaiting Time is the difference between turnaround time and burst timeWaiting Time = turnaround time – burst timeWhat is Priority ...

Read More

C++ Program for Bisection Method

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 18K+ 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 f(x) using bisection method.What is bisection method?Bisection method is used to find the value of a root in the function f(x) within the given limits defined by ‘a’ and ‘b’. The root of the function can be defined as the value a such that f(a) = 0.ExampleQuadratic equation F(x) = ...

Read More

C++ Program for sorting variables of any data type

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

We are given with the values of different datatypes like it can be of type integer, float, string, bool, etc. and the task is to sort the variables of any data type using one common method or function and display the result.In C++, we can use std::sort to sort any type of array which is available in C++ standard template library(STL). By default sort function sorts the array element in ascending order. Sort() function takes three arguments −Start element in the array list i.e. from where you want to start your sortEnd element in the array list i.e. till where ...

Read More

C++ Program for dot product and cross product of two vectors

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

We are given two vectors let’s say vector A and vector B containing x, y, and directions, and the task is to find the cross product and dot product of the two given vector arrays.What is a vector?In mathematics, a quantity that has a magnitude and a direction is known as a vector whereas a quantity that has only one value as magnitude is known as a scalar. The point from where the vector starts is known as the initial point and the point where the vector ends is known as the terminal point. The distance between the initial point ...

Read More

C++ Program for Expressionless Face Pattern printing

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

Given a number n; the task is to create the Expressionless face pattern upto n lines and display the results. Expressionless face is created using special characters, expressionless face using special character seems like: “*_*”.ExampleInput-: n = 6 Output-:Input-: n = 8 Output-: AlgorithmStart Step 1-> In function print_stars(int i)    Loop For j = 1 and j In function print_pattern(int rows)    Loop For i = 1 and i In function int main()    Declare and set rows = 8    Call print_pattern(rows) StopExample#include using namespace std; //function to print stars void print_stars(int i) {    for (int j = 1; j

Read More

C++ Program for Coefficient of variation

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 729 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 816 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

Priority Queue using Linked List in C

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

We are given with the data and the priority as an integer value and the task is to create a 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 get ...

Read More

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

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 394 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
Showing 481–490 of 809 articles
« Prev 1 47 48 49 50 51 81 Next »
Advertisements