COMP104LinkedLists/Slide6Some simple algorithmsWrite a function that returns the length of agiven list.Write a boolean function that tests whether agiven unsorted list of characters is apalindromeWrite a function that computes the union oftwo sorted linked lists of integers
COMP104 Linked Lists / Slide 6 Some simple algorithms Write a function that returns the length of a given list. Write a boolean function that tests whether a given unsorted list of characters is a palindrome. Write a function that computes the union of two sorted linked lists of integers
The length of a given list:int length(NodePtr head) {Nodeptr cur = head;intl=0;while(cur != NULL)1++;cur = cur->next;1return
int length(NodePtr head) { NodePtr cur = head; int l=0; while(cur != NULL){ l++; cur = cur->next; } return l; } The length of a given list: