Question

In: Computer Science

Describe the types of arrays and operations that can be performed of them. [10

Describe the types of arrays and operations that can be performed of them. [10

Solutions

Expert Solution

Array

Generally , Array can be defined as a collection of homogeneous data items referred by a common name. Array is a derived data type.Usually to declare or use several number of (100) variables of same type , we go for arrays.But this same task can also be done by declaring different different variables individually as below

   int a, aa, ab......az, b, ba,bb.....bz,.......until 100 items.

But this way of declaring needs large number of variable names and this way has a complexity of remembering variable names ,that is the reason why arrays are preferred while using large number of similar data items.

Example Student [10];

This is a student array which contains 10 variables referred by common name student.if 6 th variable is to referred found , it is done as student[5].The index of variables of an array are indicated within the subscript denoted as "[ ]".The index starts from '0'.

Types of Arrays

1).single dimensional array: it is simply an ordered list of homogenous data items.It involves three steps as below.

   (i).declaration of array

datatype [ ] arrayname;

Note : Size of the array must not be given during declaration.

(ii) Allocation of memory location for the array

arrayname = new datatype[size];

It is allocated dynamically with the help of 'new' operator.

(iii) initialization

Inserting values into the array.Initialization is performed with the loops or direct assignment.

2).Multidimensional Arrays : consists of homogeneous data stored in more than one dimension.

subject [2][5];

Operations of arrays

1).Traverse − Employed for accessing the every data item just singly.

2).Insertion − includes a fresh data item for offered index.

3).Deletion − Deleting  the element present towards the offered index.

4).Search − Searches the element with the offered index.

5).Update − updates the element on the offered index.

  Arrays permit efficient random access , but not the insertion and deletion of elements .Arrays are simple due to predefined methods in java.


Related Solutions

Describe how stacks and their main operations can be implemented using arrays and stacks. Provide the...
Describe how stacks and their main operations can be implemented using arrays and stacks. Provide the pros and cons for each approach. Research some applications, that can use stacks as a possible implementation vehicle.
a. identify and describe the different types of operations that can be done in an organization
a. identify and describe the different types of operations that can be done in an organization b. Explain with reference to examples, the advantages and disadvantages to an operation of either increasing or reducing any one of the types of operations above,
Perform the following tasks with NumPy arrays. All of them can be done (elegantly) in 1...
Perform the following tasks with NumPy arrays. All of them can be done (elegantly) in 1 to 3 lines. (a) Create an 8 × 8 array with ones on all the edges and zeros everywhere else. (b) Create an 8 × 8 array of integers with a checkerboard pattern of ones and zeros. (c) Given the array c = np.arange(2, 50, 5), make all the numbers not divisible by 3 negative. (d) Find the size, shape, mean, and standard deviation...
2) What are the types of “Statistics”? Describe each of them.
2) What are the types of “Statistics”? Describe each of them.
5. Describe various types of emulsions and how to identify them? 6. How come emulsion can...
5. Describe various types of emulsions and how to identify them? 6. How come emulsion can increase the solubility of hydrophobic molecules?
Describe two types of substantive analytical procedures often performed in the audit of the sales and...
Describe two types of substantive analytical procedures often performed in the audit of the sales and collection cycle and describe how they might indicate a possible misstatement in the financial statements. Identify and select the two types of substantive analytical procedures and then choose the possible misstatement in the financial statements. compare aging categories as a percentage of net income with previous years compare bad debt expense as a percentage of net sales with precvious years compare gross margin percentage...
C# One Away: There are three types of edits that can be performed on strings: insert...
C# One Away: There are three types of edits that can be performed on strings: insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit (or zero edits) away. EXAMPLE pale, pIe -> true pales. pale -> true pale. bale -> true pale. bake -> false Comment your code to explain it.
In 250 words or more: What types of warrantLESS searches can be performed by law enforcement...
In 250 words or more: What types of warrantLESS searches can be performed by law enforcement collecting digital evidence? Give one example for each and the reasons why are warrants not required?
What are the types of Chromatin material of eukaryotic chromosomes and describe them briefly.
What are the types of Chromatin material of eukaryotic chromosomes and describe them briefly.
Describe three types of ENERGY found in the Electron Transport System AND put them in the...
Describe three types of ENERGY found in the Electron Transport System AND put them in the correct order.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT