Professional Documents
Culture Documents
Daffodil International University Fall 2021 MRH
Daffodil International University Fall 2021 MRH
[Student must either TYPE or HAND WRITE the answers in this template; In case needed just
write your detail on the paper using hand]
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
Part-A
a)
knees
head
e m t n e m t n
Knees Toes
b)
STACK: (empty)
Queue: (empty)
Dequeue (8) Queue : dequeue (8) not possible because Queue 8 not present
Part-B
a)
#include<stdio.h>
#include<stdlib.h>
struct node{
int al;
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
while (p!=NULL)
{
if (p->al==n)
{
found=1;
break;
}
p = p->imran;
if (found==1)
{
p->imran = q->imran;
free(q);
printf("Next item delete sucess\n");
}else
{
printf("Value Not Founded");
}
int main(){
a = malloc(sizeof(struct node));
b = malloc(sizeof(struct node));
c = malloc(sizeof(struct node));
d = malloc(sizeof(struct node));
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
a->al = 8;
b->al = 3;
c->al = 6;
d->al = 9;
a->imran = b;
b->imran = c;
c->imran = d;
d->imran = NULL;
head = a;
linkListSearch(head);
return 0;
}
b)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
char d;
char e;
struct node *f;
}*head;
int main()
{
createList('D','k');
createList('J','K');
//NODE NODE IN qUESTION 2B
printf("\nData in the list \n");
displayList();
//insert last
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
lastInsert('M','S');
printf("\nData in the list \n");
displayList();
return 0;
}
if(head == NULL)
{
head = temp;
}
else
{
temp->f = head;
head = temp;
}
}
if(head == NULL)
{
head = temp;
}
else
{
struct node *p;
p = head;
while(p->f != NULL)
{
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
p = p->f;
}
p->f = temp;
}
}
c)
#include<stdio.h>//id=211-15-3986
int main()
{
int std_id[10]={2,1,1,1,5,3,9,8,6,0};
int i,n;
printf("Search 5 in array.\n");
for(i=0; i<n; i++)
{
if(std_id[i]==5)
{
printf("5 found at position %d\n", i+1);
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
return 0;
}
}
i)
the array that I created if I want to search an element from it, I will use the method
liner search. As my array is one-dimensional, the linear search can be easily executed.
Linear search is an algorithm for finding a target value within a list. It sequentially
checks each element of the list for the target value until a match is found or until all
the elements have been searched. This is one of the most basic search algorithms and
is directly, inspired by real-life events.
Algorithm
Step 2: Compare the current element with the target element.// A[i]=5
Step 3: If there is a next element, then set current element to next element and go to
Step 2.
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
Part-C
a) Postfix
Prefix
2. Postfix of 0*6+8*(9/(3^5+1)-1*1)/2
Answer is +/2*-*11/+1^5398*60
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.
ID: 211-15-3986
b)
The evaluation value of avobe postfix is 211*153^+9/-/8*60*+ = 16
** Plagiarism will be checked while you submit your response. You are advised to be honest during
the open book exam.