Mathematical Logic Statements and Notations

Mahesh Parahar
Updated on 21-Jan-2020 12:20:37

5K+ Views

PropositionA proposition is a collection of declarative statements that has either a truth value "true” or a truth value "false". A propositional consists of propositional variables and connectives. We denote the propositional variables by capital letters (A, B, etc). The connectives connect the propositional variables.PredicateA predicate is an expression of one or more variables defined on some specific domain. A predicate with variables can be made a proposition by either assigning a value to the variable or by quantifying the variable.The following are some examples of predicates −Let E(x, y) denote "x = y"Let X(a, b, c) denote "a + ... Read More

Query Non-Empty Values of a Row First in Ascending Order

AmitDiwan
Updated on 21-Jan-2020 12:19:53

184 Views

For this, use ORDER BY ISNULL(). Let us first create a table −mysql> create table DemoTable669 (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentScore int ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable669(StudentScore) values(45) ; Query OK, 1 row affected (0.80 sec) mysql> insert into DemoTable669(StudentScore) values(null); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable669(StudentScore) values(89); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable669(StudentScore) values(null); Query OK, 1 row affected (0.15 sec)Display all records from the table using select ... Read More

Vertex Covering

Mahesh Parahar
Updated on 21-Jan-2020 12:18:24

341 Views

A covering graph is a subgraph that contains either all the vertices or all the edges corresponding to some other graph. A subgraph that contains all the vertices is called a line/edge covering. A subgraph that contains all the edges is called a vertex covering.Let 'G' = (V, E) be a graph. A subset K of V is called a vertex covering of 'G', if every edge of 'G' is incident with or covered by a vertex in 'K'.ExampleTake a look at the following graph −The subgraphs that can be derived from the above graph are as follows −K1 = ... Read More

Postorder Tree Traversal in Data Structures

Arnab Chakraborty
Updated on 21-Jan-2020 12:17:37

496 Views

In this section we will see the post-order traversal technique (recursive) for binary search tree.Suppose we have one tree like this −The traversal sequence will be like: 8, 5, 15, 23, 20, 16, 10AlgorithmpostorderTraverse(root): Begin    if root is not empty, then       postorderTraversal(left of root)       postorderTraversal(right of root)       print the value of root    end if EndExample Live Demo#include using namespace std; class node{    public:       int h_left, h_right, bf, value;       node *left, *right; }; class tree{    private:       node *get_node(int key);   ... Read More

Wildcards in Generics in Java

Maruthi Krishna
Updated on 21-Jan-2020 12:16:39

2K+ Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class as generic you are making it type-safe i.e. it can act up on any datatype.To define a generic class you need to specify the type parameter you are using in the angle brackets “” after the class name and you can treat this as datatype of the instance variable an ... Read More

Helpful Insights to Control Project Costs

karthikeya Boyini
Updated on 21-Jan-2020 12:12:19

145 Views

Managing a project is not everybody’s cup of tea. There are many aspects of the projects which we need to plan and manage perfectly to achieve the desired success, whether it is the scope, schedule, cost or quality. It is also seen that many times, the project runs into trouble only because the Project Manager fails to monitor and control the project cost.So it is important to manage the project cost throughout the project with proper planning and controlling the project budget. To manage the project cost effectively, there are certain activities which we need to perform initially.Planning the Cost: ... Read More

Maximum Size Subset with Given Sum in C++

Narendra Kumar
Updated on 21-Jan-2020 11:30:13

803 Views

Problem statementGiven an array of N elements and sum. We need to find size of maximum size subset whose sum is equal to given sumExampleIf input array is arr = { 2, 3, 5, 10 } and sum = 20 then output will be 4 as −2 + 3 + 5 + 10 = 20 which is equal to given sumAlgorithmWe can use dynamic programming to solve this problem.To count the maximal subset, we use another DP array (called as ‘count array’) where count[i][j] is maximal of.count[i][j-1]. Here current element is not considered.scount[i- X][j-1] + 1. Here X is value ... Read More

Maximum Profit from Sale of Wines in C++

Narendra Kumar
Updated on 21-Jan-2020 11:17:53

238 Views

Problem statementGiven n wines in a row, with integers denoting the cost of each wine respectively. Each year you can sale the first or the last wine in the row. The price of wines increases over time. Let the initial profits from the wines be P1, P2, P3…Pn. On the Yth year, the profit from the ith wine will be Y*Pi. For each year, your task is to print start or end denoting whether first or last wine should be sold. Also, calculate the maximum profit from all the wines.ExampleIf wine prices are {2, 4, 6, 2, 5} then output ... Read More

Maximum Prefix Sum for a Given Range in C++

Narendra Kumar
Updated on 21-Jan-2020 11:10:19

760 Views

Problem statementGiven an array of n integers and q queries, each query having a range from l to r. Find the maximum prefix-sum for the range l – r.ExampleIf input array is arr[] = {-1, 2, 3, -5} and queries = 2 and ranges are: l = 0, r = 3 l = 1, r = 3 then output will be 4 and 5.The range (0, 3) in the 1st query has [-1, 2, 3, -5], since it is prefix, we have to start from -1. Hence, the max prefix sum will be -1 + 2 + 3 = 4The ... Read More

Find List of Daemon Processes and Zombie Processes in Linux

karthikeya Boyini
Updated on 21-Jan-2020 11:08:44

6K+ Views

This article will guide you to understand the Zombie process and Daemons, and also help us to find the process which is running in the background.What is Zombie Process?When a process ends the execution, then it will have an exit status to report to its master process. Because of that little bit of information, the process will remain in the OS process table as a zombie process, which indicates that it is not to be scheduled for future, but this process cannot be completely removed or the process ID will not be used until the exit has been determined and ... Read More

Advertisements