Compare commits

..
12 Commits
Author SHA1 Message Date
Shifa 2efbc6e1cb Merge branch 'feature' 2026-08-04 07:35:53 +00:00
Shifa 654eae8007 added a statement 2026-08-04 07:26:44 +00:00
Shifa 3ccfb3e420 added feature 2026-08-04 07:21:27 +00:00
Shifa 08aa0d19e8 added printf 2026-08-03 09:37:37 +00:00
Shifa 791b774d2f Merge branch 'main' of http://13.234.246.121:3000/bjayesh/shifalearn 2026-08-03 09:18:55 +00:00
Shifa b63c9f1ccb added a statement 2026-08-03 09:10:24 +00:00
shifa.f d1e0062ae7 Update main.c 2026-07-31 09:35:57 +00:00
Shifa 38837667c2 added a message in main.c 2026-07-31 07:10:41 +00:00
Shifa 6c9f757c62 modified search feature 2026-07-30 10:07:05 +00:00
SF 280758e7b5 Added count feature 2026-07-30 06:49:33 +00:00
SF dc5257ce84 Added search feature 2026-07-30 06:42:38 +00:00
SF 7a123d5f21 Created basic linked list 2026-07-30 06:31:27 +00:00
4 changed files with 37 additions and 34 deletions
BIN
View File
Binary file not shown.
+20 -21
View File
@@ -1,11 +1,9 @@
#include<stdio.h>
#include<stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include "linkedlist.h"
Node *head = NULL;
void insert(int data)
{
Node *newNode = malloc(sizeof(Node));
@@ -16,39 +14,40 @@ void insert(int data)
head = newNode;
}
void display()
{
Node *temp=head;
while(temp!=NULL)
{
printf("%d ",temp->data);
temp=temp->next;
}
}
int search(int value)
{
Node *temp = head;
while(temp != NULL)
{
if(temp->data == value)
return 1;
printf("%d ", temp->data);
temp = temp->next;
}
}
Node *search(int value)
{
Node *temp = head;
while (temp != NULL)
{
if (temp->data == value)
{
return temp;
}
temp = temp->next;
}
return 0;
return NULL;
}
int count()
{
int count = 0;
Node *temp = head;
while(temp != NULL)
while (temp != NULL)
{
count++;
temp = temp->next;
+3 -3
View File
@@ -1,3 +1,4 @@
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
@@ -6,12 +7,11 @@ typedef struct Node
int data;
struct Node *next;
}Node;
} Node;
void insert(int data);
void display();
int search(int value);
Node *search(int value);
int count();
#endif
+14 -10
View File
@@ -1,29 +1,33 @@
#include<stdio.h>
#include <stdio.h>
#include "linkedlist.h"
int main()
{
insert(10);
insert(20);
insert(30);
printf("Linked List: ");
display();
int result = search(20);
if(result)
Node *result = search(20);
if (result != NULL)
{
printf("\nElement found");
printf("\n the Element found: %d\n", result->data);
}
else
{
printf("\nElement not found");
printf("\n the Element not found\n");
}
printf("\nTotal nodes = %d", count());
printf("Total nodes = %d\n", count());
printf("Count operation completes.\n");
printf("\nThis is Main Branch\n");
printf("\nThis is Feature Branch\n");
return 0;
}