Documente Academic
Documente Profesional
Documente Cultură
STRUCTURES
MAHESH GOYANI
MAHATMA GANDHI INSTITUE OF TECHNICAL EDUCATION & RESEARCH CENTER
mgoyani@rediffmail.com
Two Methods:
(i). TOP – DOWN Methodology (eg. C, C++ Programming)
(ii). BOTTOM – UP Methodology (eg. VB Project implementation)
Main
Functions called
Functions called By Function 1 Functions called By Function 3
By Function 1
VECTOR
ii. 2-D Array
10 35 52 12 11
iii. M-D Array
12
iv. Sparse Arrays
1-D ordered collection of number
13
i. Row Vector
14
ii. Column Vector
15
11 12 13 14 15
LISTS
A list is an ordered set consisting of a varying
number of elements to which insertion and
deletion can be made
START
CHARECTERISTICS
OF STRING
Fixed length string
Variable length string
Linear list (Linked List)
Data
Structure
Primitive Non-Primitive
Data Structure Data Structure
Garbage Collection
Dangling Reference
Reference Counter
e.g. if memory contain 1024 word than it might be divided in 1 block of 256 words, 2 blocks of 128 words,
4 blocks of 64 words and 8 blocks of 32 words
Buddy system contains several free lists consisting of various sized block.
Block of size i is called i-Block & free list containing i-Block is called i-List.
if request for block size n is made, an i-block is reserved where I is the smallest integer such that n<=2 i
if i-list is not free then bring block from (i+1)-list and divide in to two i-block, one will be used and another
will be added into i-list. Do Recursively.
if an (i+1) –block is divided in two i-block b1 & b2, b1 and b2 are buddies of each other. Block at location
p is called i-Buddy of p. buddies can be more than one but i-buddy can not.
if an i-block is freed and its i-buddy is already freed than two buddies are combined into (i+1) – block.
Free Size 29
Free Size 29
512 512
Free Size 28
Free Size 28
896 896
B1 Allocated Size 27 B1 Allocated Size 27
9:0 9:0
8:512 8:512
7:768 6:768
512 512
Free Size 27
704
B4 Allocated Size 26
832 832
B2 Allocated Size 26 B2 Allocated Size 26
896 896
B1 Allocated Size 27
B1 Allocated Size 27
9:0
9:0
8:512
8:512
7:768
6:768
(C) GOYANI MAHESH 15