Grade 12 Exam  >  Grade 12 Notes  >  Computer Science for Grade 12  >  Detailed Notes: Data Structure

Detailed Notes: Data Structure | Computer Science for Grade 12 PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


Data-structures
It a way of organizing and storing data in such a manner so that it can be accessed
and work over it can be done efficiently and less resources are required. It define the
relationship between the data and the operations over those data. There are many
various types of data structures defined that make it easier for the computer
programmer,to concentrate on the main problems rather than getting lost in the
details of data description and access.
Python Data Structure
Page 2


Data-structures
It a way of organizing and storing data in such a manner so that it can be accessed
and work over it can be done efficiently and less resources are required. It define the
relationship between the data and the operations over those data. There are many
various types of data structures defined that make it easier for the computer
programmer,to concentrate on the main problems rather than getting lost in the
details of data description and access.
Python Data Structure
List
It is a collections of items and each item has its own index value.
Index of first item is 0 and the last item is n-1.Here n is number of items in a list.
Indexing of list
Creating a list
Lists are enclosed in square brackets [ ] and each item is separated by a comma.
e.g.
list1 = [‘Eng li sh', ‘Hindi', 1997, 2000];
list2 = [11, 22, 33, 44, 55 ];
list3 = ["a", "b", "c", "d"];
Data-structures
Page 3


Data-structures
It a way of organizing and storing data in such a manner so that it can be accessed
and work over it can be done efficiently and less resources are required. It define the
relationship between the data and the operations over those data. There are many
various types of data structures defined that make it easier for the computer
programmer,to concentrate on the main problems rather than getting lost in the
details of data description and access.
Python Data Structure
List
It is a collections of items and each item has its own index value.
Index of first item is 0 and the last item is n-1.Here n is number of items in a list.
Indexing of list
Creating a list
Lists are enclosed in square brackets [ ] and each item is separated by a comma.
e.g.
list1 = [‘Eng li sh', ‘Hindi', 1997, 2000];
list2 = [11, 22, 33, 44, 55 ];
list3 = ["a", "b", "c", "d"];
Data-structures
Access Items From A List
List items can be accessed using its index position.
e.g.
list =[3,5,9]
print(list[0])
print(list[1])
print(list[2]) output
print('Negative indexing')
print(list[-1])
print(list[-2])
print(list[-3])
3
5
9
Negative indexing
9
5
3
Data-structures
Page 4


Data-structures
It a way of organizing and storing data in such a manner so that it can be accessed
and work over it can be done efficiently and less resources are required. It define the
relationship between the data and the operations over those data. There are many
various types of data structures defined that make it easier for the computer
programmer,to concentrate on the main problems rather than getting lost in the
details of data description and access.
Python Data Structure
List
It is a collections of items and each item has its own index value.
Index of first item is 0 and the last item is n-1.Here n is number of items in a list.
Indexing of list
Creating a list
Lists are enclosed in square brackets [ ] and each item is separated by a comma.
e.g.
list1 = [‘Eng li sh', ‘Hindi', 1997, 2000];
list2 = [11, 22, 33, 44, 55 ];
list3 = ["a", "b", "c", "d"];
Data-structures
Access Items From A List
List items can be accessed using its index position.
e.g.
list =[3,5,9]
print(list[0])
print(list[1])
print(list[2]) output
print('Negative indexing')
print(list[-1])
print(list[-2])
print(list[-3])
3
5
9
Negative indexing
9
5
3
Data-structures
Iterating Through A List
List elements can be accessed using looping statement.
e.g.
list =[3,5,9]
for i in range(0, len(list)):
print(list[i])
Output
3
5
9
Data-structures
Page 5


Data-structures
It a way of organizing and storing data in such a manner so that it can be accessed
and work over it can be done efficiently and less resources are required. It define the
relationship between the data and the operations over those data. There are many
various types of data structures defined that make it easier for the computer
programmer,to concentrate on the main problems rather than getting lost in the
details of data description and access.
Python Data Structure
List
It is a collections of items and each item has its own index value.
Index of first item is 0 and the last item is n-1.Here n is number of items in a list.
Indexing of list
Creating a list
Lists are enclosed in square brackets [ ] and each item is separated by a comma.
e.g.
list1 = [‘Eng li sh', ‘Hindi', 1997, 2000];
list2 = [11, 22, 33, 44, 55 ];
list3 = ["a", "b", "c", "d"];
Data-structures
Access Items From A List
List items can be accessed using its index position.
e.g.
list =[3,5,9]
print(list[0])
print(list[1])
print(list[2]) output
print('Negative indexing')
print(list[-1])
print(list[-2])
print(list[-3])
3
5
9
Negative indexing
9
5
3
Data-structures
Iterating Through A List
List elements can be accessed using looping statement.
e.g.
list =[3,5,9]
for i in range(0, len(list)):
print(list[i])
Output
3
5
9
Data-structures
Important methods and functions of List
For detail on list click here
Function Description
list.append() Add an Item at end of a list
list.extend() Add multiple Items at end of a list
list.insert() insert an Item at a defined index
list.remove() remove an Item from a list
del list[index] Delete an Item from a list
list.clear() empty all the list
list.pop() Remove an Item at a defined index
list.index() Return index of first matched item
list.sort() Sort the items of a list in ascending or descending order
list.reverse() Reverse the items of a list
len(list) Return total length of the list.
max(list) Return item with maximum value in the list.
min(list) Return item with min value in the list.
list(seq) Converts a tuple, string, set, dictionary into list.
Data-structures
Read More
1 videos|25 docs|18 tests

Top Courses for Grade 12

1 videos|25 docs|18 tests
Download as PDF
Explore Courses for Grade 12 exam

Top Courses for Grade 12

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Detailed Notes: Data Structure | Computer Science for Grade 12

,

Important questions

,

pdf

,

Detailed Notes: Data Structure | Computer Science for Grade 12

,

MCQs

,

shortcuts and tricks

,

practice quizzes

,

video lectures

,

Previous Year Questions with Solutions

,

Detailed Notes: Data Structure | Computer Science for Grade 12

,

Viva Questions

,

Exam

,

ppt

,

Summary

,

Extra Questions

,

Semester Notes

,

past year papers

,

Free

,

study material

,

Sample Paper

,

Objective type Questions

,

mock tests for examination

;