dsa
dsa
dsa
#include <stdio.h>
#include <stdlib.h>
struct Day {
char *dayName;
int date;
char *activity;
};
scanf("%s", day->dayName);
scanf("%d", &day->date);
create(&calendar[i]);
}
void display(struct Day *calendar, int size) {
printf("\n");
free(calendar[i].dayName);
free(calendar[i].activity);
int main() {
int size;
scanf("%d", &size);
if (calendar == NULL) {
return 1;
read(calendar, size);
display(calendar, size);
freeMemory(calendar, size);
free(calendar);
return 0;
#include<stdio.h>
int c = 0, m = 0, i = 0, j = 0, k, flag = 0;
void stringmatch()
if (str[m] == pat[i])
i++;
m++;
flag = 1;
i = 0;
else
j++;
c++;
m = c;
i = 0;
void main()
stringmatch();
if (flag == 1)
printf("\nThe string after pattern match and replace is:\n%s", res);
else
#include<stdio.h>
#include<stdlib.h>
#define MAX 3
int s[MAX];
int pop();
void palindrome();
void display();
void main()
while (1)
printf("\n\n\n\n-----------Menu----------- : ");
printf("\n=>4.Display ");
printf("\n=>5.Exit");
switch (choice)
case 1:
push(item);
break;
case 2:
item = pop();
if (item != -1)
break;
case 3:
palindrome();
break;
case 4:
display();
break;
case 5:
exit(1);
default:
break;
if (top == MAX - 1)
{
printf("\n-----------Stack overflow-----------");
return;
top = top + 1;
s[top] = item;
int pop()
int item;
if (top == -1)
printf("\n-----------Stack underflow-----------");
return -1;
item = s[top];
top = top - 1;
return item;
void display()
int i;
if (top == -1)
printf("\n-----------Stack is empty-----------");
return;
void palindrome()
int flag = 1, i;
flag = 0;
break;
if (flag == 1)
else
}
}
#include<stdio.h>
#include<stdlib.h>
void evaluate();
void push(char);
char pop();
int prec(char);
void main()
scanf("%s", infix);
evaluate();
void evaluate()
int i = 0, j = 0;
push('#');
symb = infix[i];
switch (symb)
case '(':
push(symb);
break;
case ')':
temp = pop();
postfix[j] = temp;
j++;
temp = pop();
break;
case '+':
case '-':
case '*':
case '/':
case '%':
case '^':
case '$':
temp = pop();
postfix[j] = temp;
j++;
push(symb);
break;
default:
postfix[j] = symb;
j++;
temp = pop();
postfix[j] = temp;
j++;
postfix[j] = '\0';
top = top + 1;
stack[top] = item;
char pop()
char item;
item = stack[top];
top = top - 1;
return item;
{
int p;
switch (symb)
case '#':
p = -1;
break;
case '(':
case ')':
p = 0;
break;
case '+':
case '-':
p = 1;
break;
case '*':
case '/':
case '%':
p = 2;
break;
case '^':
case '$':
p = 3;
break;
return p;
}
5a
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
top = top + 1;
s[top] = item;
int pop()
int item;
item = s[top];
top = top - 1;
return item;
void main()
scanf("%s", postfix);
for (i = 0; postfix[i] != '\0'; i++)
symb = postfix[i];
if (isdigit(symb))
push(symb - '0');
else
op2 = pop();
op1 = pop();
switch (symb)
case '+':
push(op1 + op2);
break;
case '-':
push(op1 - op2);
break;
case '*':
push(op1 * op2);
break;
case '/':
push(op1 / op2);
break;
case '%':
push(op1 % op2);
break;
case '$':
case '^':
push(pow(op1, op2));
break;
default:
push(0);
res = pop();
5b
#include <stdio.h>
if (n == 0)
return;
void main()
int n;
#include<stdio.h>
#include<stdlib.h>
#define MAX 5
char circular_queue[MAX];
int isEmpty()
return 1;
else
return 0;
int isFull()
return 1;
else
return 0;
if (isFull())
return;
else if (isEmpty())
{
front = rear = 0;
else
circular_queue[rear] = element;
void deleteElement()
if (isEmpty())
return;
else
void display()
int i;
if (isEmpty())
{
printf("Circular Queue is empty\n");
return;
i = front;
do
i = (i + 1) % MAX;
printf("\n");
int main()
int choice;
char element;
do
printf("4. Exit\n");
scanf("%d", &choice);
switch(choice)
case 1:
printf("Enter element to be inserted: ");
insertElement(element);
break;
case 2:
deleteElement();
break;
case 3:
display();
break;
case 4:
printf("Exiting...\n");
break;
default:
while(choice != 4);
return 0;