For understanding data structures in a simple and better way, consider the following real life example.
Brooke Burke, the sports teacher likes to take her 100 students for a trek during holidays. For that, she has to provide a lot of guidelines and information about the ongoing camp. Also, she may have to give separate instructions to each and everyone. How can Miss. Burke organize the students such that she could reach any student from any other student in as short time as possible.
Prerequisites: All 100 students are given numbers from 1 to 100. The distance between two nearest students is 1 meter.
Assignments: Find out the approximate distance and time taken for Miss. Burke to travel between two farthest students in each of the following organizations.
Case I)
All the 100 students stand in a straight line. Miss. Burke is represented as a white filled circle.
Case II)
All the 100 students stand in a circle sufficient to fit 100.
For a regular polygon of n sides and l sidelength, the largest diagonal d is given by:
Case III)
All the 100 students stand in a matrix of dimensions 10-by-10.
Case IV)
First 25 students stand in a circle sufficent to fit 25. Behind each of the 25 students, three students will be standing not maintaining a distance of 1 meter between each.
Implications to Computer Science:
-> The organization of data in a program/algorithm is similar to the organization of students described above. When we think of different methods of storing/organizing data, the efficiency of its access increases and the understandability becomes better.
-> The efficiency class of a program does not depend only on algorithms but also on data structures. If better data structures are used, the program will have a better efficiency class.
-> The data structures are chosen not with the sole aim of efficiency but also factors like re-usability, generality, flexibility, simplicity etc...
No comments:
Post a Comment