0% found this document useful (0 votes)
251 views5 pages

AKTU Data Structures BCS 301 Fixed

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)
251 views5 pages

AKTU Data Structures BCS 301 Fixed

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/ 5

AKTU Data Structures (BCS 301) - Comprehensive Guide

### AKTU Data Structures (BCS 301)

#### UNIT 1: Basic Terminology & Concepts

**1. Basic Terminology**

- **Data**: Information stored and processed by computers.

- **Data Structure**: A particular way of organizing and storing data in a computer.

- **Algorithm**: A step-by-step procedure to solve a problem.

- **Efficiency**: Measured by the time complexity (execution time) and space complexity (memory usage) of an

algorithm.

**2. Elementary Data Organization**

- Data can be organized linearly (arrays, linked lists) or non-linearly (trees, graphs).

**3. Built-in Data Types in C**

- **int, char, float, double**: Examples of primitive data types in C programming.

**4. Time Complexity and Space Complexity**

- **Time Complexity**: Measure of the computational time an algorithm takes.

- Example: Binary search has a time complexity of O(log n).

- **Space Complexity**: Memory required by the algorithm.

- Example: Merge sort has additional space complexity of O(n).

**5. Asymptotic Notations**

- **Big O**: Upper bound (worst case).


AKTU Data Structures (BCS 301) - Comprehensive Guide

- **Big Theta**: Tight bound (average case).

- **Big Omega**: Lower bound (best case).

**Example Question:** Define and explain time and space complexity with examples.

**Answer:** Time complexity measures the time an algorithm takes as a function of input size. Space complexity

measures the memory usage. For instance, binary search is O(log n) in time and O(1) in space.

#### UNIT 2: Stacks and Queues

**1. Stacks**

- **Definition**: A linear data structure following LIFO (Last In, First Out).

- **Operations**:

- **Push**: Add element.

- **Pop**: Remove element.

- **Peek**: Retrieve the top element.

- **Applications**: Used in expression evaluation, undo mechanisms.

**Example Question:** Explain stack operations with algorithms.

**Answer:**

```c

void push(int stack[], int *top, int value) {

stack[++(*top)] = value;

int pop(int stack[], int *top) {

return stack[(*top)--];
AKTU Data Structures (BCS 301) - Comprehensive Guide

```

**2. Queues**

- **Definition**: Linear data structure following FIFO (First In, First Out).

- **Types**:

- Circular Queue.

- Priority Queue.

- **Operations**: Add (enqueue), Delete (dequeue).

**Example Question:** Write algorithms for enqueue and dequeue operations in a queue.

#### UNIT 3: Searching and Sorting

**1. Searching Techniques**

- **Sequential Search**: Linear traversal.

- **Binary Search**: Divide and conquer.

**2. Sorting Techniques**

- **Bubble Sort**: Repeatedly swap adjacent elements.

- **Quick Sort**: Partition-based recursive sort.

- **Merge Sort**: Divide-and-conquer approach.

**Example Question:** Explain the working of quick sort with an example.

**Answer:**

Quick sort uses partitioning to sort arrays. Example steps:


AKTU Data Structures (BCS 301) - Comprehensive Guide

1. Choose a pivot.

2. Partition the array.

3. Recursively sort subarrays.

#### UNIT 4: Trees

**1. Binary Trees**

- Definitions:

- **Binary Tree**: A tree where each node has at most two children.

- **Binary Search Tree**: Nodes are arranged to support fast lookup.

**2. Traversal Algorithms**:

- **Inorder**: Left, Root, Right.

- **Preorder**: Root, Left, Right.

- **Postorder**: Left, Right, Root.

**Example Question:** Write an algorithm for inorder traversal of a binary tree.

**Answer:**

```c

void inorderTraversal(Node* root) {

if (root) {

inorderTraversal(root->left);

printf("%d ", root->data);

inorderTraversal(root->right);

}
AKTU Data Structures (BCS 301) - Comprehensive Guide

```

#### UNIT 5: Graphs

**1. Representations**

- **Adjacency Matrix**: A 2D array.

- **Adjacency List**: Array of linked lists.

**2. Traversal Algorithms**:

- **DFS**: Depth First Search.

- **BFS**: Breadth First Search.

**Example Question:** Explain BFS with an example.

**Answer:**

Breadth-First Search uses a queue to explore nodes level by level.

---

You might also like