What are the Data structure and algorithm?

What are data and information?

Data- known facts that can be recorded and have an implicant meaning

Information- once data is analyzed it is considered information

What is a data structure?

The data structure is a way to store the data in computer memory

It is easy to access, insert, and delete data

Example: array, stack, ques, etc

Also, the arrangement of data in computers memory by the logical or mathematical model of a particular organization of data is called a data structure

Types of data structure

Data structure and algorithm
types of data structure

why do we need data structure?

To manage a very large amount of data high speed processing is required, but day-by-day data increases billions of files per entity processor may fail to deal with that much amount of data

Many users are searching the data simultaneously on a web server, so there are chances that a very large server can fail during the process. To solve this problem data structure is used. It serves only the data that you want instead of checking all data

Data structure and algorithm
data structure

Linear data – linear data are arranged sequentially

Array- fixed size

Collection of items stored at the contiguous memory location. The same type of multiple items is stored together. By simply adding an offset to a base value it is easy to calculate the position of each element

Linked list- variable size

This item is not located at a contiguous memory location. This element is linked with pointers

Stack- add to top remove from top

Queues- add to back and remove from front

Non-linear – non-linear data are not arranged in a sequential manner

Hash table- hash function is used to insert and delete an unordered list Tree- data is organized into branches

Also Read- How to convert number system into digital numbers

Operation on data structure

Traversing – traversing means checking each element in the data structure to perform some specific operations searching or sorting

Insertion- insertion means adding any element to a data structure at any location

Deletion- deletion means to delete or remove any element from a data structure at a random location

Searching- finding a location of an element in the data structure is called searching. We can search by two methods linear search and binary search

Sorting- arranging data structure in a specific order is known as sorting.

Algorithm

The algorithm is a set of instructions, we can use any language and symbols to represent instruction

Algorithm complexity is a measure that evaluates the order of the count of operations

Complexities of algorithm

Constant =o(1)

Constant number of operations, not dependent on input and output

  • Logarithm =O(log n)🡪 No. of operations proportional to log n where n is the size of input data,
  • linear= O(n)🡪no. of operations proportional to the input data size,
  • quadratic=: O(n2)🡪No. of operations proportional to the square of the input data size.
  • Cubic= O(n3)🡪 no. of operations proportional to the cube of the size of the input data,

Also Read- BAREBONES OF A PYTHON PROGRAM