Name an advantage of linked list over array?

Answer Posted / azhar iqbal

Array is of fix size & contain always same type of data.

Whereas linklist is dynamic in size.And a type of linklist
have capability to store different type of data at its
nodes, and for doing that we use void pointer( a pointer
that can point any type of data )

Is This Answer Correct ?    14 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need oop?

896


What does I oop mean?

857


Why multiple inheritance is not possible?

826


How many human genes are polymorphic?

816


What are oops functions?

801


What are different oops concepts?

795


What is an example of genetic polymorphism?

900


How to call a non virtual function in the derived class by using base class pointer

5966


What is encapsulation in simple terms?

790


Can we create object of interface?

868


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

1908


What is variable example?

817


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3534


Can a destructor be called directly?

823


Why oops is important?

813