21. Implement a program to remove duplicates from an array.

Required Input:

arr = {1, 2, 3, 2, 4, 1}

Expected Output:

Array after removing duplicates: 1 2 3 4 

Code In C

#include int main() { int arr[] = {1, 2, 3, 2, 4, 1}; int size = sizeof(arr) / sizeof(arr[0]); // Logic to remove duplicates return 0; }

Output

Click Run Button to view compiled output

22. Write a program to implement a simple queue using a circular array.

Required Input:

enqueue(10), enqueue(20), dequeue()

Expected Output:

Dequeued Element = 10

Code In C

#include #define MAX 5 struct Queue { int arr[MAX]; int front; int rear; }; int main() { struct Queue queue; queue.front = -1; queue.rear = -1; // Logic for enqueue and dequeue return 0; }

Output

Click Run Button to view compiled output

23. Implement a program to reverse a string using pointers.

Required Input:

str = 'Hello'

Expected Output:

Reversed String = olleH

Code In C

#include #include int main() { char str[] = "Hello"; // Logic to reverse the string return 0; }

Output

Click Run Button to view compiled output

24. Write a program to implement a simple linked list and display its elements.

Required Input:

Insert(10), Insert(20), Insert(30)

Expected Output:

Linked List: 10 -> 20 -> 30 -> NULL

Code In C

#include #include struct Node { int data; struct Node *next; }; void insert(struct Node **head, int data); int main() { struct Node *head = NULL; // Logic to insert and display linked list return 0; }

Output

Click Run Button to view compiled output

25. Implement a program to find the missing number in an array of size n containing numbers from 1 to n+1.

Required Input:

arr = {2, 3, 1, 5}

Expected Output:

Missing Number = 4

Code In C

#include int main() { int arr[] = {2, 3, 1, 5}; int size = sizeof(arr) / sizeof(arr[0]); // Logic to find the missing number return 0; }

Output

Click Run Button to view compiled output

26. Write a program to implement the binary tree data structure and perform in-order traversal.

Required Input:

Insert elements: 10, 5, 15, 3, 7, 12, 18

Expected Output:

In-order Traversal: 3 5 7 10 12 15 18 

Code In C

#include #include struct Node { int data; struct Node *left; struct Node *right; }; struct Node *insert(struct Node *node, int data); void inorder(struct Node *root); int main() { struct Node *root = NULL; // Logic to insert nodes and perform in-order traversal return 0; }

Output

Click Run Button to view compiled output

27. Create a program to count the number of vowels in a given string.

Required Input:

str = 'Hello World'

Expected Output:

Number of vowels = 3

Code In C

#include int main() { char str[] = "Hello World"; // Logic to count vowels return 0; }

Output

Click Run Button to view compiled output

28. Implement a program to merge two sorted arrays into a single sorted array.

Required Input:

arr1 = {1, 3, 5}, arr2 = {2, 4, 6}

Expected Output:

Merged Array: 1 2 3 4 5 6 

Code In C

#include int main() { int arr1[] = {1, 3, 5}; int arr2[] = {2, 4, 6}; int size1 = sizeof(arr1) / sizeof(arr1[0]); int size2 = sizeof(arr2) / sizeof(arr2[0]); // Logic to merge arrays return 0; }

Output

Click Run Button to view compiled output

29. Write a program to implement a stack using a linked list.

Required Input:

Push(10), Push(20), Pop()

Expected Output:

Popped Element = 20

Code In C

#include #include struct Node { int data; struct Node *next; }; void push(struct Node **top, int data); int pop(struct Node **top); int main() { struct Node *top = NULL; // Logic for push and pop operations return 0; }

Output

Click Run Button to view compiled output

ad vertical

3 of 3