Posts

Showing posts from June, 2013

Sorting of Elements Algorithim with explanation and program

ALGORITHM VARIABLES: §   i:     loop counter. §   A:    name of array. §   n:    number of elements of array. §   pass:     for passing the value. ALGORITHM: STEP 1:    repeat step 2 & 3                  For pass 1 to (n-1) STEP 2:    i = 1 STEP 3:    repeat while                  i <= n-pass                  (a) if a [i]>a[i+1] then,                  interchange a[i] & a[i+1]                   ...

Flowchart of Sorting of elements

Image

Definitin fo Array

“The collection of homogenous data elements stored under a single name in consecutive memory locations.” This single name is called array. Individual elements of array are called SUB-SCRIPTED variables. Thus a sub-scripted variable consists of an array name followed by sub-script of an index enclosed in square bracket. A pair of bracket is used for sub-script. Array may be one dimensional one dimensional or two dimensional. TYPES OF ARRAY:         1.ONE DIMENSIONAL ARRAY         2.TWO DIMENSIONAL ARRAY §   ONE DIMENSIONAL ARRAY: This type of array is also called linier array. In this, there is only one sub-script. Each element of array is stored in consecutive location in memory as Data type   array name   size                          ...