Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
67% found this document useful (3 votes)
1K views

Data Structure and Algorithms

The document provides details of an assignment for a data structures and algorithms course. It includes 14 multiple choice questions (Group A) worth 1 mark each and 10 short answer/algorithm questions (Group B) worth 5 marks each. Group B questions cover topics like linked lists, stacks, queues, heaps, sorting algorithms, and expression conversions. Students are asked to write functions, describe abstract data types, provide algorithms, solve problems, and analyze time complexities.

Uploaded by

samir pramanik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
67% found this document useful (3 votes)
1K views

Data Structure and Algorithms

The document provides details of an assignment for a data structures and algorithms course. It includes 14 multiple choice questions (Group A) worth 1 mark each and 10 short answer/algorithm questions (Group B) worth 5 marks each. Group B questions cover topics like linked lists, stacks, queues, heaps, sorting algorithms, and expression conversions. Students are asked to write functions, describe abstract data types, provide algorithms, solve problems, and analyze time complexities.

Uploaded by

samir pramanik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Camellia Institute of Technology

ASSIGNMENT FOR CA3


Stream: CSE Sem.: 3rd AY: 2022-23
Paper Code: PCC-CS301 Paper Name: Data Structure and Algorithms

GROUP A (MCQ) (Each question carries 1 mark)

1. i) Which if the following is/are the levels of implementation of data structure?


A. Abstract level B. Application level C. Implementation level D. All of the above

ii) Array passed as an argument to a function is interpreted as


A. Address of the array B. Values of the first elements of the array
C. Address of the first element of the array D. Number of element of the array

iii) Which of the following data structures are indexed structures?


A. Linear arrays B. Linked lists C. Graphs D. Trees

iv) Which data structure is a pile in which items are added at one end and removed from the other?
A. Stack B. Queue C. List D. None of the above

v) When does top value of the stack changes?


A. Before deletion B. While checking underflow C. At the time of deletion D. After deletion

vi) The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
A. AB + CD*E - FG /** B. AB + CD* E - **FG /
C. AB + CD* E - *FG */ D. AB + CDE * - * F *G /

vii) A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9.The
insertion of next element takes place at the array index.
A. 7 B. 0 C. 9 D. 10
viii) The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
A. 600 B. 350 C. 650 D. 588

ix) What will be the maximum value of top, if there is a size of stack MAXSIZE is 5
A. 5 B. 4 C. 6 D. None of the above

x) Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
a) Insertion Sort b) Quick Sort c) Heap Sort d) Merge Sort

xi) In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?
a) log 2 n b) n⁄2 c) log 2 n – 1 d) n

xi) Linked list are not suitable for


a) Insertion Sort b) Binary Search c) Radix Sort d) Polynomial Manipulation

xii) Inserting a new node after a given node in a doubly linked list requires
a) 2 pointers exchange b) no pointer exchange c) 4 pointers exchange d) 1 pointer exchange

xiii)The complexity of merge sort algorithm is


a) O(n) b) O(n2) c) O(nlogn) d) O(logn)

xiv) The worst case of quick sort algorithm is


a) O(n) b) O(n2) c) O(nlogn) d) O(logn)
GROUP B (Each question carries 5 marks)

2. What is Linked list? What are the advantages and disadvantages of linked list over an array? [2+3]
Ans: A linked list is a linear data structure, in which the elements are not stored at [5]
contiguous memory locations. The elements in a linked list are linked using pointers.
[2+3]
3. Write a C function to insert a node with specified value at the end of a singly linked list.
[4+1]
4. Define the ADT for Stack. Write the algorithm for Push and Pop operation in Stack.
5. Write a C function for selection sort and also calculate the time complexity for selection
sort.
[5]
[2+3]
[1+4]
[5]

6. Convert the following infix expression to postfix notation by showing the operator stack and output string [5]
after
reading each input token:
A * (B + D) / E - F * (G + H / K) ^ X
7. What is queue? What is the advantage of circular queue over queue?
8. What is circular queue? Write Q-insert algorithm for the circular queue.
[5]
9. Insert the following numbers into Max heap and Min heap:
[5]
39, 89 , 12 , 67 , 56 , 43 , 54 , 98 , 6 , 60 , 95 , 26
10. Sort the following array with explanation using quick sort method:
24 , 56 ,47 ,35 ,10 ,90 ,82 ,31, 67, 8, 76
Analyse its time complexity.

11. Convert the following infix expression to postfix expression by showing the operator stack and output string after
reading each input token:
A * B + C * ( D – E) – F / G
12. Write the algorithm and explain Binary Search with a suitable example.
Note: a stack is a particular kind of abstract data type or collection in which the principal (or only) operations on the
collection are the addition of an entity to the collection, known as push and removal of an entity, known as pop. The
relation between the push and pop operations is such that the stack is a Last-In-First-Out (LIFO) data structure. In a
LIFO data structure, the last element added to the structure must be the first one to be removed. This is equivalent to the
requirement that, considered as a linear data structure, or more abstractly a sequential collection, the push and pop
operations occur only at one end of the structure, referred to as the top of the stack.

You might also like