answersLogoWhite

0

What is data in link list?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

Data in the link list could be anything, it could be user defined data types or standard data types. Like link list of a text file data could be list of strings.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is data in link list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Is a linked list is a data structure that contain data and a link to another data?

Yes.


Is double link list a linear data structure?

Yes.


What do you understand by a linked list in data structure?

link list is a process by which we can add one file with another


What plants in South Africa are endangered?

See Related link for list of Red Data List species in South Africa


Can structure contain a pointer itself?

Yes a simple exp is the link list. struct node { int data; struct node *link; }


In C plus plus provide a convenient way to organize data into fields and records?

link list


Name all the gasses?

The list is quite long to be typed here. Please refer to the suggested link for alphabetical list and other data on gases.


Write a program to merge two linked list and find out the merge node?

#include <stdio.h> #include <conio.h> #include <alloc.h> /* structure containing a data part and link part */ struct node { int data ; struct node *link ; } ; void add ( struct node **, int ) ; void display ( struct node * ) ; int count ( struct node * ) ; void merge ( struct node *, struct node *, struct node ** ) ; void main( ) { struct node *first, *second, *third ; first = second = third = NULL ; /* empty linked lists */ add ( &first, 9 ) ; add ( &first, 12 ) ; add ( &first, 14 ) ; add ( &first, 17 ) ; add ( &first, 35 ) ; add ( &first, 61 ) ; add ( &first, 79 ) ; clrscr( ) ; printf ( "First linked list : " ) ; display ( first ) ; printf ( "\nNo. of elements in Linked List : %d" , count ( first ) ) ; add ( &second, 12 ) ; add ( &second, 17 ) ; add ( &second, 24 ) ; add ( &second, 36 ) ; add ( &second, 59 ) ; add ( &second, 64 ) ; add ( &second, 87 ) ; printf ( "\n\nSecond linked list : " ) ; display ( second ) ; printf ( "\nNo. of elements in Linked List : %d" , count ( second ) ) ; merge ( first, second, &third ) ; printf ( "\n\nThe merged list : " ) ; display ( third ) ; printf ( "\nNo. of elements in Linked List : %d", count ( third ) ) ; } /* adds node to an ascending order linked list */ void add ( struct node **q, int num ) { struct node *r, *temp = *q ; r = malloc ( sizeof ( struct node ) ) ; r -> data = num ; /* if list is empty or if new node is to be inserted before the first node */ if ( *q == NULL ( *q ) -> data > num ) { *q = r ; ( *q ) -> link = temp ; } else { /* traverse the entire linked list to search the position to insert the new node */ while ( temp != NULL ) { if ( temp -> data < num && ( temp -> link -> data > num temp -> link == NULL )) { r -> link = temp -> link ; temp -> link = r ; return ; } temp = temp -> link ; /*go to next node */ } r -> link = NULL ; temp -> link = r ; } } /* displays the contents of the linked list */ void display ( struct node *q ) { printf ( "\n" ) ; /* traverse the entire linked list */ while ( q != NULL ) { printf ( "%d ", q -> data ) ; q = q -> link ; } } /* counts the number of nodes present in the linked list */ int count ( struct node * q ) { int c = 0 ; /* traverse the entire linked list */ while ( q != NULL ) { q = q -> link ; c++ ; } return c ; } /* merges the two linked lists, restricting the common elements to occur only once in the final list */ void merge ( struct node *p, struct node *q, struct node **s ) { struct node *z ; z = NULL ; /* if both lists are empty */ if ( p NULL ) return ; /* traverse both linked lists till the end. If end of any one list is reached loop is terminated */ while ( p != NULL && q != NULL ) { /* if node being added in the first node */ if ( *s == NULL ) { *s = malloc ( sizeof ( struct node ) ) ; z = *s ; } else { z -> link = malloc ( sizeof ( struct node ) ) ; z = z -> link ; } if ( p -> data < q -> data ) { z -> data = p -> data ; p = p -> link ; } else { if ( q -> data < p -> data ) { z -> data = q -> data ; q = q -> link ; } else { if ( p -> data == q -> data ) { z -> data = q -> data ; p = p -> link ; q = q -> link ; } } } } /* if end of first list has not been reached */ while ( p != NULL ) { z -> link = malloc ( sizeof ( struct node ) ) ; z = z -> link ; z -> data = p -> data ; p = p -> link ; } /* if end of second list has been reached */ while ( q != NULL ) { z -> link = malloc ( sizeof ( struct node ) ) ; z = z -> link ; z -> data = q -> data ; q = q -> link ; } z -> link = NULL ;


What is a data communication link?

data communication link


What is the definition of a list in programming?

A list is data type which implements a linear data sequence container object with elements that are allocated non-contiguously. To navigate a list, we use a node class. A node refers to an element but also refers to the next and previous nodes in the sequence. A simple node may be defined as follows: template<typename T> struct node { T* data; // link to an element (of some type T) node* next; // link to next node node* prev; // link to previous node };


Given a linked list of integers sorted in an ascending order and a pointer to a single node containing an integer write a C program that insert the node P in the linked list so that remains sorted?

InsertNode(NODE **q,int num) { NODE *r,*temp ; temp = *q; r= malloc(sizeof(NODE)); r->data = num; //if it's fisrt node to be inserted if ( *q == NULL num < (*q)->data) { *q = r ; (*q)->link=temp; } else { while(temp) { if ( (num > temp->data) && (num < temp->link->data ) ) { r->link = temp->link; temp->link = r; return; } temp = temp->link; } r->link = NULL; temp->link = r; } }


What is a link list in terms of computer science?

in computer science a linked list is a data structure consisting of group of nodes which together represent a sequence. under the simplest from each nod