Arrays, Data Structure & Algorithms

Assignment Help:

This unit discussed about data structure called Arrays. The easiest form of array is a one-dimensional array which may be described as a finite ordered set of homogeneous elements that is stored in contiguous memory locations. For instance, an array might contain all integers or all characters or any data type, but might not contain a mix of data types.

The common form for declaring a single dimensional array is following:

data_type array_name[expression];

where data_type represents data type of the array. That is, char, integer, float etc. array_name is the name of expression and array which denoted the number of elements in the array.

For instance, assume the following C declaration:

int  a[100];

This declares an array of 100 integers.

The amount of storage needed to hold an array is related to its type and size directly. For a single dimension array, the overall size in bytes needed for the array is computed as illustrated below.

Memory needed (in bytes) = size of (data type) X length of array

The primary array index value is referred to as its lower bound & in C this is always 0 and the maximum index value is called as its upper bound. In the array the number of elements, called its range is given by upper bound-lower bound.

In the arrays we store values during program execution. Now Let us see the process of initializing an array while declaring it.

int a[4] = {34,60,93,2};

int b[] = {2,3,4,5};

float c[] = {-4,6,81,- 60};

We come to the following facts from these instance:

(i) If at the time of declaration the array is initialized, then the dimension of the array is optional.

(ii) Till the elements of array are not given any particular values, they have garbage values.


Related Discussions:- Arrays

Avl tree rotations, AVL trees and the nodes it contains must meet strict ba...

AVL trees and the nodes it contains must meet strict balance requirements to maintain O(log n) search time. These balance restrictions are kept maintained via various rotation func

Recursion, differences between direct and indirect recursion

differences between direct and indirect recursion

Explain merge sort, Question 1 Explain the use of algorithms in computing ...

Question 1 Explain the use of algorithms in computing Question 2 Explain time complexity and space complexity of an algorithm Question 3 Explain how you can analyz

Explain graph traversal, Graph Traversal In many problems we wish to in...

Graph Traversal In many problems we wish to investigate all the vertices in a graph in some systematic order. In graph we often do not have any single vertex singled out as spe

Find strongly connected components - dfs, A striking application of DFS is ...

A striking application of DFS is determine a strongly connected component of a graph. Definition: For graph G = (V, E) , where V refer to the set of vertices and E refer to the

Define algorithm, What is an Algorithm? An algorithm is a sequence of u...

What is an Algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for getting a needed output for any legitimate input in a finite amoun

Ways to implement abstract data types, Ways to implement abstract data type...

Ways to implement abstract data types A large part of the study of data structures and algorithms is learning about alternative ways to implement an ADT and evaluating alternat

Pseudocodes, how to draw a 5 inch square on the screen using * symbol

how to draw a 5 inch square on the screen using * symbol

Properties of red- black tree, Any Binary search tree has to contain follow...

Any Binary search tree has to contain following properties to be called as a red- black tree. 1. Each node of a tree must be either red or black. 2. The root node is always b

Write Your Message!

Captcha
Free Assignment Quote

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!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd