Archive for important data structure interview questions

You are browsing the archives of important data structure interview questions.

Data Structure Interview Questions | C/C++ Data Structures Interview Questions

C/C++ Data Structures Interview Question: 1.How to create a copy of a linked list? Ans:   copy_linked_lists(struct node *q, struct node **s) { if(q!=NULL) { *s=malloc(sizeof(struct node)); (*s)->data=q->data; (*s)->link=NULL; copy_linked_list(q->link, &((*s)->link)); } } copy_linked_lists(struct node *q, struct node **s) { if(q!=NULL) { *s=malloc(sizeof(struct node)); (*s)->data=q->data; (*s)->link=NULL; copy_linked_list(q->link, &((*s)->link)); } } 2.What are the advantages and […]