Python Data Structures

Data Structure is the way of organizing the data so that they can be used efficiently. There are 2 types of data structures:

  • 1. Primitive - data structures
  • 2. non- Primitive - data structures.

Premetive data structure:

The premetive data structures can contains single value. int, float, double, char, bool are the premetive types of data structure.

Non-premetive data structure:

The non-premetive data structures can contains multiple values these are classified into 2 types:

  • 1. Linear data structure
  • 2. Non-linear data structure

Linear data structure:

In linear data structure each data items are connected to only one other data item linearly in a sequential manner. There are 4 types of data structures those are linear given below:

  • 1. Array
  • 2. Queue
  • 3. Stack
  • 4. Linked-list

1. Array in python (List):

Internally Lists are implemented as array in python. Lists are versatile data structure so that they can store any type of elements and it is also possible to store different types of data items in a single list. A list is created as an array having references to elements or objects. the problem of using array as list is that all operations may not be done in same amount of time. Generally inserting and deleting elements at the end of the list is faster than doning the same operation in the middle or beginning, since the entire list (i.e., array) elements needs to shift towards right. however, except this minor inconvenience, lists can be used in our program to create Queues, Stacks, and Linked-lists.

Non-linear data structure:

In Non-linear data structure each data items are connected to n number of data items. There are 2 types of data structures considered as Non-linear types, these are:

  • 1. Tree
  • 2. Graph

Major Operations in Data Structures:

Some major operations generally performed in Data Structures are:

  • • Searching: We can search for any element in a data structure.
  • • Sorting: We can sort the elements of a data structure either in an ascending or descending order.
  • • Insertion: We can also insert the new element in a data structure.
  • • Updation: We can also update the element, i.e., we can replace the element with another element.
  • •Deletion: We can also perform the delete operation to remove the element from the data structure.

About the Author

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc