TRAVERSING
CS, IP
MEANING OF DATA STRUCTURE
Data structures are a specific way
of organizing data in a specialized
format on a computer so that the
information can be organized,
processed, stored, and retrieved
quickly and effectively.
A way of organizing data so it can be
used efficiently
.
TYPES OF DATA STRUCTURE
LINEAR DATA STRUCTURE
SEQUENCE MAPPING
- STRING - DICTIONARY
- LIST - SET
- TUPLE
MEANING OF TRAVERSING
Traversing a data structure
means: "visiting" or "touching" the
elements of the structure, and doing
something with the data. (Traversing
is also sometimes called iterating
over the data structure)
TEXT = “RAMJAS SCHOOL” LST = [88,5,42,11,29,67]
ALL ARE
TRAVERSED
USING ITERATION
PROCESS (FOR
LOOP OR WHILE
LOOP)
TUP = (1,90,17,38,44) DI = {“RNO”:1,”MARKS”:450}
TRAVERSING IN STRINGS
var1="Information"
#method one
for ch in var1:
print(ch)
#method two
for index in range(len(var1)):
print(var1[index])
+ 0 1 2 3 4 5 6 7 8 9 10
I n f o r m a t i o n
- -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1
TRAVERSING by VALUES/ELEMENTS
TRAVERSING by Index Numbers