Graph coloring is the procedure of assignment of colors to each vertex of a graph G such that no adjacent vertices get same color. The objective is to minimize the number of colors while coloring a graph. The smallest number of colors required to color a graph G is called its chromatic number of that graph. Graph coloring problem is a NP Complete problem.Method to Color a GraphThe steps required to color a graph G with n number of vertices are as follows −Step 1 − Arrange the vertices of the graph in some order.Step 2 − Choose the first ... Read More
In electrical engineering, the power factor of an AC system is the expression of energy efficiency. The power factor (PF) is defined as the ratio of active power (measured in Watts) to the apparent power (measured in VA). The power factor expresses the ratio of true power which is used in an AC circuit to the total power delivered to the circuit. Mathematically, the power factor can be expressed using the following formula − $$\mathrm{Power \: factor \, \mathrm{=}\, \frac{Active \: power}{Apparent \: power}}$$ There are two major terms are associated with the power factor of an AC circuit viz. ... Read More
An SCR is a three-terminal, three-junction, and four-layer semiconductor device that is used to perform switching functions in power circuits.Sometimes the SCR is also called as Thyristor.Constructional Details of SCRThe SCR has three pn – junctions, and four layer of p and n type semiconductor joined alternatively to get pnpn device. The three terminals are taken – one from outer p – type layer called anode (A), second from the outer n – type layer called cathode (K) and the third from the internal p –type layer called gate (G).Working of SCRIn a SCR, the load is connected in series ... Read More
Locking and unlocking of the database should be done in such a way that there is no inconsistency, deadlock, and no starvation.2PL locking protocolEvery transaction will lock and unlock the data item in two different phases.Growing Phase − All the locks are issued in this phase. No locks are released, after all changes to data-items are committed and then the second phase (shrinking phase) starts.Shrinking phase − No locks are issued in this phase, all the changes to data-items are noted (stored) and then locks are released.The 2PL locking protocol is represented diagrammatically as follows −In the growing phase transaction ... Read More
Triangle consists of three sides and three angles. Based on the three sides, there are three types of triangle −Equilateral triangle: All three sides are equal.Isosceles triangle: All two sides are equal.Scalene triangle: No sides are equal.Follow the algorithm given below for writing the respective program.AlgorithmStep 1: Declare three sides of triangle. Step 2: Enter three sides at run time. Step 3: If side1 == side2 && side2 == side3 Go to step 6 Step 4: If side1 == side2 || side2 == side3 || side3 == side1 Go to Step 7 Step 5: Else Go to step 8 Step ... Read More
Introduction The tar command in Linux is one of the most essential commands when it comes to file management. It is short for Tape Archive and is used to create and extract archive files. An archive file is a compressed file that contains one or more files bundled together for more accessible storage and portability. In this guide, we'll demonstrate, through examples, how to create, list, edit, and extract tar archive files, and cover some of the more commonly used tar command options. Syntax of the tar command The tar command accepts the following syntax − $ $ tar [options][archive-file] ... Read More
Call by Value means calling a method with a parameter as value. Through this, the argument value is passed to the parameter.While Call by Reference means calling a method with a parameter as a reference. Through this, the argument reference is passed to the parameter.In call by value, the modification done to the parameter passed does not reflect in the caller's scope while in the call by reference, the modification done to the parameter passed are persistent and changes are reflected in the caller's scope.Following is the example of the call by value −The following program shows an example of ... Read More
As processes are loaded and removed from memory, the free memory space is broken into little pieces. It may so happen after sometime that processes cannot be allocated to memory blocks considering their small size and memory blocks remain unused. This problem is known as Fragmentation. There are two types of fragmentation namely, Internal Fragmentation and External Fragmentation. Read this article to learn more about these two types of fragmentation and how they are different from each other. What is Internal Fragmentation? Internal fragmentation is defined as the difference between memory allocated and the memory space required by a process. ... Read More
A process is a program in execution and it is more than a program code called as text section and this concept works under all the operating system because all the task perform by the operating system needs a process to perform the taskThe process executes when it changes the state. The state of a process is defined by the current activity of the process.Each process may be in any one of the following states −New − The process is being created.Running − In this state the instructions are being executed.Waiting − The process is in waiting state until an ... Read More
ProblemWrite a C program to display all the prime numbers between 1 and n is a value given by the user at run time.SolutionC program to display all the prime numbers between 1 and n is a value given by the user at run time is explained below −AlgorithmGiven below is an algorithm to display all the prime numbers between 1 and n is a value given by the user at run time.Step 1 − Read n value.Step 2 − Initialize count = 0Step 3 − for i = 2 to n a. for j = 1 to i b. ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP