## Array vs. ordinary variable, Data Structure & Algorithms

Assignment Help:

Q. Describe what do you understand by the term array? How does an array vary from an ordinary variable? How are the arrays represented in the specific memory?

Ans.

Array Vs. Ordinary Variable is explained as follows

Array is made from the similar data structure that exists in any language. Array is the set of similar or alike data types. Array is the collection of similar or alike elements. These similar or alike elements could be all int or all float or all char etc. Array of char is called as string. All elements of the given array should be of same type. An array is finite ordered set of the homogeneous elements. The number of elements in the array is pre- determined.

For example.  Ordinary variable: - int a

Array:      -      int a[10]

An ordinary variable of a simple data type can save a single element only

Representation of Array in memory is shown below

Assume a be a 2 dimensional m x n array

 Col 0 Col 1 Col 2 Row 0 a00 a01 a02 Row 1 a10 a11 a12 Row 2 a20 a21 a22

Though  a  is  pictured  as  a  rectangular pattern  with  in  row  and  n  column  it  is represented in memory or a particular location by a row of m x n  elements. Sequential memory locations the element can be saved in row major order.

Column major order is explained as follows:- the elements are saved column by column i.e. m elements of the 1st column is saved in first m locations, elements of the 2nd column are saved in next m location and so on..

Row major order is shown below:-

The elements are saved row by row ie. N elements of the 1st row are saved in 1st n location, elements of 2nd row are saved in next n location, and so on

#### Define an array, Define an array. Array is made up of same data structu...

Define an array. Array is made up of same data structure that exists in any language. Array is set of same data types. Array is the collection of same elements. These same elem

#### Conversion of general trees to binary trees, Taking a suitable example expl...

Taking a suitable example explains how a general tree can be shown as a Binary Tree. Conversion of general trees to binary trees: A general tree can be changed into an equiv

#### What is a linear array, What is a linear array? An array is a way to re...

What is a linear array? An array is a way to reference a series of memory locations using the similar name. Every memory location is shown by an array element. An  array elemen

#### Data searching, In file access: what is the difference between serial, seq...

In file access: what is the difference between serial, sequential and indexed sequential searching

#### SORTING ALGORIthm, the deference between insertion,selection and bubble sor...

the deference between insertion,selection and bubble sort

#### Cohen sutherland algorithm, Using the cohen sutherland. Algorithm. Find the...

Using the cohen sutherland. Algorithm. Find the visible portion of the line P(40,80) Q(120,30) inside the window is defined as ABCD A(20,20),B(60,20),C(60,40)and D(20,40)

#### Write an algorithm to measure daily temperatures, A geography class decide ...

A geography class decide to measure daily temperatures and hours of sunshine each day over a 12 month period (365 days) Write an algorithm, using a flowchart that inputs tempera

#### Algorithm to find maximum and minimum numbers, Give an algorithm to find bo...

Give an algorithm to find both the maximum and minimum of 380 distinct numbers that uses at most 568 comparisons.

#### Life science, Define neotaxonomy. Discuss how electron microscopy can help ...

Define neotaxonomy. Discuss how electron microscopy can help in solving a zoological problem faced by taxonomist.

#### Postfix expression, : Write an algorithm to evaluate a postfix expression. ...

: Write an algorithm to evaluate a postfix expression. Execute your algorithm using the following postfix expression as your input: a b + c d +*f ­ .

### Write Your Message!

#### Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!