Wednesday, 7 September 2022

BEE ENGINEERING 1ST YEAR FULL PORTION

BASIC ELECTRICAL ENGINEERING 
(Engineering 1st year portion)
 (2 marks only)

TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL: Code with u - YouTube

 *It is uneven in scale.

* Electric

A single-phase induction motor is self-starting, because the stator flux is changing in nature and

*Wooden formwork and capping wiring

(1 Application of single-phase induction motor:

(4 types of movable iron tools:

*Lead sheathed wiring (or) metal sheathed wiring

(6) Moving coil instrument: *This is similar to the working principle of a DC motor.

(8 Types of materials used for electrical wiring:

* Copper

*Conduit wiring

*This scale is uniform.

(5) Movable iron tool:

It is the system in the coil of an electric motor that is opposed, the current flows through the coil, when the armature R.

* Moon

(3 types of measuring instrument:

*It is used for both AC and DC measurement.

ohmmeter. and galvanometer

* Mechanical

*Accuracy is low.

(7) Single phase induction motor self-starting why not?

(9 types of wiring system:

*Clean wiring

To begin with, the two components of the equation cancel each other out and therefore there is no network.

* Electronic

* It can be used as ammeter, voltmeter and wattmeter.

CTS) *(or)TRS) (or)PVC sheathed wiring

*Fans *Pump *Refrigerator *Hard

DRIVE *TABLETRON *CEILING FAN

*Air Conditioner *Vacuum Cleaner

*Washing machine.

*Traction Type Movable Iron Tool

*This is only used for disk measurement.

*Repulsion type movable iron tool

emf: back2)

* Accuracy is high.

* Aluminum

Otte S

* Arsenic

*It is acting as magnetism.

*It can be used as a voltmeter,

Machine Translated by Google

(10Fuses: *Fuses can be used only once.

*Circuit breaker

* This Act may be called the Indian Electricity Act, 1910, which has been extended to the whole of India.

*The cost of fuse is very low.

*Switch the fussiest cos witch.

(14) What are the advantages of lithium-ion batteries over lead acid batteries?

* Flexibility.

(11 Circuit Breaker: * Circuit breaker can be used multiple times.

* ELCB

A few minutes to charge, depending on battery size. Lithium-ion chemistries can accept such high rates.

Transmission line maintenance clearance with the root of the power conductor to ground above the open country, n

*The cost of circuit breaker is high.

(13) Characteristics of underground cables:

(15 Different types of cables used in electricity: * Volcanic

Indian Rubber Cord (VIR)

(17 Any two Indian Electricity Acts: 1956 IER* has been made the Indian Electricity Act, 1910, which has been repeated by the Electricity Act, 2003

Is.

*Fuse can be used as on/off switch.

(12 Components of voltage switch gear:

* Wide screen controls electric field and external fault current.

Polyvinyl chloride (PVC).

* Switches

*Electric Conductor – Conducts current.

(18) Earth resistance: *Earth resistance profile varies between 10 ohms and 20 ohms.

*Fuse works on electrical and thermal characteristics of conducting material.

*Electrical isolators

Charging a lead-acid battery can take more than 10 hours, while lithium-ion batteries can take anywhere from 3 hours to an hour.

* Weather changes.

(16) Ground clearance Q:

(19 Mention any two provisions in the Indian Electricity Act:

* Except the state of Jammu and Kashmir.

* Circuit breaker is used as on/off switch.

Current, charging batteries made from lead-acid batteries.

HRC* fuse

Regional country, highways, electric field, non-electric field, tracks, telecommunication and power lines.

* Circuit breaker works on principle of electromagnetism and switching.

* Cable sheaths protect the cable, especially from moisture.

*Hard Rubber Cassette String (TRS).

*These rules will be applicable till the Electricity Act 2003.

* Lead acid sheet.

*Layer Insulation - Insulates an electrical conductor.

*This is the resistance of the ground electrode that is measured to perform the resistance test.

Machine Translated by Google

The effective resistance of an electrical circuit (or) component to alternating current, arising from combined effects

(23 Types of Electrical Networks: * Line Y

Network.

(28 Significance of Resonance:

(20 States Kirchhoff's Law: Kirchhoff's law is divided into two types.

: KVL)i the algebraic sum of the potentials is zero.: KCL) indexer current

The algebraic sum of is equal to zero.

*Two-way network.

(25 Power factor: Power factor is the cosine of the phase angle between voltage and current. = (theta (cos true power/apparent power.

Increasing the purely resistive impedance. A

* Resonant circuits are useful for making filters and are used in many applications.

Quality Factor: It is defined as the ratio of reactive power (or) total power to resistance in series with inductor (or) capacitor and coil (o).

Let n be taken as the sum of the currents (or) voltages at which each source operates independently.

*Disabled network.

Any linear network with terminals can be replaced by a single voltage source called a thionine voltage (or) open circuit.

*Distributed network.

(27) Resonance: An AC circuit is said to be in resonance if it behaves as a purely resistive circuit. The total current drawn by the circuit

Cut voltage with resistance in series called thionine resistance.

(24)

is then in phase with the applied voltage and the power factor will be unity.

Resonance in an RLC* circuit is a state in which capacitive and reactance are reactive, there through res.

* Non-linear network.

Ohmic resistance and reactance.

(21 The superposition theorem:

* One way network.

(26) Bandwidth: Bandwidth is defined as the frequency difference between the upper cut of the frequency and the lower cut of the frequency.

*Active network.

Any line or branch in a circuit containing two (or more) sources

(or) the current resulting from the voltage between nodes ca

=f(2)-f (1) bandwidth

(22 Tevin's Theorem:

*Limped Network.

(r capacitor.

Acoustic grating & Stress and Strain

Acoustic greeting:

TO LEARN MORE, FOLLOW THIS YOUTUBE CHANNEL: Code with u - YouTube

 When ultrasonic waves travel from one end into the liquid medium and are reflected

Nodes in this medium from the other end and 

Anti-nodes. The density of the liquid will be at most nodes and at least low. 

Anti-nodes. The node will behave like an opaque region and the anti-nodes will behave 

Like the transparent region. Now the liquid behaves as a diffraction grating and it is 

Which is called sound greeting.

 Sin (Theta) = N*(Lamda) --------(EQ.1)

where D is the distance between any two successive nodes or the antinodes of the resident

wave

 Lambda is the wavelength of the monochromaticity.

If 'F' is the frequency of ultrasonic waves, then the speed of ultrasonic 

Waves are given in liquid

 Ultrasonic speed =frequency*wavelength

 b = f*lambda(u) ----------(eq.4)

Subtract the value of lambda(u) in (eq.4)

 Speed =F*N*Lambda/Sin (Theta)

Replacing the values of F, N, Lambda and Theta, the velocity of ultrasonic waves

Can be determined in liquidlike source of light 

 Theta is the angle of distortion

Let Lambda(U) be the wavelength of ultrasonic waves in a liquid medium, then

 D=Lambda(U)/2

 2D=Limda(U) -------(EQ.2)

Then (EQ.1) becomes, 

Lamda (U)*Sin (Theta) = N*(Lamda)

 Lamda(U) = N*Lamda/Sin (Theta) ---------(EQ.3)

Monday, 5 September 2022

DC CIRCUIES

BASIC ELECTRICAL ENGINEERING


TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL: Code with u - YouTube

1."DC CIRCUITS"

 ELECTRIC POTENTIAL (or) VOLTAGE:

 *Voltage is the difference in electrical potential between two points of an electrical or electronic

Circuits.

 Unit: 'Volts'.

 ELECTRIC CURRUNT: 

 *Electric current is defined as the flow rate of electric change.

 Unit: 'Amps',

 i=dq/dt

 q=>load

 RESISTANCE:

 *The resistance of the circuit is the property by which it opposes the flow of current.

 Unit: ohms.

Behavior:

 * The reciprocity of resistance is called conductance.

 Unit: Sieve, Symbol:- g

 . G=1/R

 Basic circuit components:

 *Resistor 

 *Capacitor 

 *Inductor

 RESISTOR:

 *It is defined as the property of the material by which it opposes the flow of current through it.

 I R

 ---->--/\/\/\/\------

 + -

 V=IR.

 Unit: ohms

 Symbol: R

 *Energy is dissipated in the resistor in the form of heat.

 P=VI=(IR0I=I^2R=V^2/R watts.

 *Resistor coverts amounts of energy into heat during time 't'.

 D=Pdt

 =I^Rt

 =vIt joules.

 Capacitor:

 * Capacitor is a storage element that can store and transport energy in an electric field.

 Symbol: C

 Unit: Firuz.

 c

 ------|| ------

 + -

Inductor:

 * An inductor is the element in which energy is stored in the form of an electromagnetic field.

 Symbol: L

 Unit: Henry Gaither C.

 I l

 ---->---000000-------

 + -

 Network:

 *Any arrangement of different sources of electrical energy with different circuit elements

This is called an electrical network.

 _______/////___.__00000_________

 | | 

 | | 

 ------ --------

 --- ----

 NWT Work Element:

 *Any individual circuit element with two terminals that can be connected to another circuit element is

This is called the network element.

 network

 | |---->Active Element [Voltage, Current]

 |------>|

 |

 |---->Active element [R, L, C]

Branch:

 *A point of network that connects different points of the network to each other is called

Branch.

 Fig.(a) AC, CE, EF

 Junction point:

 *A point where three or more branches meet is called a junction point. (C, F)

 Node:

 * A point at which two or more elements join together is called a node. (A, BC, D, E and F).

Mesh loop:

 * A mesh or loop is a set of braches forming a closed path in a network. (ACDBA, CEFDC)

 Types of electrical networks:

 Linear Network:-

 * A circuit or network whose parameter i.e. elements such as resistors, inductors and capacitors

Always a constant irrelevant of time change, Waltz,

 The temperature is called a linear network.

* OHS law and superposition theorem can be networked.

 Non-linear network:-

 * A circuit whose parameter changes their values with the change in time, is the temperature voltage.

Known as non-linear networks.

 Two-linear network:-

 * The behavior of a circuit vas characteristics depends on the direction of the throw current

Its Vario elements are called 'two linear networks'.

 Ex: Resistors

One-way network:-

 * A circuit operation whose behavior depends on the direction of the current through different

Elements are called 'one-way networks'.

 Former: Half-wave diode rectifier.

 Active network:-

 * A circuit that has an energy source is called an 'active network'.

 Previous: Voltage and current source.

 Inactive network:-

 * A circuit that has no source of energy is called a 'passive network'.

 Distributed Network:-

 * Circuit elements such as resistors, inductors for the purpose of analysis are not usable according to physics

'Distributed network'.

 Previous: Transmission Line

 Electric power:

 * The rate at which the electrical circuit works is electricity.

 Unit: Joules/second (or)watt.

 P=VI; P=I62R(OR) P=V62/R.

Electrical Energy:

 * Electrical energy is the amount of work and therefore the production of power and time.

 W=PT=VIT=I^2RT=(V^2/R)T

 1 Kilowatt=1 Unit=Power-in-Watt X Time-in-Sec/1000X 60X 60X 60X 60

 Resistors in the series:

 R1 R2 R3

 ______/////_______/////________/////______

 | |

 | |

 | | <--------->| <--------------->|<--------------| |

 |         V1                  V2                     V3|

 |________________________| | __________________________| 

 | | | |

 | |

 *There is a voltage drop across each resistor given by Ohm's law.

 V1=IR1

 V2=IR2

 V3=IR3

 v=v1+v2+v3

 =IR1+IR2+IR3

 V=I[R1+R2+R3]

 P1=1^2R1; p2=1^2R2; p3=1^2R3.

 Total power:

 (p)= p1+p2+p3

 = I^2[R1+R2+R3]

 =V1^2/R1 + V2^2/R2 + V3^2/R3

 =V^2/[R1+R2+R3]

 =V^2/Ref

 ref=R1+R2+R3

 _______/////________

 | |

 I | | Vi

 | |

 |__________| |__________| 

 + | | | -

 | |

 V

 * The same current flows through all resistors.

 * For each resistor, there will be a voltage drop

 According to Ohm's law.

 * The combination of voltage drop will be equal to applied voltage. 

Saturday, 3 September 2022

AVL TREE IN C LANGUAGE

IMPLEMENTATION OF AVL TREES INSERTION, DELETION OPERATIONS

Exercise.No:8

TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL: Code with u - YouTube



AIM: 

To write the program to implement AVL Tree and its operation. 

ALGORITHM: 

For Insertion: 



Step 1: First, insert a new element into the tree using BST's (Binary Search Tree) insertion 

 logic. 

Step 2: After inserting the elements you have to check the Balance Factor of each node. 

Step 3: When the Balance Factor of every node will be found like 0 or 1 or -1 then the 

 algorithm will proceed for the next operation. 

Step 4: When the balance factor of any node comes other than the above three values then the 

 tree is said to be imbalanced. Then perform the suitable Rotation to make it balanced 

 and then the algorithm will proceed for the next operation. 

For Deletion: 



Step 1: Firstly, find that node where k is stored 

Step 2: Secondly delete those contents of the node (Suppose the node is x) 

Step 3: Claim: Deleting a node in an AVL tree can be reduced by deleting a leaf. There are 

 three possible cases: 

• When x has no children then, delete x 

• When x has one child, let x' becomes the child of x. 

• Notice: x' cannot have a child, since sub trees of T can differ in height by at 

most one then replaces the contents of x with the contents of x' 

• then delete x' (a leaf) 

• then find x's successor z (which has no left child) 

• then replace x's contents with z's contents, and 

• delete z 

Step 4: When x has two children, 

AVL Tree Rotations: 

In AVL tree, after performing every operation like insertion and deletion we need to check 

the balance factor of every node in the tree. If every node satisfies the balance factor 

condition then we conclude the operation otherwise we must make it balanced. We use 

rotation operations to make the tree balanced whenever the tree is becoming imbalanced due 

to any operation. 

Single Left Rotation (LL Rotation): 

In LL Rotation every node moves one position to left from the current position. 

Single Right Rotation (RR Rotation): 

In RR Rotation every node moves one position to right from the current position. 

Left Right Rotation (LR Rotation): 

The LR Rotation is combination of single left rotation followed by single right rotation. In 

LR Rotation, first every node moves one position to left then one position to right from the 

current position. 

Right Left Rotation (RL Rotation) 

The RL Rotation is combination of single right rotation followed by single left rotation. In 

RL Rotation, first every node moves one position to right then one position to left from the 

current position. 

Time Analysis of AVL Trees: 

AVL tree is binary search tree with additional property that difference between height of left 

sub-tree and right sub-tree of any node can’t be more than 1.

PROGRAM:

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

typedef struct node

{

 int data;

struct node *left,*right;

int ht;

}node;

node *insert(node *, int);

node *Delete(node *, int);

void preorder(node *);

void inorder(node *);

int height( node *);

node *rotateright(node *);

node *rotateleft(node *);

node *RR(node *);

node *LL(node *);

node *LR(node *);

node *RL(node *);

int BF(node *);

void main()

{

node *root=NULL;

int x, n, i, op;

do

{

printf("\n1)Create ");

printf("\n2)Insert ");

printf("\n3)Delete ");

printf("\n4)Print ");

printf("\n5)Quit ");

printf("\n Enter Your Choice: ");

scanf("%d",&op);

switch(op)

{

case 1:printf("\n Enter no.of elements:");

scanf("%d",&n);

printf("\n Enter tree data:");

root=NULL;

for(i=0; i<n; i++)

{

scanf("%d",&x);

root=insert(root,x);

}

break;

case 2:printf("\n Enter a data : ");

scanf("%d",&x);

root=insert(root,x);

break;

case 3:printf("\n Enter a data : ");

scanf("%d",&x);

root=Delete(root,x);

break;

case 4: printf("\n Preorder sequence :\n");

preorder(root);

printf("\n Inorder sequence :\n");

inorder(root);

break;

}

}while(op<5);

}

node * insert(node *T, int x)

{

if(T==NULL)

{

T=(node*)malloc(sizeof(node));

T->data=x;

T->left=NULL;

T->right=NULL;

}

else

if(x > T->data) 

{

T->right=insert(T->right,x);

if(BF(T)==-2)

if(x>T->right->data)

T=RR(T);

else

T=RL(T);

}

else

if(x<T->data)

{

T->left=insert(T->left,x);

if(BF(T)==2)

if(x < T->left->data)

T=LL(T);

else

T=LR(T);

}

T->ht=height(T);

return(T);

}

node * Delete(node *T, int x)

{ node *p;

if(T==NULL)

{

return NULL;

}

else

if(x > T->data) 

{

T->right=Delete(T->right,x);

if(BF(T)==2)

if(BF(T->left)>=0)

T=LL(T);

else

T=LR(T);

}

else

if(x<T->data)

{

T->left=Delete(T->left,x);

if(BF(T)==-2)

if(BF(T->right)<=0)

T=RR(T);

else

T=RL(T);

}

else

{

if(T->right !=NULL)

{ 

p=T->right;

while(p->left != NULL)

p=p->left;

T->data=p->data;

T->right=Delete(T->right, p->data);

if(BF(T)==2)

if(BF(T->left)>=0)

T=LL(T);

else

T=LR(T);

}

else

return(T->left);

}

T->ht=height(T);

return(T);

}

int height(node *T)

{

int lh, rh;

if(T==NULL)

return(0);

if(T->left==NULL)

lh=0;

else

lh=1+T->left->ht;

if(T->right==NULL)

rh=0;

else

rh=1+T->right->ht;

if(lh>rh)

return(lh);

return(rh);

}

node * rotateright(node *x)

{

node *y;

y=x->left;

x->left=y->right;

y->right=x;

x->ht=height(x);

y->ht=height(y);

return(y);

}

node * rotateleft(node *x)

{

node *y;

y=x->right;

x->right=y->left;

y->left=x;

x->ht=height(x);

y->ht=height(y);

return(y);

}

node * RR(node *T)

{

T=rotateleft(T);

return(T);

}

node * LL(node *T)

{

T=rotateright(T);

return(T);

}

node * LR(node *T)

{

T->left=rotateleft(T->left);

T=rotateright(T);

return(T);

}

node * RL(node *T)

{

T->right=rotateright(T->right);

T=rotateleft(T);

return(T);

}

int BF(node *T)

{

int lh, rh;

if(T==NULL)

return(0);

if(T->left==NULL)

lh=0;

else

lh=1+T->left->ht;

if(T->right==NULL)

rh=0;

else

rh=1+T->right->ht;

return(lh-rh);

}

void preorder(node *T)

{

if(T!=NULL)

{

printf(" %d(Bf=%d)", T->data, BF(T));

preorder(T->left);

preorder(T->right);

}

}

void inorder(node *T)

{

if(T!=NULL)

{

inorder(T->left);

printf(" %d(Bf=%d)", T->data, BF(T));

inorder(T->right);

}

}

OUTPUT:

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 1

Enter no.of elements :4

Enter tree data: 2

4

5

6

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 4

Preorder sequence:

4(Bf=-1) 2(Bf=0) 5(Bf=-1) 6(Bf=0)

Inorder sequence:

2(Bf=0) 4(Bf=-1) 5(Bf=-1) 6(Bf=0)

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 3

Enter a data: 5

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 4

Preorder sequence:

4(Bf=0) 2(Bf=0) 6(Bf=0)

Inorder sequence:

2(Bf=0) 4(Bf=0) 6(Bf=0)

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 2

Enter a data: 43

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 4

Preorder sequence:

4(Bf=-1) 2(Bf=0) 6(Bf=-1) 43(Bf=0)

Inorder sequence:

2(Bf=0) 4(Bf=-1) 6(Bf=-1) 43(Bf=0)

1)Create:

2)Insert:

3)Delete:

4)Print:

5)Quit:

Enter Your Choice: 5

Result: 

Thus, the concept of AVL Tree was implemented successfully.

THREE TRAVERSAL & BINARY SEARCH TREE


IMPLEMENTATION TREE TRAVERSAL 

(INORDER – PREORDER – POST ORDER)

Exercise.No:6

NOTE:

    * For any queries comment below, instantly the solution will be posted *

TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL: Code with u - YouTube

AIM: 

To write the program to implement the Tree Traversal. 

ALGORITHM: 

1. Read the integers 

2. Create the functions for preorder, in order and post order 

3. Perform push and pop operations. 

FOR INORDER 

Inorder(pos t) 

T!=null 

Inorder(t-> left) 

Printf(“%s”, t->data); 

Inorder(t->right) 

FOR PREORDER 

Preorder(pos t) 

T!=null 

Printf(“%s”, t->data); 

Preorder(t->left) 

Inorder(t->right) 

FOR POSTORDER 

Postorder(pos t) 

Postorder(t->left) 

postorder(t->right) 

Printf(“%s”, t->data); 

4. Visit in the order left, root, right, 

5. Display the visited nodes

PROGRAM:

// program showing various operations on Expression tree. Tree is created

// from a postfix expression

#include<conio.h>

#include<stdio.h>

#include<stdlib.h>

#include<ctype.h>

typedef struct treenode

{

char data;

struct treenode *left,*right;

}treenode;

typedef struct stack

{

treenode *data[20];

int top;

}stack;

void init(stack *s)

{

s->top=-1;

}

treenode * pop(stack *s)

{

treenode *p;

p=s->data[s->top];

s->top=s->top-1;

return(p);

}

void push(stack *s, treenode *p)

{

s->top=s->top+1;

s->data[s->top]=p;

}

treenode *create();

void inorder(treenode *T);

void preorder(treenode *T);

void postorder(treenode *T);

void main()

{

treenode *root=NULL,*p;

int x, op;

do

{

printf("\n\n1)Create\n2)Preorder");

printf("\n3)Inorder\n4)Postorder\n5)Quit");

printf("\n Enter Your Choice :");

scanf("%d",&op);

switch(op)

{

case 1: root=create();break;

case 2: preorder(root);break;

case 3: inorder(root);break;

case 4: postorder(root);break;

}

}while(op<5);

}

void inorder(treenode *T)

{

if(T!=NULL)

{

inorder(T->left);

printf("%c", T->data);

inorder(T->right);

}

}

void preorder(treenode *T)

{ if(T!=NULL)

{ printf("%c", T->data);

preorder(T->left);

preorder(T->right);

}

}

void postorder(treenode *T)

{ if(T!=NULL)

{

postorder(T->left);

postorder(T->right);

printf("%c", T->data);

}

}

treenode * create()

{

char a[50];

int i;

treenode *p,*q,*root;

stack s;

init(&s);

printf("\n Enter a postfix expression : ");

scanf("%s",&a);

for(i=0;a[i]!='\0';i++)

{

if(isalnum(a[i]))

{

p=(treenode*)malloc(sizeof(treenode));

p->left=p->right=NULL;

p->data=a[i];

push(&s,p);

}

else

{

q=pop(&s);

p=pop(&s);

root=(treenode*)malloc(sizeof(treenode));

root->left=p;

root->right=q;

root->data=a[i];

push(&s,root);

}

}

root=pop(&s);

return(root);

}

OUTPUT:

1)Create

2)Preorder

3)Inorder

4)Postorder

5)Quit

Enter Your Choice :1

Enter a postfix expression: pk-ap+*

1)Create

2)Preorder

3)Inorder

4)Postorder

5)Quit

Enter Your Choice :2

*-pk+ap

1)Create

2)Preorder

3)Inorder

4)Postorder

5)Quit

Enter Your Choice :3

p-k*a+p

1)Create

2)Preorder

3)Inorder

4)Postorder

5)Quit

Enter Your Choice :4

pk-ap+*

1)Create

2)Preorder

3)Inorder

4)Postorder

5)Quit

Enter Your Choice :5

RESULT: 

Thus, the program Tree Traversal was implemented and executed successfully.


Thursday, 1 September 2022

POLYNOMIAL ADDITION USING LINKED LIST

 IMPLEMENTATION OF POLYNOMIAL ADDITION USING LINKED LIST

Exercise.No:5 

TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL : 

NOTE : 

        In the below content incase of some error problem the program was slightly modified, so to remodel it the following steps should be taken 

            1.)In "co eff" remove the space between "co" and "eff".

            2.)In "print f" remove the space between "print" and "f".

            3.)In "scan f" remove the space between "scan" and "f".

            4.)In "std io. h" remove the space between "std" and "io" then space between "io." and "h".

            5.)In "con io. h" remove the space between "con" and "io" then space between "io." and "h".

            6.)In "p add" remove the space between "p" and "add".

            7.)In "size of" remove the space between "size" and "of".

    * For any queries comment below ,instantly the solution will be posted*

AIM: 

To implement the program for polynomial addition using linked List. 

ALGORITHM: 

1. Using the function poly1() read the coefficient and exponent terms of the first polynomial 

 until exponent term is zero 

2. Using the function poly2() read the coefficient and exponent terms of the second 

 polynomial until exponent term is zero 

3. Using the function polyadd() add the two polynomials with the following comparisons 

4. If the exponent term in the first polynomial is greater than the exponent in the second 

 polynomial, add the node of the first polynomial with the resultant polynomial 

5. If the exponent term in the first polynomial is lees than the exponent in the second 

 polynomial, add the node of the second polynomial with the resultant polynomial 

6. If the exponent term in the first polynomial is equal to the exponent in the second 

 polynomial, add both the coefficient of the first and second polynomial and the node to the 

 resultant polynomial 

7. Traverse both the polynomial according to the above comparison up to the NULL value of 

 both the polynomials are reached. 

8. Display the resultant polynomial 

PROGRAM :

#include <std io. h>

#include <con io. h>

#include <std lib. h>

#include <math. h>

typedef struct node

{ int power;

float co eff;

struct node *next;

}node;

node * insert(node *head, int power, float co eff);

node * create();

node * p add(node *head1,node *head2);

void print(node *head);

int main()

{

node *head1,*head2,*head3;

int op;

float value, x;

print f("\n Enter 1st Polynomial : ");

head1=create();

print(head1);

print f("\n Enter 2nd Polynomial : ");

head2=create();

print(head2);

head3=p add(head1,head2); 

print f("\n Addition of two polynomials : ");

print(head3);

}

node * insert(node *head, int power, float co eff)

{ node *p,*q;

p=(node*)malloc(size of(node));

p->power=power; p->co eff=co eff;

p->next=NULL;

if(head==NULL)

return(p);

else

if(power<head->power)

{ p->next=head;

return(p);

}

else

{ q=head;

while(q->next!=NULL && power>=q->next->power)

q=q->next;

p->next=q->next;

q->next=p;

if(q->power==p->power)

{

q->co eff=q->co eff +p->co eff;

q->next=p->next;

free(p);

}

return(head);

}

}

node * create()

{

int n, I, power;

float co eff;

node *head;

head=NULL;

print f("\n Enter No. of Terms:");

scan f("%d", &n);

print f("\n enter a term as a tuple of (power, coefficient)");

for(I=1;I<=n; I++)

{

scan f("%d %f", &power, &co eff);

head=insert(head, power, co eff);

}

return(head);

}

node * p add(node *head1,node *head2)

{

node *head=NULL;

int power; float co eff;

while(head1 != NULL && head2 != NULL)

{

if(head1->power < head2->power)

{

head=insert(head,head1->power,head1->co eff);

head1=head1->next;

continue;

}

if(head2->power < head1->power)

{ head=insert(head,head2->power,head2->co eff);

head2=head2->next;

continue;

}

head=insert(head,head1->power,head1->coeff+head2->co eff);

head1=head1->next;

head2=head2->next;

}

while(head1!=NULL)

{head=insert(head,head1->power,head1->co eff);

head1=head1->next;

}

while(head2!=NULL)

{head=insert(head,head2->power,head2->co eff);

head2=head2->next;

}

return(head);

}

void print(node *head)

{ print f("\n");

while(head!=NULL)

{

print f("%6.2fX^%d ",head->co eff, head->power);

head=head->next;

}}

OUTPUT :

Enter 1st Polynomial :

Enter No. of Terms:3

enter a term as a tuple of (power, coefficient)3 3 2 2 1 1

1.00X^1 2.00X^2 3.00X^3

Enter 2nd Polynomial :

Enter No. of Terms:2

enter a term as a tuple of (power, coefficient)2 2 5 5

2.00X^2 5.00X^5

Addition of two polynomials :

1.00X^1 4.00X^2 3.00X^3 5.00X^5

RESULT: 

Thus the program for polynomial addition using linked list was implemented and it’s 

executed successfully.

            *Let us promote a thing, "Code with us" YOUTUBE channel doing a coding works for cheap price their services are 
                        1.) APP DEVELOPMENT
                        2.)WEB DEVELOPMENT
                        3.)REVERSE ENGINEERING (Penetration testing)
                        4.)TEACHING PROGRAMMING LANGUAGES
           To reach "Code with us" immediately comment below to book your time slot.

Stack and Queue operation in C language

IMPLEMENTATION OF STACK AND ITS OPERATION

Exercise.No:3 



TO LEARN C PROGRAMMING FOLLOW THIS YOUTUBE CHANNEL : Code with u - YouTube

AIM: 

To implement the program for Push, Pop and Display operations in Stack. 

ALGORITHM: 

PUSH OPERATION: 

Step 1: If Top=Max-1 

Print “Overflow : Stack is full” and Exit 

End If 

Step 2: Top=Top+1 

Step 3: Stack[TOP]=Element 

Step 4: End 

POP OPEARTION: 

Step 1: If TOP=-1 

Print “Underflow: Stack is empty” and Exit 

End if 

Step 2: Set Del element=Stack[Top] 

Step 3: Top=Top-1 

Step 4: Del Element 

Step 5: End

NOTE : 

        In the below content incase of some error problem the program was slightly modified, so to remodel it the following steps should be taken 

            1.)In "in it" remove the space between "in" and "it".

            2.)In "print f" remove the space between "print" and "f".

            3.)In "scan f" remove the space between "scan" and "f".

            4.)In "std io. h" remove the space between "std" and "io" then space between "io." and "h".

            5.)In "con io. h" remove the space between "con" and "io" then space between "io." and "h".

PROGRAM :

#include<std io. h>

#include<con io. h>

#define MAX 15

typedef struct stack

{

int data[MAX];

int top;

}stack;

stack s;

void in it(stack*s);

void push(stack*s, int x);

void pop(stack*s);

int full(stack*s);

int empty(stack*s);

void print(stack*s);

int main()

{

int op,op1;

do

{

print f("\n\n1)Initialize\n2)Push\n3)Pop\n4)Full");

print f("\n5)Empty\n6)Print\n7)Quit");

print f("\n Enter your Choice:");

scan f("%d", &op);

switch(op)

{

case 1:init(&s);

break;

case 2:printf("\n Enter your element to push : ");

scan f("%d",&op1);

push(&s,op1);

break;

case 3:pop(&s);

break;

case 4:full(&s);

break;

case 5:empty(&s);

break;

case 6:print(&s);

break;

}

}while(op<7);

}

void in it(stack*s)

{

s->top=-1;

}

void push(stack*s, int x)

{

if(s->top==MAX-1)

{

print f("\n Stack is full");

}

else

{

s->top=s->top+1;

s->data[s->top]=x;

}

}

void pop(stack*s)

{

if(s->top==-1)

{

print f("\n Stack is empty");

}

else

{

if(s->top==0)

{

s->top=-1;

}

else

{

s->top=s->top-1;

}

}

}

int empty(stack*s)

{

if(s->top==-1)

{

print f("\n Stack is empty");

}

else

{

print f("\n Stack is not empty");

}

return(0);

}

int full(stack*s)

{

if(s->top==MAX-1)

{

print f("\n Stack is full");

}

else

{

print f("\n Stack is not full");

}

return(0);

}

void print(stack*s)

{

int a;

if(s->top==-1)

{

print f("Stack is empty");

}

else

{

for(a=s->top; a>=0;a--)

{

print f("\n %d", s->data[a]);

}

}

}

OUTPUT :

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:1

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:2

Enter your element to push : 12

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:2

Enter your element to push : 13

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:2

Enter your element to push : 14

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:6

14

13

12

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:3

1)Initialize

2)Push

3)Pop

4)Full

5)Empty

6)Print

7)Quit

Enter your Choice:6

13

12

RESULT: 

Thus the program for Push, Pop and Display operations in Stack was implemented and 

executed successfully.


FRIENDSHIP & GOALS

WHAT IS FRIENDSHIP:  For all the attention we pay to love stories, some of the most compelling stories (in fiction or not) are about best fr...