# Introduction to Data Structures and Algorithms

## Introduction to Data Structures and Algorithms

###### Why Data Structures ?
• They help to manage and save the data in a structured form.
• Data Structures(DS) help to organization of data needed to solve the problem.
• DS make code cleaner and easier to understand.
• They make a difference between “OK” program and “OUTSTANDING” program
##### Definition Of Data Structure

A data structure is a way of “organizing data” so that it can be “used effectively“. Here we used two terms organizing data and used effectively the meaning of these terms is “relationship among different available data items (like int, float, array, etc ) to along with a set of operation (like Traverse, Insertion, Deletion, Search, Update) which can be performed on it”.So we can say

Data Structure = Available Data + Valid Operation on them

### Choosing the best data structure

Choosing the best data structure and algorithm is a very important part of any programming. Suppose that you are a Data Science student and you have to write a code to traverse the huge amount of data. If you not choosing the best data structure than it will take five-to-six hours to one day but if you choose the best data structure than it will traverse in five-to-six minutes.

For example  :

• Suppose you have to solve a problem where first come and first serve system is used at that particular type, QUEUE type data structure is most suitable
• Some times you have to address the last element to give first priority first in this situation STACK type data structure is good for you.
• Suppose you are working on transportation type project problem  than you have preferred to use GRAPH type data structure
• #### Primitive Data Type

• Primitive data types are the data types available in most programming languages.
• These data types are used to represent single values.
• It is a basic data type available in most programming languages.

#### Non-Primitive Data Type

• Data types derived from primary data types are known as Non-Primitive data types.
• Non-Primitive data types are used to store groups of values.
• Liner  Data Type is also known as sequential Data Type
• Non-Linear Data Type  is also known as random Data Type

# Graph

###### Common and Basic Operation of Data Structure
• Traverse − print all the elements one by one.

• Insertion − Adds an element.

• Deletion − Deletes an element.

• Search − Searches an element.

• Update − Updates an element.

Allowed operations are used to related data one by one.

No single data structure works admirably for all reasons & purposes, and so it is important to know the ability, and restrictions & limitations of several of them.

##### Algorithms

Find a method or steps that will help you get your work done, we call this method “Algorithm”.

In simple terms, Algorithm is a step-by-step process followed to do/accomplish any task.

An algorithm is a set of well-designed, step-by-step instructions designed to solve a problem or perform a specific task.

An algorithm is not the complete code or program, it is just the core logic(solution) of a problem, which can be expressed either as an informal high-level description as pseudocode or using a flowchart.

## Categories of algorithms

From the data structure point of view, the following are some important categories of algorithms,

• Search − Algorithm to search an item in a data structure.
• Sort − Algorithm to sort items in a certain order.
• Insert − Algorithm to insert items in a data structure.
• Update − Algorithm to update an existing item in a data structure.
• Delete − Algorithm to delete an existing item from a data structure.

## Characteristics of an Algorithm

Not all procedures can be called an algorithm. An algorithm should have the following characteristics:

• Input: An algorithm has some input values. We can pass 0 or some input value to an algorithm.
• Output: We will get one or more outputs at the end of an algorithm.
• Unambiguity: An algorithm should be unambiguous which means that the instructions in an algorithm should be clear and simple.
• Finiteness: Algorithms must terminate after a finite number of steps.
• Effectiveness: An algorithm should be effective with the available resources.
• Language independent: An algorithm must be language-independent so that the instructions in an algorithm can be implemented in any of the languages with the same output.
PYQ of History UGC NET UGC NET Mathematical Reasoning and Aptitude ICT (Digital Initiatives) | UGC NET | paper – 1 The Scope of Information and Communication Technology(ICT) PYQ of People, Development, and Environment Top 30 PYQ of HINDI | UGC NET – 2023 Top 30 PYQ of Teaching Aptitude PYQ of Research Aptitude | NTA UGC NET | Paper 1 | Part 1 UGC NET Paper 1 Syllabus | Updated | 2023 Types of Research | Research Aptitude | nta ugc net | UGC NET 2023