pgm to find middle element of linklist(in efficent manner)
Answer Posted / sharan
NODE display_middle(NODE first)
{
int count = 0;
NODE temp,mid;
for ( temp = mid = first, count=0; temp ; temp = temp ->
link,count++)
{
if ( count % 2 )
{
mid = mid -> link;
}
}
return mid;
}
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What are different types of pointers?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is the use of linkage in c language?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures
What is main return c?
What is a program flowchart?
Describe the header file and its usage in c programming?
What is double pointer in c?
Why c is called a middle level language?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
Explain the red-black trees?
What is the meaning of 2d in c?
How can I automatically locate a programs configuration files in the same directory as the executable?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
Are pointers really faster than arrays?