Thursday, February 28, 2013

Types of array


There are mainly three types of array.these are follows.
  1. One- Dimensional array
  2. Two- Dimensional array
  3. Multi- Dimensional array
One-Dimensional array : In C a one-Dimensional array can be declared as int a[10];
by the above statement we are giving an integer type are array named a which can store the element up to 10. In the declaration of an array three things must be encountered:
data-type var_name[size];
We can calculate the length of an array using the given formula:
Length=(UB-LB)+1
LB=Lower bound
UB=Upper bound
Here we have used '+1' in the formula since in general an array is started  from 0 location and to find the exact location of the number '+1' is applied.
Example :Let we have marks of 5 students then it can be show as follows:
Marks[0]=70, Marks[1]=92, Marks[2]=75, marks[3]=72, Marks[4]=82,  
It can be display in row from of array as follows:
And in column from as follows:
 
Hence we can calculate the length of this array.
Length = (UB+LB)+1
=4-0+1
=5
Memory allocation to an array:~As per the data type of the element it is allocate memory space i.e. in C for int 2 bytes, for char 1byte etc.So for the generalized memory space we can drive the expression for each kind data type.
Memory space Required= Length*w
w = byte allocated to that type of data type
For e.g. if we take above given example then from formula
memory apace Reuired =   Length*w  
(for int w=2) 
=5*2
=10
 This array will occur 10bytes in memory
  Let LA be a liner array in the memory of the system. So we can calculate the location of element in the follows manner.
LOC(LAK)=Base(LA)+W(K-lower bound)
Where LA is the linear array, Base address(LA) is denoted the address of the first element of LA and W is the number of words for memory cell for the array LA.
Example: consider an array school,  which record the number of school generated each year from 1947 to 1999. Suppose SCHOOL appears in memory as picture-
Array representation
That is  base[SCHOOL]=500
W=4 words per memory cell for SCHOOL
LOC [1947]=500, LOC[1948]=504,...............
So find the address of array element for the year =1980, So
LOC(SCHOOL[1980]) =Base (SCHOOL)+W(1980-LB)
=500+4(1980 - 1947)
=632
Two dimensional array : A two dimensional array  m * n array is a collection of m.n data elements such that each element is specified by a pair of integers data type, called subscript.
The element of A first subscript J and second subscript K will be denoted by

Aj,k   or A[J,K]

Notes-Detailed study of 2-D array will cover in the next post.

Multi- Dimensional array :-General Multidimensional array are defined analogously an n-dimensional array  M1 * M2 *M3....................Mn, array B is a collection of M1 * M2 *M3....................Mn, data elements can be represents as:
Bk1,k2.......kn or B[k1 k2.......kn]

Operation of array

There are many operation perform by the linear array, there are as follows:

  1. Traversal the array
  2. Deletion from an array
  3. Sorting is an array
  4. Insertion in an array
  5. Searching in an array
  6. Merging in an array
These are all the operation of the array. Now we will be discuss operation one-by-one.
  1.  Traversal the array :-By traversing we mean, accessing and/or processing(visiting) of each element exactly once of the array.
Algorithm-: LA (LB, UB, K)
  1. [ Initialize counter] Set K=LB
  2. Repeat step 3 and 4 while K<=UB
  3. [Traverse an element] Apply process to LA[K]
  4. [Increase counter] set K=K+1
  5. [End of the step 2 loop]
  6. Exit
This is the algorithm of the traversing of an array. Now we can see the C-implementation of an array.
Program:-
#include<stdio.h>
#include<conio.h>
void main()  /* Main function */
{
int a[10], i;
clrscr();
printf("enter array value");
for(i=0; i<10; i++)

scanf("%d", & a[i])
}
printf("the enter array is/n");
for( i=0;, i<10; i++)
{
printf("%d",a[i]);
}
getch();
}
Output of program:-
1
2
3
4
5
6
7
8
9
The enter array is
1
2
3
4
5
6
7
8
9

Insertion in array-After some time:

Arrays

Array is a defined as collection of finite number of homogeneous elements(same type elements) or data item.It means an array can contain of type of data only, either all integers, all floating number etc. it is a group of contiguous or related data item that share a common name. it is basically a collection of  same data type is other words. declaration of arrays is as following:~
char a [5];
Where char specifies the data type or type elements array store. "a" is the name of array, and the number specified inside the square brackets is the number of elements is the number of elements as array can store, that is also called length of array.
length of size of array is the total number of elements.
Length of array = UB - LB + 1
 Here - UB- denotes upper bound
             LB- denotes lower bound
   Where under bound is the largest index and lower bound is the lowest index of the array.
If lower bound=1 then length of array is equal to upper bound.
Some important points about of array :
1.  The individual element of an array can be accessed by specifying name of the array follows by index inside the brackets for example to access third element of array a, we have to give the following statement :
a[2] 
2.  The first element of an array has index [0]. It means the first element and last element will be specified as:
a [0] and [n - 1]
3.  Array are normal like any other variable.
4.  Array can always be read or written through loop.If we study about one dimensional the requires one loop for reading and writing. 
For example
(a) reading an array :
for(i=0; i<=n; i++)
{
scanf("%d",&a[i]);
}
(b) for printing an array :
for (i=0;i<=n;i++)
{
printf("%d",a[i]);
}
similarly we are studying about two dimensional array then we require two loops. And similarly the array of n dimensional require n loops:
Example Let A be 10 element of linear array of integer such that
A[0]=1, A[1]=2, A[2]=3, A[3]=4, A[4]=5, A[5]=6, A[6]=7, A[7]=8, A[8]=9, A[9]=10
So length of array = UB-LB+1
=9-0+1
=10
Some command operation performed on array are as follows:
  1. Creating:Creating an array.
  2. Traversing:Processing every element of array.
  3. Searching:Finding the location of an element.
  4. Insertion:Insert a new element in given array.
  5. Deletion:Delete an item from  the array.
  6. Merging: Merging of an arrays.
So these are the some operation of an arrays. this was the brief description of an array.
TYPES OF ARRAY -CLICK HERE

Wednesday, February 27, 2013

Classification of data structure

Data structure are Diveded into two main categories.:~
  1. Primitive data structure
  2. Non-primitive data structure
  1. primitive data structure :~The primitive data structure are defined that can be manipulated or operated by the machine instruction.There is general, have different representations an different computers.
For example- the integers, floating-point numbers, pointers, string constans, characters etc.
are some of the different primitive data structure.in C language, the different primitive data structure are defined using the data type such as int, char, float, double etc.

 2. Non-primitive data structure-The non-primitive data structures are data structure that cannot be manipulated or operated directly by the machine instructions.These are more sophisticated data structures.These are derived from the primitive data structure.
For example-Arrays, structure, stack, queues, linked list etc.
The non-primitive data structure are classified into two categories linear and non linear data structure.Whene the elements are accessed in contiguous memory location then data structure is know as linear   data structure.
Array stack queue and link list are the example of the linear data structure in linear data structure we have to first allocate memory for the number of elements like in arrays.This some time leads to wastage memory.
in non-linear data structure element are not accessed in contigious memory allocation
 Example-Non-linear data structure are tree graph, sets etc.
we can represent a hierarchy of data structure as follows:~

Tuesday, February 26, 2013

1.1 INTRODUCTION

A data structure in computer science is a way of storing data in a computer so that it can be used efficiently.It is an organization of mathematical and logical concepts of data. A well defined datda structure a variety of critical operations to be performed using a few resources, both exection time and memory space, as possible. Data structures are implemented by a programming language as data types and the references and operations they provide.
  Data structure is a way of organizing the all data items that considers not only the element stored but also their relationship to each other. data structures usually consists of two things : first one is the type of structure that we are going to used to store data and second hoe efficiently we perform operation on to the data stored in structure so that it result in less execution time and amount of memory they require. So by this way we can say that data structure is one collection of data structures.
Data structure mainly classify the following features:~
1. Organization of data.
2. Logical or mathematical model of data.
3. Accessing Methods of data.
4. Implementation of an abstract data type.
5. Degree of associativity.
6. Processing alternatives for information.
7. Dynamic memory allocation.
Data structure are the building   block of the programs and hense the choice of a particular data model or structure depends on the following features:~
* Data structure must be rich enough in structure to reflect the actual relationship of the data
* And second one structure should be simple (not complex to understand) enough that any one can process  data easily whenever required.

A program is make by the combination of the algorithm and the data structure. SO we can write as:
data structure + algorithm = program
Notes :~ Algorithm is the step by step solution of a program.
To develop a program of  an algorithm

0.3 ASYMPTOTIC NATATION

The asymptotic notation is nothing but to assume the volume of a function.A try is made to equate two function with some assumptions to make the representation simple and general. Most commonly used asymptotic notations are big oh(O), big omega and big theta, so

Both space complexity and time complexity can be represented using asymptotic notations.

0.2 ALGORITHM PREFORMANCE

THE performance evaluation of an algorithm is obtained by totalling the  number of occurrences of each operation when running the algorithm. performance of an algorithm depend upon the time and space. time taken by the algorithm depends upon many factors: one of the factor is operation used by the algorithm. run time efficiency of an algorithm depends upon the execution time of instruction in algorithm for a set of inputs. There instruction are used in an algorithm in such a way that execution time of instruction become less for the inputs. To solve this problem scientists developed asymptotic notations. These notations are commonly used in performance on analysis and used to characterize the complexity. There are various nation used in such type of analysis
   

Sunday, February 24, 2013

Analysis of Algorithm

0.1 INTRODUCTION
what is Algorithm and way do we want to analyze one? Algorithm is a finite set of particular problem. It is  step by step procedure for accomplishing desired solution. the procedure of writing an Algorithm is called as designing of Algorithm.
certain constraints are desirable in all Algorithms. first the Algorithm must be formal enough a avoid the any problem. each operation should be effective an Algorithm may have zero or more input and produces one more outputs. the Algorithm should be concise and compact in order to learn more about Algorithm, we can "Analyses" it by this we wean to study the specification of the Algorithm and to draw  result about how the implementation of that Algorithm. we can analyze the Algorithm as is following way :-
~Determine the running time of a program as a function of its inputs.
~Determine the total memory space.
~Determine the total capacity of program code.
~Determine whether the program correctly computes the desired result.
~Determine the complexity of the program i.e. how to easy to read, write, understand and modify.
the following figure represent relationship between problem, algorithm, and program.



in this text, we are concerned primarily with the running time. we consider the memory space needed to execute the program.there are factors that effect the running time of a program.
the performance of computer is determined by :-
~The hardware
~memory available
~input
~output
~the programing language in which the Algorithm is specified
~the language compiler / interpreter used      
 

Saturday, February 23, 2013

SCHEME OF EXAMINATION

SCHEME OF EXAMINATION
      The number of paper and the maximum marks of each paper together with the minimum marks required for a pass are shown against each subject separately.it will be necessary for a candidate to pass in the theory part as well as practical part of a subject/paper,wherever prescribed, separately.
classification of successful candidates shall be as follow:
First division -60% of the aggregate marks prescribed at (a) part1 examination
                         (b) part 2 examination,(c) part 3 examination taken together

second division- 48% all the rest shall be declared to have passed the examination, if they obtain the minimum pass marks in each subject VIZ.36% no division shall be the part 1 and part 2 examination.

Teaching and examination scheme for bachelor in computer application part-1 exam. 2012

Paper-General English/General Hindi- Tut-1 Exam hour-3 max mark-100
Paper-Environmental studies- Tut-1 Exam hour-3 max mark-100
paper-Elementary computer-Tut-1 Exam hour-3 max mark-100   

Optional-paper for 1 year.....
B.C.A.-101-  fundamental mathematics for computer application
B.C.A.-102-computer fundamentals and office automation
B.C.A.-103-internet and web programing
B.C.A.-104-fundamentals of 'c ' programing
B.C.A.-105-database management system
B.C.A.-106-computer architecture       

Second year optional paper-
B.C.A.-201-data structure
B.C.A.-202-oops with c++
B.C.A.-203-computer networks
B.C.A.-204-operating system
B.C.A.-205-discrete mathematics
B.C.A.-206-advanced data base management system

3year optional paper-
B.C.A.-301-software Engineering and visual basic
B.C.A.-302-java programing
B.C.A.-303-network security and data communication
B.C.A.-304-advnced web programing
B.C.A.-305-computer graphics and image processing
B.C.A.-306-E-commerce E-banking & security transaction