Stop Service with Dependent Services Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 10:20:18

636 Views

To stop multiple services can be stopped using Name or displayname by providing command (,) between them.With name and DisplayName,Stop-Service -Name Spooler, W32Time -Verbose Stop-Service -DisplayName "Print Spooler","Windows Time" -Verbose

Print All Nodes in a Binary Tree Having K Leaves in C++

sudhir sharma
Updated on 22-Jan-2020 10:17:13

196 Views

In this problem, we are given a binary tree and an integer K and we have to print all nodes of the binary tree that have K leaves in their child subtree.The binary tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of a binary tree is the node at end of the tree.Let’s take an example to understand the problem −K = 2Output − {S}To solve this problem, we will do traversal (postorder) for the tree. Now, we will see each left subtree and right subtree if the sum of leaves is ... Read More

Stop Multiple Services Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 10:15:43

3K+ Views

To stop multiple services can be stopped using Name or displayname by providing command (,) between them.With name and DisplayName,Stop-Service -Name Spooler, W32Time -Verbose Stop-Service -DisplayName "Print Spooler","Windows Time" –Verbose

Stop Service with Display Name in PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 10:14:43

682 Views

Similar to -Name parameter, when you add -DisplayName parameter followed by service display name, it will stop service with DisplayName.Stop-Service -DisplayName 'Print Spooler' -VerboseORGet-Service -DisplayName "Print Spooler" | Stop-Service -Verbose

Print All Nodes Less Than a Value X in a Min Heap in C++

sudhir sharma
Updated on 22-Jan-2020 10:13:49

272 Views

In this problem, we are given a Min Heap and a value x and we have to print all nodes less than x.Min heap is a special type of binary tree in which every node has a value less than the node value of its child node.Let’s take an example to understand the problem −X = 45Output − 2 4 7 10 17 22 33 34Now, to solve this problem we need to do pre-order traversal of the whole min-heap and print only those values which are less than the given value X. If a value of a node is ... Read More

Print All Nodes at Distance K from a Leaf Node in C++

sudhir sharma
Updated on 22-Jan-2020 10:06:10

223 Views

In this problem, we are given a binary tree and a number K. We have to print all nodes of the tree that are at k distance from the leaf node.Binary Tree is a special tree whose each node has at max two nodes (one/two/none).The leaf node of a binary tree is the node at end of the tree.In this problem, distance from the leaf node is the node at a higher level than the leaf node. Suppose, the node at distance 2 from the leaf node at level 4 will be at level 2.Let’s take an example to understand ... Read More

Print All Numbers Less Than N with At Most 2 Unique Digits in C++

sudhir sharma
Updated on 22-Jan-2020 10:00:06

182 Views

In this problem, we are given an integer N and we have printed all the number less than N with at-most 2 unique digits i.e. maximum 2 different digits can be used to create the number.Let’s take an example to understand the problem −Input: N = 17 Output: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16To solve this problem, we will be generating all numbers that have only two unique digits. Our number generating process starts from 0 and ends when our number is equal to or greater than N. For two ... Read More

Print All Numbers Whose Prime Factors are a Subset of X in C++

sudhir sharma
Updated on 22-Jan-2020 09:55:23

226 Views

In this problem, we are given a set of N numbers and a number X. And we have to print all numbers from the array whose set of prime factors is a subset of the set of prime factors of X.Let’s take an example to understand the problemInput: X= 30 , array = {2, 3, 6, 10, 12} Output : 2 3 6To solve this problem, we have to traverse elements of the array. And divide this element with gcd of (element, x). Repeat division till the gcd becomes 1. And print the remaining number.Example Live Demo#include using namespace std; ... Read More

Print All Odd Numbers and Their Sum from 1 to N in PL/SQL

sudhir sharma
Updated on 22-Jan-2020 09:46:19

3K+ Views

In this problem, we are given a number n and we have to print all odd numbers from 1 to n and also print the sum of numbers from 1 to n in PL/SQL.PL/SQL is a procedural language extension to SQL. The code is a sequence of instructions that are ground in a block with all related declarations and instructions.Let’s see an example of our problem −Input: 7 Output: odd numbers are: 1, 3, 5, 7 Sum of odd numbers is 16To solve this problem, we will take a number and initialize it to 1 and a sum variable with ... Read More

Print All Pairs in an Unsorted Array with Equal Sum in C++

sudhir sharma
Updated on 22-Jan-2020 09:42:05

325 Views

In this problem, we have an unsorted array and we have to print all pairs within this array that have an equal sum.Let’s take an example to understand the problem −Input: array = [12, 13, 20, 5] Output: [12, 13] and [20, 5] have sum 25.To solve this problem, we will have to find pairs of the same sum. For this, we will check pairs for the same sum. And to avoid duplicate pairs, we will use the map.For this, we will need two maps, one to store all sum pairs and their sum and others to store all sum ... Read More

Advertisements