Content



DATA & FILE STRUCTURE

DATA STRUCTURE

Data structure reffer to a way to organizing or assembling of data

i.e- data structure is logical and mathematical model of organization of data.

In other word : - data structure is Structural representation of data items in primary memory to do storage & retrieval operations efficiently.

We can organize this data as a record like Player record. Now we can collect and store player's records in a file or database as a data structure. For example: "Dhoni" 33, "sania" 30, "virat" 26

Data structure can also be viewed as a collection of data elements whose organization is characterized by the accessing function. The accessing functions are used to store and access individual data items. For example :- suppose data is organize as an array A of 50 elements as

C[0], C[1], C[2],.........C[m-1],...... C[49]

Here accessing function ia C and the elements are stored and accessed by using the function C[m-1] which is the m-th elements of the array.

FILE STRUCTURE

A file is a collection of data stored on mass storage (e.g., disk or tape)

Data structure reffer to a way to organizing or assembling of file

File structure
BUILT IN DATA STRUCTURE

Built in data structure are those data structure , which is internally provided by the high level languages like C, C++, JAVA , PASCAL etc.

Built in data structure are formed with the help of primary data type such as integer , character, float etc.

1) ARRAY

Array is a finite set of Homogeneous elements such that each elements can be identified by a set of n consecutive elements like 1,2,3,4,........n.

Here Finite means numbers are countable and

Homogeneous means same type of elements like students of class or bike car, bus ,truck all are similar type of elements means all comes under class vehicle .

The elements of an array a may be denoted by the subscript notation

A1, A2, A3,…, An

or by the parentheses notation ( used in FORTRAN, PL/1 and BASIC)

A(1), A(2), A(3),…, A(N)

or by the bracket notation (used in Pascal)

A[1], A[2], A[3],…, A[N]

We will usually use the subscript notation or the bracket notation. Regardless of the notation, the number K in A [K] is called a subscript or an index and A [k] is called a subscripted variable. Note that subscripts allow any element of A to be referenced by its relative position in A.

2) STRUCTURE

A structure is a user defined data type

The data type used to group a number of data items together to form a single entity is known as Structure

These Data items need not be of same type.

Thus we can see the structure can have one or more integer field Real or Character field

In structure, the program begins with a structure definition. The key word "struct" is followed by some simple variables between the braces, which are the components of the structure.

for eg.

struct {
   char initial;    /* last name initial      */
   int age;         /* childs age             */
   int grade;       /* childs grade in school */
   } 
  
For Share :-