BCA Data Structures Answers
BCA Data Structures Answers
1. Data Structure:
A data structure is a way of organizing and storing data in a computer so that it can be accessed and
modified efficiently.
2. Sorting Techniques:
Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort.
3. Linked List:
A linked list is a linear data structure where each element is a separate object, known as a node, that
4. Stack:
A stack is a linear data structure that follows LIFO (Last-In, First-Out) principle.
Each node contains two fields: data and next. The last node points to NULL.
6. Sparse Matrix:
7. Binary Tree:
A binary tree where the left node has smaller values and the right has larger values.
- Implementing stacks/queues
A queue where each element has a priority and elements with higher priority are dequeued first.
Q13:
a) Linear Search: It checks each element one by one until the target is found.
Q14:
- Dynamic size
- Efficient insertion/deletion
b) Insertion Sort in C:
arr[j+1] = key;
Q15:
a) Bubble Sort in C:
b) Binary Search:
Q16:
a) Applications:
Stacks (function calls), Queues (scheduling), Trees (file systems), Graphs (maps)
int factorial(int n) {
if(n==0) return 1;
return n * factorial(n-1);
Q17:
Q18:
Stack Program:
Q19:
a) Definitions:
Edge - connection
Vertex - node
BCA 2nd Semester - Data Structures (BCA 203)
b) DFS:
Q20:
b) Infix to Postfix:
(a + b) * (m / n) + (x + y)
Postfix: a b + m n / * x y + +