Please write program in C language.
2.Write a recursive int function to return the number of even integers in a linked list. Each node in the list has an integer number (declared as int number) and a pointer to the next node (declared as NODE *next). The function is defined as
int count (NODE *);
and is called as follows:
x = count(head);
int count (NODE *start){
if(start==NULL){
return 0;
}
else{
int val = start->number;
int result = count(start->next);
if(val%2==0){
result+=1;
}
return result;
}
}
Please write program in C language. 2.Write a recursive int function to return the number of...
Given the following linked list structure called node: struct node { int val; struct node * ptrNext; }; Assume we have a single list created from this structure with a head pointer called ptrFirst which is declared in the global scope. a. Write a complete C function called CountEven to count all the even values in this singly linked list of arbitrary number of nodes using an iterative (non-recursive) approach. The function takes as parameter the pointer to the starting...
C programming
Write an iterative and recursive version of a function to print out a linked list from head to tail and then do the same for printing a linked list from tail to head. Assume a singly linked list in all cases and access only to a head pointer at the time of the function call. struct node; typedef struct node Node; struct node int data; Node next;
C++ PROGRAM/ DLL • int count(node * head) recursively compute and return the number of nodes in the doubly linked list. • void insert(node * & head, int newInt, int position) recursively insert newInt at index “position” where index starts from 0 • int remove(node * & head, int position) recursively remove the integer at index “position” and return it.
Structure struct Node int Manth; // Mont h double dAvg: 1/ Average struct Node pNext // with, the linked İist 3hown above the function will return gven that the average is 3.8 Ptr to next -Node; Ret (3,3.8) (4,2.5) (20pts)( Recursive function) Show the code for a function that receives a pointer to the head of an ordered singly linked list that uses the structure in the top left. The function will return the pointer node that shows the highest...
Write a recursive function in C++ that displays all nodes data (integers) in an array of linked lists. Assuming: struct node { int data; node * next; }; class arrayList { public: arrayList(); ~arrayList(); private: node ** head; int size; //(this is determined by another part of the program) }
Please slove all these questions in C language
Write a function insert At Position N () for a singly-linked list that has the following declaration and precondition: int insert At Position N (strict node **p Head, int n, int new Data); Precondition: n > 0 and the list always has enough nodes to satisfy the position specified by n. The function should allocate memory for a new node, and initialize it with the new Data value. It should then insert...
In C++ syntax please
Write a program that implements and demonstrates a linked list using functions. Your program should first dehne a node that stores an integer and then your program will include the following functions appendo- This function accepts the head pointer (by reference) of a linked list and an integer as it's only arguments. It then creates a node, stores the integer argument in the node, and adds it to the end of the list. findo-This function accepts...
In Haskell: Write a recursive function fibonacci that computes the n-th Fibonacci number. fibonacci :: Int -> Int Write a recursive function myProduct that multiplies all the numbers in a list. myProduct :: [Integer] -> Integer Using the technique of List Comprehension write a function that would remove even numbers from a list of lists. For Example: given input: [[1,2,3,4], [6,3,45,8], [4,9,23,8]] expected output: [[1,3], [3,45],[9,23]]. Show how the library function replicate :: Int -> a-> [a] that produces a...
Using the provided Linked List template, add the following recursive functions and demonstrate them in a separate cpp file. Write a recursive function to print the list in order. Write a recursive function to print the list in reverse order. Write a recursive function to print every other node in the list in order. Write a recursive function to return the number of nodes in the list. Write a Boolean function that implements the recursive version of sequential search. THIS...
Write a program to reverse an integer number by using a function
called reverse. The program reads in an integer number and prints
its reverse order. Note that the function receives the number via a
pointer, and uses the pointer to write the reverse number on the
main function.
The function MUST be used AS
IS:
void reverse(int *n)
Language in C
Bonus Problem: Number Reverser reverse c Write a program to reverse an integer number by using a function...