Posts

Showing posts from September, 2023

DATA STRUCTURE:DOUBLY LIKED LIST(CREATE,DISPLAY,SEARCH,DELETE BY VALUE,DELETE BY POSITION,INSERT):MENU DRIVEN PROGRAM:-

 #include <stdio.h> #include <conio.h> #include <stdlib.h> typedef struct node {     int data;     struct node *next;     struct node *pre; } NODE; NODE *create_list(NODE *list) {     NODE *temp, *new_node;     int i, n;     printf("\n Enter size of list:");     scanf("%d", &n);     for (i = 1; i <= n; i++)     {         new_node = (NODE *)malloc(sizeof(NODE));         new_node->next = NULL;         new_node->pre = NULL;         printf("\n Enter [%d] node data:", i);         scanf("%d", &new_node->data);         if (list == NULL)         {             list = temp = new_node;         }         else         {       ...

DATA STRUCTURE -ASSIGNMENT NO.5-LINKED LIST

 PRACTICE PROGRAM: 1) Write a C Program to find largest element of doubly linked list. ANS: #include <stdio.h> #include <conio.h> #include <stdlib.h> typedef struct node {     struct node *pre;     int data;     struct node *next; } NODE; NODE *create_list(NODE *list) {     NODE *temp = list, *new_node;     int n, i;     printf("\n Enter how many nodes:");     scanf("%d", &n);     for (i = 1; i <= n; i++)     {         new_node = (NODE *)malloc(sizeof(struct node));         new_node->next = NULL;         new_node->pre = NULL;         printf("\n Enter [%d] node data:", i);         scanf("%d", &new_node->data);         if (list == NULL)         {             list = temp = new_node;   ...

DATA STRUCTURE-LINKED LIST(DELETE,INSERT,CREATE,DISPLAY OPERATIONS):MENU DRIVEN PEOGRAM:-

 #include <stdio.h> #include <conio.h> #include <stdlib.h> typedef struct node {     int data;     struct node *next; } NODE; NODE *create_list(NODE *list) {     NODE *temp, *new_node;     int n, i;     printf("\n Enter how many nodes you want:");     scanf("%d", &n);     for (i = 1; i <= n; i++)     {         new_node = (NODE *)malloc(sizeof(struct node));         new_node->next = NULL;         printf("\n Enter [%d] list element:", i);         scanf("%d", &new_node->data);         if (list == NULL)         {             list = temp = new_node;         }         else         {             temp->next = new_node;     ...

DATA STRUCTURE: ASSIGNMENT-4:SEARCHING TECHNIQUES

 PRACTICE PROGRAMS: 1) Write a C program to linearly search an element in a given array. (Use Recursion). ANS: #include <stdio.h> #include <conio.h> void display(int a[], int n) {     for (int i = 0; i < n; i++)     {         printf("\t%d", a[i]);     } } void linear_search(int a[], int n, int key) {     int flag = 0;     for (int i = 0; i < n; i++)     {         if (a[i] == key)         {             printf("\n The %d element are founded at %d position!", key, i);             flag = 1;         }     }     if (flag == 0)     {         printf("\n the element are not exist!");     } } int main() {     int a[10], i, n, key, search;     printf("\n Enter the size of array:");     scan...