0% found this document useful (0 votes)
69 views

Data Structure Assignment

The document contains 20 questions about data structures and algorithms topics such as binary search trees vs heaps, multi-dimensional arrays, polynomial representation using linked lists, doubly linked lists, circular queues, merge sort, tail recursion, infix to postfix conversion using stacks, sparse matrix representation, iteration vs recursion with Tower of Hanoi example, stack operations, hashing techniques and garbage collection, heap sort vs radix sort, solving expressions, circular linked lists, collision resolution techniques, complexity analysis, dynamic memory allocation, queue operations, and sparse matrix representations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views

Data Structure Assignment

The document contains 20 questions about data structures and algorithms topics such as binary search trees vs heaps, multi-dimensional arrays, polynomial representation using linked lists, doubly linked lists, circular queues, merge sort, tail recursion, infix to postfix conversion using stacks, sparse matrix representation, iteration vs recursion with Tower of Hanoi example, stack operations, hashing techniques and garbage collection, heap sort vs radix sort, solving expressions, circular linked lists, collision resolution techniques, complexity analysis, dynamic memory allocation, queue operations, and sparse matrix representations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SHRI RAM MURTI SMARAK COLLEGE OF ENGG.,TECH.

& RESEARCH, BAREILLY

Data Structure (BCS 301)


Assignment No-2
Submission Date: 04/01/2024 (Thursday)
1) Differentiate between binary search tree and a heap.

2) Assume that the declaration of multi-dimensional arrays X and Y to b,

X(-2:2,2:22) and Y(1:8,-5:5,-10:5)

(i) Find that the length of each dimension and number of elements in X and Y,

(ii) Find the address of element Y(2,2,3), assuming Base address of Y=400 and each element occupies 4 memory

locations.

3) How to represent the polynomial using linked list? Write a C program to add two polynomials using linked list.

4) Discuss doubly linked list. write an algorithm to insert a node after a given node in singly linked list.

5) What is circular Queue? write a C code to insert an element in circular queue?

6) Use the merge sort algorithm to sort the following elements in ascending order

13,16,10, 11,4,12, 6,7

7) Explain Tail recursion with suitable example.

8) Convert the following infix expression to reverse polish notation expression using stack.

9)How can you represent a sparse matrix in memory?

10) (i) Differentiate between iteration and recursion.

(ii) Write the recursion solution for Tower of Hanoi problem.

11) Consider the following infix expression and convert into reverse polish notation using stack

A+(B *C - ( D / E ^ F ) * H)

12) What is Stack. write a C program to reverse a string using stack.

13) (a) Write a short notes on:

(i) hashing Technique

(ii) garbage Collection

(b) Explain the following:

(i) Heap Sort

(ii) radix Sort

14) Solve the following:

((A- ( B + C) * D) / ( E + F))
15) What is meant by circular linked list? write the functions to perform the following operations in a doubly linked
list.

a) Creation of list nodes.

b) Insertion after a specified node.

c) delete the node at a given position.

d) Sort the list according to descending order

e) Display from the beginning to end.

16) Define collision. Discuss the techniques used to resolve collisions during hashing.

17) Write the C-function for the following operations(Consider dynamic implementation):

a) Insertion of a node after a given elements in a linear linked list.

b) Insertion of an element in an ordered linked list (The list contains elements in ascending sequence of
their weights)

18) a)What do you understand by complexity of an algorithms? Compute the worst case complexity for the
following C code:

main()

int s=0,i,j,n;

for (j=0;j<3*n);j++)

for(i=0;i<n; i++)

s=s+i;

printf("%d",j);

}}

b) Write the difference between malloc and calloc functions. Why do we use dynamic memory allocations?

19) Write the procedures for insertion, deletion and traversal of a queue.

20) Explain the upper triangular and lower triangular sparse matrices. Suggest an space efficient representation for
space matrices and determine the address determination formulas for it.

You might also like