Data Structure Assignment 1
Last Date of submission: Tuesday 6th September 2016
1.
Write a C program to read 10 integers and store them
in an array using pointers. Print their sum and average.
(June 2010)(5 marks)
2.
Write a C function to swap two numbers using a
pointers.
(June 2012)(5 marks)
3.
Write a function that accepts a string and returns 1
is the string is palindrome else 0 if string is not a palindrome without using
any built in functions.
(June 2009)(6 marks)
4. For a given sparse matrix and its transpose, give the triplet
representation using one dimensional array, a is the given sparse matrix, b
will be its transpose.
Write
the fast transpose algorithm for
sparse matrix.
(December 2011)(Dec 2013) (December 2015) (June
2015) (8 marks)
5. Consider
two polynomials A(x) = 2x100 +
1 and B(x) = x4 + 10x3 + 3x2 + 1, show
diagrammatically , how these two polynomials can be stored in single 1D array.
Also give its C representation.
(December 2011) (June 2015) (12
marks)
6. Develop
a structure to represent a planets in the solar system. Each planet has the
field for the planets name, its distance from the sun in miles and the number
of moon it has. Write a program to read the data for each planet and store.
Also print the name of the planet that has the highest number of moons.
(December 2011)(December 2013)(8 marks)
7. Write
a C program with an appropriate structure definition and variable declaration
to store information about an employee using nested structure. Consider the following fields like Ename, Empid,
DOJ(Date, month, year) and Salary ( Basic, DA, HRA).
(June 2012) (December 2014) (12 marks)
8.
Write
a recursive function to implement a binary search.
(December
2011) (December 2015)(08 marks)
9.
Convert
the infix expression to postfix expression and evaluate the same.
a / b – c + d * e – a * c for a=6 b=3 c=1 d=2 e=4 (June 2013) (6 marks)
10.
For
a given circular queue shown in Fig below write the values of front and rear in
the table after each specified operation is performed. Queue full/empty
conditions must be considered. 0-7 indicates the array indices.
(December
2011)(4 marks)