Data Structures Lab Manual / Data Structures Single Linked List C Program

Program Name: Write a C Program for Single Linked List in Data Structures
Theory
A Single Linked List is a linear data structure and has two parts data section and address section
( holds the address of the next element in the list, which is called a node.).  it can be 
traversed in only one direction from head to the last node (tail). 
Program Code



Input:
Single Linked List Operations
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
9

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
6

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
3

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
3

Display Single Linked List : 
# 9 # # 6 # # 3 # 

Single Linked List No Of Items : 3
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
2

Single Linked List No Of Items  : 3

Display Linked List
Enter Position for Delete Element: 2

Deleted Successfully 

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
3

Display Single Linked List : 
# 9 # # 3 # 

Single Linked List No Of Items : 2
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
Output:
Single Linked List Operations
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
9

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
6

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
1

Enter Element for Insert Linked List : 
3

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
3

Display Single Linked List : 
# 9 # # 6 # # 3 # 

Single Linked List No Of Items : 3
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
2

Single Linked List No Of Items  : 3

Display Linked List
Enter Position for Delete Element: 2

Deleted Successfully 

Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit
3

Display Single Linked List : 
# 9 # # 3 # 

Single Linked List No Of Items : 2
Enter a Choice to perform the Operation
1.Insert   2. Delete   3. Display   4.Exit


Home     Back