Computerfunda is blog about education in computer science. It provides resources for cometitive examinations like GATE, UGC NET etc. You can get everything related to cs is for free

Responsive Ads Here

Monday 15 May 2017

Array and stack basics

ARRAY AND ARRAY TYPE 

An array is a collection of homogeneous data elements described by a single name.

ONE DIMENSIONAL ARRAY:

One-dimensional array or linear array is a set of ‘n’ finite numbers of homogeneous data elements such as

  1. The elements of the array are referenced respectively by an index set consisting of ‘n’ consecutive numbers. 
  2. The elements of the array are stored respectively in successive memory locations. ‘n’ number of elements is called the length or size of an array. The elements of an array ‘A’ may be denoted in C as A [0], A [1], A [2] ....... A [n–1] The number ‘n’ in A[n] is called a subscript or an index and A [n] is called a subscripted variable. 

MULTI-DIMENSIONAL ARRAY 

The elements of an array can be of any data type, including an array of arrays is called a multidimensional array. In this case, since we have 2 subscripts, this is a two-dimensional array. In a two-dimensional array, it is convenient to think of the first subscript as being the row, and the 2nd subscript as being the column. Two loops are required. Similarly, the array of ‘n’ dimensions would require ‘n’ loops. SPARSE ARRAY A sparse array is an array where most of the elements have the value zero “0” and only a few non-zero values. The one-dimensional sparse array is called sparse vectors and two-dimensional sparse arrays are called the sparse matrix.

now we discuss in small about stack

STACK:

A stack is an ordered collection of items into which new items may be inserted and from which items may be deleted at one end, called the top of the stack. A stack is a dynamic, constantly changing object as the definition of the stack provides for the insertion and deletion of items. It has a single end of the stack as a top of the stack, where both insertion and deletion of the elements takes place. The last element inserted into the stack is the first element deleted last in first out list (LIFO). After several insertions and deletions, it is possible to have the same frame again.

That's all for now about these two data structures these article is mainly focusing on ibps it officer exam only

1 comment:

  1. Free slot machine casino site | Lucky Club
    We'll take luckyclub you to the casino in a very small detail and say “it is an entertaining game.” But we will also go through a lot of

    ReplyDelete

What you need for Analysis of algorithms?

What you need for analysis of algorithms: First of all, you need to understand what is an algorithm is ? an algorithm is involved in eve...