0% found this document useful (0 votes)
7 views3 pages

Detailed Operating Systems Module1 Summary

The document covers basic concepts of data structures in C, including array declaration, typedef structures, sparse matrices, garbage collection, and linked lists. It also discusses abstract data types (ADT) for linear arrays, searching methods (linear and binary), and provides a binary search algorithm. Additionally, it highlights stack applications and demonstrates the conversion of an infix expression to postfix notation.

Uploaded by

yushaoffline
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)
7 views3 pages

Detailed Operating Systems Module1 Summary

The document covers basic concepts of data structures in C, including array declaration, typedef structures, sparse matrices, garbage collection, and linked lists. It also discusses abstract data types (ADT) for linear arrays, searching methods (linear and binary), and provides a binary search algorithm. Additionally, it highlights stack applications and demonstrates the conversion of an infix expression to postfix notation.

Uploaded by

yushaoffline
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

Data Structures - C Language Basics

PART-A (S*2=10 Marks)

1. Write the syntax for declaring the array.

Answer: Syntax for declaring an array in C:

```c

data_type array_name[array_size];

```

2. What is Type defined structures?

Answer: A typedef structure in C allows you to define a structure with a new name using the

`typedef` keyword.

```c

typedef struct {

int x;

int y;

} Point;

```

3. What is Sparse matrices?

Answer: Sparse matrices are matrices in which most of the elements are zero. They are stored

using special techniques to save memory.

4. What is garbage collection?

Answer: Garbage collection is the process of automatically freeing memory that is no longer in use
by the program, preventing memory leaks.

5. What is a linked list?

Answer: A linked list is a linear data structure where each element is a separate object (called a

node) linked to the next element.

PART-B (4*10=40 Marks)

_Module-1:_

1. a. Write the ADT of the linear array.

Answer: The Abstract Data Type (ADT) of a linear array defines operations such as retrieval,

update, insertion, and deletion.

2. b. What is searching? Explain the types of searching.

Answer: Searching refers to the process of finding a specific element in a data structure. Types

include:

- Linear Search: Traverse the array sequentially.

- Binary Search: Divide the array and search in a sorted array.

3. Write the binary search algorithm.

Answer: Binary search algorithm for sorted arrays:

```c

int binarySearch(int arr[], int left, int right, int key) {

while (left <= right) {

int mid = left + (right - left) / 2;

if (arr[mid] == key)
return mid;

if (arr[mid] < key)

left = mid + 1;

else

right = mid - 1;

return -1;

```

_Module-2:_

1. a. Explain the applications of stack.

Answer: Stack applications include:

- Expression evaluation (postfix, prefix)

- Backtracking algorithms

- Undo functionality in text editors

2. b. Convert the following Infix expression to postfix.

Answer: Example infix expression: `A + B * (C - D)`

Postfix expression: `A B C D - * +`

You might also like