Some Data Structures and Their Representation in Python
Data structure can be defined as the logical or mathematical model of a particular organization of a data. Data structure is used to denote a particular way of organizing data for particular type of operation. Some basic data structures and their interpretation in python are:
1. Array – A linear array is the simplest type
of data structure. A linear array is one dimensional and it is a list of finite
number n of similar data element reference consecutively by a set of n
consecutive numbers a1, a2, a3, …, an. In python an array is a list denoted by
a square bracket ([]) or a keyword list.
|
Student |
|
Paul |
|
Hampo |
|
James |
|
Dorcas |
|
Smith |
In python, it is student = [“Paul”, “Hampo”, “James”,
“Dorcas”, “Smith”]
2. Linked List – this is an array that
is linked with a pointer. It is used in the stead of having a double array. In
python this is called a dictionary. It is a key to value pair.
|
Student |
Admitted By |
|
Paul |
Jane |
|
Hampo |
Petter |
|
James |
Jane |
|
Dorcas |
Jane |
|
Smith |
Petter |
Comments
Post a Comment