Bhanu Priya has Published 1581 Articles

C program to find the length of linked list

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:04:06

2K+ Views

Linked lists use dynamic memory allocation i.e. they grow and shrink accordingly. They are defined as a collection of nodes. Here, nodes have two parts, which are data and link. The representation of data, link and linked lists is given below −Types of Linked ListsLinked lists have four types, which ... Read More

C program for a number to be expressed as a sum of two prime numbers.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 07:00:07

4K+ Views

ProblemFind out if a given number can be expressed as sum of two prime numbers or not.Given a positive integer N, we need to check if the number N can be represented as a sum of two prime numbers.SolutionConsider an example given below −20 can be expressed as sum of ... Read More

C program to replace all zeros with one in a given integer.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:56:47

2K+ Views

ProblemWrite a program to replace all zeros (0's) with 1 in a given integer.Given an integer as an input, all the 0's in the number has to be replaced with 1.SolutionConsider an example given below −Here, the input is 102410 and the output is 112411.AlgorithmRefer an algorithm given below to ... Read More

Explain queue by using linked list in C language

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:52:11

1K+ Views

Queue overflow and Queue under flow can be avoided by using linked list.Operations carried out under queue with the help of linked lists in C programming language are as follows −InsertDeleteInsertionThe syntax is as follows −Syntax&item : Newnode = (node*) mallac (sizeof (node)); newnode ->data = item; newnode ->link = ... Read More

C programs to differentiate array of structures and arrays within a structure

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:50:51

586 Views

In C programming language, the most common use of structure is an array of structures.To declare an array of structures, first the structure must be defined and then, an array variable of that type has to be defined.For example, struct book b[10];//10 elements in an array of structures of type ... Read More

C program to compare the structure variables

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:47:28

7K+ Views

In C programming language, a structure is a collection of different datatype variables, which are grouped together under a single name.Declaration and initialization of structuresThe general form of a structure declaration is as follows −datatype member1; struct tagname{    datatype member2;    datatype member n; };Here, struct is a keyword.tagname ... Read More

Explain the stack by using linked list in C language

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:47:11

2K+ Views

Stack over flow and stack under flow can be avoided by allocating memory dynamically.Operations carried out under stack in C programming language are as follows −PushPopPushFollowing is the basic implementation of a linked list −&item = 10 newnode = (node*) malloc (sizeof (node)); newnode ->data = item; newnode ->link = ... Read More

C program to sort names in alphabetical order with string functions.

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:43:54

749 Views

ProblemSort the names given by the user at runtime in an alphabetical order by using the bubble sort technique.SolutionThe logic used to print the names in alphabetical order is as follows −for (i=1; i < ITEMS; i++){    for (j=1; j 0){ /* Exchange of contents */     ... Read More

Explain the deletion of element in linked list

Bhanu Priya

Bhanu Priya

Updated on 26-Mar-2021 06:40:12

506 Views

Linked lists use dynamic memory allocation i.e. they grow and shrink accordingly. They are defined as a collection of nodes. Here, nodes have two parts, which are data and link. The representation of data, link and linked lists is given below −Operations on linked listsThere are three types of operations ... Read More

C program to calculate the standard deviation

Bhanu Priya

Bhanu Priya

Updated on 25-Mar-2021 11:48:20

5K+ Views

Standard deviation is used to measure deviation of data from its mean. The mathematical formula to calculate the standard deviation is as follows −$$s=\sqrt{Variance}$$whereVariance$$=\frac{1}{n}\:\:\displaystyle\sum\limits_{i=1}^n (x_{i}-m)^{2}$$and$$m=mean=\frac{1}{n}\:\displaystyle\sum\limits_{i=1}^n x_{i}$$AlgorithmRefer an algorithm given below to calculate the standard deviation for the given numbers.Step 1 − Read n items.Step 2 − Calculate sum and mean ... Read More

Advertisements