Page Contents

## What is Data Structure?

In simple term we can define data structure as, Data Structure is a way of organizing the data elements in memory so that we can efficiently retrieve it and perform any operation efficiently.

Now, before moving forward on next topics lets have a eyes over the syllabus of data structure which questions and answers you will find on this website on other page.

## Data Type

It describes which type of value can be stored by a variable. suppose if a variable has int data type it means that that variable can only hold the integer values.

**It is of two types:-**

1). Primitive data type

2). non-primitive data type

For more detail, you may refer below URL.

Now let’s move on the next topics “Algorithm”

**An algorithm** is a finite steps solution of a problem in a human-readable format. Every algorithm has some space and time complexity which denotes how much an algorithm is efficient.

**Five asymptotic notations** are Big-Oh notation, Omega notation, Theta notation, little O and little omega to measure the efficiency.

I hope you got a little bit idea of an Algorithm.

## Array and Linked List

**An array** is a collection of similar type of elements which is stored in contiguous memory locations. A here similar type of element means each element have the same data type.

We can denote it as

**int arr[] ;**

Means arr is an array in which we can only assign integer type of elements.

**An array is Basically of two types:**

1). One dimensional or single dimensional array

2). Multidimensional Array

**Representation of an Array:**

We can represent array in two ways

**1). Row Major Order**

**LOC (A [i, j]) = base_address + W [M (i) + j]** Here,

**base_address =** address of the first element in the array.

**W =** Word size means a number of bytes occupied by each element of an Array.

**N =** Number of rows in the array.

**M =** Number of columns in the array.

**2). Column Major Order**

**LOC (A [i, j]) = base_address + W [N (j) + (i)]**

Here,

**base_address =** address of the first element in the array.

**W =** Word size means a number of bytes occupied by each element of an Array.

**N =** Number of rows in the array.

**M =** Number of columns in the array.

### Linked List

Linked List is a linear and dynamic data structure. It stores elements at non-contiguous memory locations.

**Linked List is of different types:**

1). Singly Linked List

2). Doubly Linked List

3). Circular Linked List

We have seen some basics of Array and Linked List

## Searching and Sorting

**Searching: **It is an operation to find a particular element in a list or in array.

**Types of searching**

- Linear Search
- Binary Search
- Hash Search
- Binary Tree Search

**Sorting:** It is also an operation on elements of an array or linked list to arrange it either in ascending or descending order.

**Types Of Sorting**

- Insertion Sort
- Bubble Sort
- Selection Sort
- Quick Sort
- Merge Sort
- Heap Sort
- Radix Sort

I think we can wrap up here. For more detail you can follow given link

## Graph and Tree

**Graph :** A Graph is a non-linear and abstract data structure which consist of nodes and edges. A single edge connects two Vertices in graph.

We Can **Traverse** the node of graph by using **two algorithms**

- BFS ( Breadth First Search)
- DFS (Depth First Search)

**Tree :** Tree is also a non-linear data structure that consists node which is connected using edge. But in tree all node are arrange as root node, parent node and child node in hierarchical manner.

**Minimum cost spanning tree : **It is a subset of tree and graph in which sum of the weight to traverse each node is minimum. A tree has many number of spanning tree but not all are minimum spanning tree.

There are some **algorithm to identify minimum spanning tree**.

- Prim’s Algorithm
- Kruskal’s Algorithm

## Stack and Queue

**Stack: **Stack is an abstract data type which follow the LIFO ( Last In First Out) Principle.

We can perform only **two operation on stack**

1). PUSH

2). POP

Stacks are used to evaluate post-fix expression.

**Recursion : **Recursion is a process in which one function calls it self again and again for a finite time to solve a given problem.

**Queue:** Queue is also a abstract data type which follow FIFO(First In First Out Principle).

**2 Operations can be performed on Queue**

1). enqueue

2). dequeue

Enqueue means put elements in queue and dequeue means remove it from queue.

For more details and semester question answers please follow the given link.