DS Assignment 3rd Sem IPU
DS Assignment 3rd Sem IPU
Assignment No. 1
Course Code : ETCS 211 M.M. 20
CourseTitle : Data Structures Lab Due Date: 14/08/10
Q1. A two – dimensional array A [5][4] is stored a row – wise in the memory. The first
element of the array is stored at location 80. Find the memory location of A [3][2] if
the each elements of array requires 4 memory locations.
Q2. A two – dimensional array defined as A [4…7, -1…3] requires 2 bytes of storage
space for each element. If the array is stored in row-major order, then calculate the
address of element at location A [6,2]. Given that the base address is 100.
Q3. A two – dimensional array defined as A [-20…20, 10…35] requires one byte of
storage space for each element. If the array is stored in column -major order, then
calculate the address of element at location A [0, 30]. Given that the base address is
500.
Q4. Write a program to read and write array and copy the contents of array a in array B in
reverse order then find sum of array a and array b and store it in array C.
Q8. Write the algorithms for implementing the following operation depending on whether
the operation requires one or two matrices
Q1.
(a) What are two main factors for measuring the performance of
algorithm? Explain in brief.
(b) Discuss the tradeoff in between the time and space complexity of a
program.
Q2.
(a) What is sparse matrix? How sparse matrix can be represented in
memory in two different ways?
(b) What is priority queue? How priority queue can be represented in
memory in two different ways?
Q3.
(a) Write an algorithm/program to delete a node with value X from a
singly linked list.
(b) Write a program to reverse a singly linked list without using any more
memory.
Q4.
(a) Write an algorithm/program to create a doubly linked list and traverse
each node in both directions (from start to end and end to start).
(b) Write an algorithm/program for inserting a node at a given location in
circular linked list.
Q5. Write a procedure for multiplication of two polynomials with the help of
an example.
Ansal Institute of Technology, Gurgaon
Assignment No. III
Course Code : ETCS 211 M.M. 20
CourseTitle : Data Structures Due Date: 10/09/10
Q2. Convert the following infix expressions into postfix using stack
(i) A ^ B * C – D + E / F / (G + H)
(ii) A + (B * C – ( D / E ^ F ) * G ) * H
Q4. Construction of the tree from its given preorder and inorder traversal
Preorder: A B D E F C G H J L K
Inorder: D B F E A G C L J H K
Q5. Construction of the tree from its given postorder and inorder traversal
Postorder: D F E B G L J K H C A
Inorder: D B F E A G C L J H K
Q6. Construction of the tree from its given preorder and postorder traversal
Preorder: A B D G H K C E F
Postorder: G K H D B E F C A
Ansal Institute of Technology, Gurgaon
Assignment No. IV
Course Code : ETCS 211 M.M. 20
CourseTitle : Data Structures Due Date: 18/10/10
Q1.
Q2.
Q3.(a) Write a function or algorithm that will delete a node from a binary search tree.
(b) Write a function or algorithm that will insert a node in a binary search tree.
Q4. Explain various traversal techniques of a binary tree. Suppose, following traversed
sequences of a binary tree are given:
(a) Pre-order: 1, 2, 3, 4, 5, 6, 7, 8, 9
In-order: 2, 3, 1, 5, 4, 7, 8, 6, 9
(b) Pre-order: A, B, D, G, C, E, H, I, F
In-order: D, G, B, A, H, E, I, C, F