Skip to content

Vipassna/Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

length-of-a-singly-linked-list:

#include<stdio.h>
#include<conio.h>
struct node
{
int a;
struct node *next;
};
int main()
{
struct node *head=NULL;
int count;
count=0;
generate(&head);
count=length(head);
printf("the number of nodes are:",count);
return 0;
}

check-if-linked-list-is-a-palindrome😇

algorithm certains steps: 1.split the linked list in the middle. 2.prepare two linked lists. 3. if odd ignore the middle node. 4. reverse the second linked list. 5. compare the two linked lists.

while()
{
p=p->next->next;
q=q->next;
if(p->next==NULL)
{
start_second=q->next->next;break;
}
if(p==NULL)
{
start_second=q->next;break;
}
q->next=NULL;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages