Compare commits
9
Commits
280758e7b5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2efbc6e1cb | ||
|
|
654eae8007 | ||
|
|
3ccfb3e420 | ||
|
|
08aa0d19e8 | ||
|
|
791b774d2f | ||
|
|
b63c9f1ccb | ||
|
|
d1e0062ae7 | ||
|
|
38837667c2 | ||
|
|
6c9f757c62 |
BIN
Binary file not shown.
+3
-3
@@ -25,7 +25,7 @@ void display()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int search(int value)
|
Node *search(int value)
|
||||||
{
|
{
|
||||||
Node *temp = head;
|
Node *temp = head;
|
||||||
|
|
||||||
@@ -33,13 +33,13 @@ int search(int value)
|
|||||||
{
|
{
|
||||||
if (temp->data == value)
|
if (temp->data == value)
|
||||||
{
|
{
|
||||||
return 1;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = temp->next;
|
temp = temp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count()
|
int count()
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ typedef struct Node
|
|||||||
|
|
||||||
void insert(int data);
|
void insert(int data);
|
||||||
void display();
|
void display();
|
||||||
int search(int value);
|
Node *search(int value);
|
||||||
int count();
|
int count();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,18 +6,28 @@ int main()
|
|||||||
insert(10);
|
insert(10);
|
||||||
insert(20);
|
insert(20);
|
||||||
insert(30);
|
insert(30);
|
||||||
|
printf("Linked List: ");
|
||||||
|
|
||||||
display();
|
display();
|
||||||
|
|
||||||
if (search(20))
|
Node *result = search(20);
|
||||||
|
if (result != NULL)
|
||||||
{
|
{
|
||||||
printf("\nElement found\n");
|
printf("\n the Element found: %d\n", result->data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\nElement not found\n");
|
printf("\n the Element not found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Total nodes = %d\n", 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user