From 60360f58ff6430c90a1ce459a3abf105ac52d241 Mon Sep 17 00:00:00 2001
From: NIRMAL M <86112673+NIRMAL1508@users.noreply.github.com>
Date: Thu, 31 Oct 2024 21:53:01 +0530
Subject: [PATCH] Create issorted.c

---
 DS/LL/issorted.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 DS/LL/issorted.c

diff --git a/DS/LL/issorted.c b/DS/LL/issorted.c
new file mode 100644
index 0000000000..e3190f0c84
--- /dev/null
+++ b/DS/LL/issorted.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <stdlib.h>
+struct Node
+{
+    int data;
+    struct Node *next;
+}*first=NULL,*second=NULL,*third=NULL;
+void Display(struct Node *p)
+{
+    while(p!=NULL)
+    {
+        printf("%d ",p->data);
+        p=p->next;
+    }
+}
+void create(int A[],int n)
+{
+    int i;
+    struct Node *t,*last;
+    first=(struct Node *)malloc(sizeof(struct Node));
+    first->data=A[0];
+    first->next=NULL;
+    last=first;
+
+    for(i=1;i<n;i++)
+    {
+        t=(struct Node*)malloc(sizeof(struct Node));
+        t->data=A[i];
+        t->next=NULL;
+        last->next=t;
+        last=t;
+    }
+}
+int isSorted(struct Node *p)
+{
+    int x=-65536;
+    while(p!=NULL)
+    {
+        if(p->data < x)
+            return 0;
+        x=p->data;
+        p=p->next;
+    }  
+    return 1;
+}
+int main()
+{
+    int A[]={10,60,20,30,40,50};
+    create(A,5);
+    printf("%d\n",isSorted(first));
+    Display(first);
+    return 0;
+}