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

DSA Assignment 1

Uploaded by

dontmailmehere16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

DSA Assignment 1

Uploaded by

dontmailmehere16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 1

DSE2101: Data Structuers & Algorithms

Instructions:

• All the students need to mention their name and reg.no at the end of each page of assignment.
• You all need to write the assignment on A4 sheet only.
• Last date to submit the assignment is 10th October 2024 by 4 PM.

1. Define data structure. List the various linear and non-linear data structures and explain them in brief.

2. Calculate the following:-

(a) Given a two dimensional array A1(1:8, 7:14) stored in row-major order with base address 100 and size
of each element is 4 bytes, find address of the element A1(4, 12).

(b) Given a two dimensional array Z1(2:9, 9:18) stored in column-major order with base address 100 and
size of each element is 4 bytes, find address of the element Z1(4, 12).

3. Differentiate peek() and pop() functions.

4. Convert the infix expression, ((a/(b-c+d))*(e-a)*c) to postfix expression. Write a function to evaluate that
postfix expression and trace for the given data a=6, b=3, c=1, d=2, e=4.

5. Write an algorithm/C Function to implement Selection Sort Method.

6. State the advantages of circular and doubly linked lists over a singly linked list.

7. Write a C language program to concatenate two doubly linked lists.

8. Write a C program for :- Implement Queue using two stacks.

9. Write a C program for mentioned problem: - Given an array nums with n objects colored red, white, or
blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red,
white, and blue.

10. Write a C program for :- Given an integer array nums sorted in non-decreasing order, remove some
duplicates in-place such that each unique element appears at most twice. The relative order of the elements
should be kept the same.

11. Define Time complexity and Space complexity. Calculate time complexity for given expression.

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


{
rows[k] = 0;
for(j=0; j<n; j++)
{
rows[k] = rows[k] + matrix[k][j];
total = total + matrix[k][j];
}
}

12. Convert the given infix expression to postfix expression.

1) A + ( (B – C) * (D – E) + F) / G )
$ (H – J)
2) (A + B) * (C – D) $ E * F
3) (A + B) * (C ^ (D – E) + F) – G
4) A + B * C
5) A + B * C ^ D – E
6) A + [(B +C) + (D + E) * F] / G
7) (A + B) * C / D + E ^ F /G
8) (A + B) * C / D
9) ((A + B – C / D) / E)
10) A / (B – C / D ^ E) + F

13. Evaluate the following expressions.

1) 5 + 4 * 2
2) 4 + 2 * 5 ^ 2 + 9 / 3 – 1 * 8
3) 40 25 + 20 5 * 3 + *
4) 9 + 5 * 7 – 6 ^ 2 + 9 / 3
5) 8 * 2 -1 + 7 * 5

14. Write down a C program to implement Circular Queue Using Linked List.

You might also like