DATA STRUCTURE

 What is Data?

Data is the basic fact or entity that is utilized in calculation or manipulation. There are two different types of data Numeric data and alphanumeric data.

What is Data Structure?

Data Structure is a representation of the logical relationship existing between individual elements of data. In other words, a data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.

We can also define data structure as a mathematical or logical model of a particular organization of data items

Data Structure mainly specifies the following four things

Organization of Data

Accessing Methods

Degree of Associativity

Processing alternatives for information


Primitive data structure

Primitive data structure is a data structure that can hold a single value in a specific location whereas the non - linear data structure can hold multiple values either in a contiguous location or random locations

The examples of primitive data structure are float , character , integer and pointer .

Non-primitive data structure

The non - primitive data structure is a kind of data structure that can hold multiple values either in a contiguous or random location . The non - primitive data types are defined by the programmer . Examples Arrays , Lists , Files.

The non - primitive data structure is further classified into two categories .

i.e. , linear and non - linear data structure .

Linear Data structure

A data structure is said to be Linear , if its elements are connected in linear fashion by means of logically or in sequence

memory locations

Examples of Linear Data Structure are Stack and Queue 

Non-Linear Data Structure

A non-linear data structure is another important type in which data elements are not arranged sequentially; mainly, data elements are arranged in random order without forming a linear structure.

Data elements are present at the multilevel, for example, tree,Graph.

 

 Operation in Data Structure

Traversing: Every data structure contains the set of data elements. Traversing the data structure means visiting each element of the data structure in order to perform some specific operation like searching or sorting.

Insertion: Insertion can be defined as the process of adding the elements to the data structure at any location.

Deletion:The process of removing an element from the data structure is called Deletion. We can delete an element from the data structure at any random location.

Searching: The process of finding the location of an element within the data structure is called Searching. There are two algorithms to perform searching, Linear Search and Binary Search. We will discuss each one of them later in this tutorial.

Sorting: The process of arranging the data structure in a specific order is known as Sorting. There are many algorithms that can be used to perform sorting, for example, insertion sort, selection sort, bubble sort, etc.

Merging: When two lists List A and List B of size M and N respectively, of similar type of elements, are clubbed or joined to produce the third list, List C of size (M+N), then this process is called merging.

 Time and space analysis of algorithms

Time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the length of the input

Space complexity of an algorithm quantifies the amount of space or memory taken by an algorithm to run as a function of the length of the input

Asymptotic Analysis.

Usually the time required by an algorithm comes under three types:

Worst case or(Big oh Notation (Ο)): It defines the input for which the algorithm takes the huge time.

Average case or(Omega Notation (Ω)): It takes average time for the program execution.

Best caseor(Theta Notation (θ)): It defines the input for which the algorithm takes the lowest time.

 

Comments