You are on page 1of 12

HOMEWORK NO:1

CAP205: Data Structure

SUBMITTED TO: - SUBMITTED BY:-


SANJAY SOOD SURENDRA
MCA 3nd SEM
ROLL NO- D3804A15
REGD NO- 10806601
Qno.1> why structuring of data is required. Tree one example
problem that can be faced if wrong choice has been made in
searching data structure for the problem?
Ans. Data is the collection of information. From any data we can get
the information of on any bject. The ful information in the organize
form is called the data structure. When we are getting the information
then it is the data. If this dtata is available in the organized form then it
is called the data structure.
Data structure requirement:
• Easy to fetch the stored data

• The redundancy is controlled

• The data program is independence

• Easy to maintain
If we are searching the data from the data structure and we are given
to computer to fetch the wrong data then it will give us the wrong
data. If we will give the wrong input then the output will also be the
wrong. Data structure is the organized data from which we can get
information.if we search any data we search the wrong data then it
will give the wrong output.
Qno.2>describe the concept of abstract data type in data
structure?
Ans .. it is the way to looking up at the data structure. From the
abstract data type we can focus and ignore the jobs. The example of
the ADT is the stack. For more decription of the ADT we will learn the
data type and abstract.
• Data type: the data type is represent the type of the data. We can
know that what kind of the data is: is it integer type or float type.

• Abstract: an Abstract Data Type is a class considered without


regard to its implementation. It can be thought of as a
"description" of the data in the class and a list of
opercentcentsentations that can be carried out on that data and
instructions on how to use these opercentcentsentations.
Qno.3>in which application areas data structure is extensively
used?
Ans .
 Computer design

 Opercentcentsentating system: An opercentcentsentating


system, or OS, is a software program that enables the
computer hardware to communicate and
opercentcentsentate with the computer software. Without
a computer opercentcentsentating system, a computer
would be useless.

 Database mgt system : A database management system


(DBMS) is software that organizes the storage of data. It
controls the creation, maintenance, and use of the database
storage stuctures of an organization and its end users.

 Statistical analysis package:


Qno.4> elaborate the concept of “algorithm complexity”
and complexity notation with suitable example?

Ans :- Algorithms: a step by step procedure or instruction for


solving a problem by a computer.

Complexity: the resources required by the algorithms, most commonly


known as the time -- how many steps it needs and the space -- how
much memory it takes.

Algorithms and Complexity comprises the study of computational


models, its inherent power or limitations, and the precise description of
the problems to be solved.

Data structures, graph theory and graph-theoretic algorithms, sorting


and searching, shortest path and such are the building-block problems,
the basic analysis are uppercentcentsent and average complexity
bounds, or the best, average, and worst case behavior. s
Que 5:-Consider the array FIRST NAMEEE
1. FIRST NAMEEE
Mary
Jane
Diana
Susan
Karen
Edith

(1)Write the Algorithm to delete an element from an array and


also delete jane from the array FIRST NAMEEE.

Ans:- . the given array is the linear array. A linear array is a list of a
finite number n of homogeneous data elements the linear array first
nameee is b.

DELETE(b ,n ,kth, item)


Lets the linear array first nameee is b . it has n number of
elements. The k is considered the interger with the assumption
K<=N.the following algo tells us how to delete the element
available on the kth position.
1. Repeat for i=K to n-1
Now Set the b[i]:= b[i+1]
The loop is ended
2. now Set n=n-1
3. now quit.

(2).Write the algo to insert an element in an algorithm and also add


‘ABC’ into the array first nameee
Ans. . this array is also the linear array. This array first nameee is b.
it has n elements and the requirement is that we have to insert any
number on the particular location.. the following algo will help us to
insert the item on the kth location.::::----
• start the counter with setting i=n
• repeat the 3rd and the 4th step while i<=k

• get down the ith element

• set b[i+1]=b[i]

• condition set i=i-1

• now set the b[k]=item

• quit
Qno.6> each std of a class of 30 stds take 6 test in which score
ranges 0 to 100, suppose the test score are stored in 30*6 array
test find the average grade for each test.
Ans.
#include<stdio.h>
#include<conio.h>
Void main()
{
int b[6],i,n;
float percentcentsent=0;
char firstnameee[30];
clrscr();
printf("enter how many stds");
scanf("%d",&n);
for(i=0;i<n;i++)
{

printf("enter the first nameee of the std");


scanf("%s",&firstnameee[i]);
printf("enter the marks);
for(i=0;i<6;i++)
{
scanf("%d",&b[i]);
percentcentsent=(percentcentsent+b[i]/6);
}
printf("Percentcentcentage is %f :",percentcentsent);
if(percentcentsent>=95)
{
printf("Grade:=A+");
}

else
if(percentcentsent>=90&&percentcentsent<95)
{
printf("Grade:=A");
}
else if(percentcentsent>=80&&percentcentsent<90)
{
printf("Grade:=B");
}
else if(percentcentsent>=70&&percentcentsent<80)
{
printf("Grade:=c");
}
else if(percentcentsent>=60&&percentcentsent<70)
{
printf("Grade:=D");
}
else
{
printf("Grade:=E");
}
}
getch();
}
Qno.7 find the final grade for each std where the final grade is
average of the stds five highest test scores?
Ans .. #include<stdio.h>
#include<conio.h>
void main()
{
int subjectject[6],i,n,j,temp;
float percentcent=0;
char first namee[30];
clrscr();
printf(" the no. of stds are");
scanf("%d",&n);
for(i=0;i<n;i++)
{

printf("enter the first namee of the std");


scanf("%s",first namee[i]);
printf("enter the marks ");
for(i=0;i<6;i++)
{
scanf("%d",&subjectject[i]);
}
for(i=0;i<6;i++)
{
for(j=0;j<5;j++)
{
if(subjectject[i]>subjectject[j])
{
temp=subjectject[i];
subjectject[i]=subjectject[j];
subjectject[j]=temp;
}
}
}

for(i=0;i<5;i++)
{
percentcent=(percentcent+subjectject[i]/5);
}

printf(" the Percentcentage is %f :",percentcent);


if(percentcent>=95)
{
printf("Grade:=A+");
}
else if(percentcent>=90&&percentcent<95)
{
printf("Grade:=A");
}
else if(percentcent>=80&&percentcent<90)
{
printf("Grade:=B");
}
else if(percentcent>=70&&percentcent<80)
{
printf("Grade:=c");
}
else if(percentcent>=60&&percentcent<70)
{
printf("Grade:=D");
}
else
{
printf("Grade:=E");
}
}
getch();
}
Ques 8:- Write a module which finds the number of stds who have
fails that is whose final grade is less than 60.
Ans:- #include<stdio.h>
#include<conio.h>
void main()
{
int subject[6],i,n,j,temp,fails=0;
float percent=0;
char first name[30];
clrscr();
printf(" the no. of stds");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the first name");
scanf("%s",first namee[i]);
printf("enter the marks “);
for(i=0;i<6;i++)
{
scanf("%d",&subject[i]);
}
for(i=0;i<6;i++)
{
for(j=0;j<5;j++)
{
if(subject[i]>subject[j])
{
temp=subject[i];
subject[i]=subject[j];
subject[j]=temp;
}
}
}

for(i=0;i<5;i++)
{
percent=(percent+subject[i]/5);
}

printf("Percent %f :",percent);
if(percent>=95)
{
printf("Grade:=A+");
}

else if(percent>=90&&percent<95)
{
printf("Grade:=A");
}
else if(percent>=80&&percent<90)
{
printf("Grade:=B");
}
else if(percent>=70&&percent<80)
{
printf("Grade:=c");
}
else if(percent>=60&&percent<70)
{
printf("Grade:=D");
}
else
{
printf("Grade:=E");
fails++;
}

}
printf("\n the fails are %d",fails);
getch();
}
Ques 9:-: Find the average of final grades
Ans;-
#include<stdio.h>
#include<conio.h>
void main()
{
int subject[6],i,n,j,temp,fails=0;
float percent=0;
char first name[30];
clrscr();
printf("enter the no. of stds");
scanf("%d",&n);
for(i=0;i<n;i++)
{

printf("enter the first namee");


scanf("%s",first name[i]);
printf("enter the marks of 6 for subjectjects for %s ",first
name[i]);
for(i=0;i<6;i++)
{
scanf("%d",&subject[i]);
}
for(i=0;i<6;i++)
{
for(j=0;j<5;j++)
{
if(subject[i]>subject[j])
{
temp=subject[i];
subject[i]=subject[j];
subject[j]=temp;
}
}
}

for(i=0;i<5;i++)
{
percent=(percent+subject[i]/5);
}

printf("Percentcentage is %f :",percent);
if(percent>=95)
{
printf("Grade:=A+");
A1++
}

else if(percent>=90&&percent<95)
{
printf("Grade:=A");
A++
}
else if(percent>=80&&percent<90)
{
printf("Grade:=B");
B++
}
else if(percent>=70&&percent<80)
{
printf("Grade:=c");
C++
}
else if(percent>=60&&percent<70)
{
printf("Grade:=D");
D++
}
else
{
printf("Grade:=E");
fails++;
}

}
printf("\the failsures are %d",fails);
getch();
}

You might also like