Sudhir sharma has Published 1149 Articles

Predict the winner of the game on the basis of the absolute difference of sum by selecting numbers in C++

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:20:06

176 Views

In this problem, we are given an array of n numbers. And there are two players X and Y. Our task is to predict the winner of the game.For player X to win the absolute difference of the sum of numbers by X and Y should be a multiple of ... Read More

Preemptive and Non-Preemptive Scheduling

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:17:06

13K+ Views

Preemptive Scheduling is a CPU scheduling technique that works by dividing time slots of CPU to a given process. The time slot given might be able to complete the whole process or might not be able to it. When the burst time of the process is greater than CPU cycle, ... Read More

Prefix Sum of Matrix (Or 2D Array) in C++

sudhir sharma

sudhir sharma

Updated on 04-Feb-2020 07:13:34

4K+ Views

In this problem, we are given a 2D array of integer values mat[][]. Our task is to print the prefix sum matrix of mat.Prefix sum matrix: every element of the matrix is the sum elements above and left of it. i.eprefixSum[i][j] = mat[i][j] + mat[i-1][j]...mat[0][j] + mat[i][j-1] +... mat[i][0].Let’s take ... Read More

Prefix to Infix Conversion in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 12:13:21

2K+ Views

In this problem, we are given a prefix expression. Our task is to print the infix conversion of the given expression.Prefix expression is those expressions which have operators before the operands.Example: +AB.Infix expressions are those expressions which have operators between the operands.Example: A+BInfix expression are information for human understanding, but ... Read More

Prefix to Postfix Conversion in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 12:11:32

4K+ Views

In this problem, we are given a prefix expression. Our task is to print the postfix conversion of the given expression.Prefix expression is those expressions which have operators before the operands.Example: +AB.Postfix expressions are those expressions which have operators after operands in the expressions.Example: AB/The conversion of prefix to postfix should ... Read More

Prefixes with more a than b in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 12:08:14

145 Views

In this problem, we are given string str containing only a and b and an integer N such that a string is created by appending str n times. Our task is to print the total number of substring in which the count of a’s is more than the count of ... Read More

Preorder from Inorder and Postorder traversals in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 12:04:00

2K+ Views

In this problem, we are given the inorder and postorder traversal of a binary tree. Our task is to print the postorder traversal of the tree.Let’s take an example to understand the problemInput:inorder: 16 7 21 12 1 5 9 postorder: 16 21 7 1 9 5 12 Output: preorder: ... Read More

Preorder predecessor of a Node in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 12:00:04

436 Views

In this problem, we are given a binary tree and a node value. Our task is to print the preorder predecessor of the node.Binary Tree is a special type of tree in which each root node can have maximum 2 child nodes.Preorder Traversal is a way to traverse nodes of the ... Read More

Preorder Successor of a Node in Binary Tree in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 11:56:18

655 Views

In this problem, we are given a binary tree and a node value. Our task is to print the preorder successor of the node.Binary Tree is a special type of tree in which each root node can have maximum 2 child nodes.Preorder Traversal is a way to traverse nodes of ... Read More

Preorder Traversal of N-ary Tree Without Recursion in C++

sudhir sharma

sudhir sharma

Updated on 03-Feb-2020 11:52:50

249 Views

In this problem, we are given an N-ary Tree. Our task is to print the preorder traversal of the tree.First, let’s learn some basic terminologies, N-ary Tree is a tree in which all nodes can have at max N child nodes. Example 2-ary (binary) tree has max 2 child nodes.Preorder ... Read More

Advertisements