Question

In: Computer Science

What is an array data structure? What is an array index? What are the benefits of...

What is an array data structure?

What is an array index?

What are the benefits of array structures?

What are the drawbacks of array structures?

What is a grid structure?

Give examples of when an array could be used.

Give examples of when a grid could be used.

Solutions

Expert Solution

1. Array is a data structure which can store sequence of homogeneous data types in contigeous location.

2. Array index is numerical value (usually starting from 0) used to access elements in an array e:g if a is an array of 5 elements then a[4] means 5 th element in array.

3. The biggest benefit of Arrays is that arrays provide direct access to elements i:e we can directly any element from an array.

4. Array is static structure i:e arrays are fixed size. The memory which is allocated to array can not be increased or reduced. The elements of array are stored in consecutive memory locations. There are means to create dynamic arrays but internally arrays are static structures.

5. Grid Structure is basically 2 dimensional array which has rows and columns. A rectangular array of squares or rectangles of equal size.

6. Arrays can be used to store multiple elements when the number or size is known in advance e:g to store the daily petrol expenses of car each week we can use array of size 7 for each day.

7. Grid can be used where two dimensional data has to be used. For example storing the marks of each student in a particular subject. I will use an array of 3 columns first column for roll no, sexond for marks.


Related Solutions

What is a linked data structure? What is a node? What are the benefits of linked...
What is a linked data structure? What is a node? What are the benefits of linked structure? What are the drawbacks of linked structure? What are the differences between singly linked and doubly linked structures? Give examples of when a linked structure could be used.
Explain this code: The structure used is max heap using array. C++ (i is the index...
Explain this code: The structure used is max heap using array. C++ (i is the index of the element to be deleted) void del(int i) {    int left,right,temp;    arr[i]=arr[n-1];    n=n-1;    left=2*i+1; /*left child of i*/    right=2*i+2; /* right child of i*/    while(right < n)    {        if( arr[i]>=arr[left] && arr[i]>=arr[right] )            return;        if( arr[right]<=arr[left] )        {            temp=arr[i];            arr[i]=arr[left];   ...
You need a data structure that contains fields for name (char array), color (char array), age...
You need a data structure that contains fields for name (char array), color (char array), age (int), and height (int). Name the struct Info when you define it. Create a function named getUserInfo() that asks the user for name, color, age, and height and then returns a data structure containing that information. It should do the following: What is your name? George What is your favorite color? Green What is your age? 111 What is your height in inches? 72...
Task1: Write a class DynArr that represents an array data structure. Here are the attributes (data)...
Task1: Write a class DynArr that represents an array data structure. Here are the attributes (data) of the class (note - fields of the objects should be marked as private)” INITIAL_SIZE: the initial size of the array = 10; _innerArr: an array of integers _growthFactor: the factor by which to resize the array with to become bigger. _lastIndex: an index on the last element in the array. The class will have the constructor public DynArr() that initialzes an array of...
Given an array of numbers, find the index of the smallest array element (the pivot), for...
Given an array of numbers, find the index of the smallest array element (the pivot), for which the sums of all elements to the left and to the right are equal. The array may not be reordered. Example arr=[1,2,3,4,6] the sum of the first three elements, 1+2+3=6. The value of the last element is 6. Using zero based indexing, arr[3]=4 is the pivot between the two subarrays. The index of the pivot is 3. Function Description Complete the function balancedSum...
language c++(Data structure) You have to read a file and store a data in character array...
language c++(Data structure) You have to read a file and store a data in character array ( you cant initialize a character array, you have to code generically) code must be generic u must read a file onece u cant use built in function etc string, code in classes if u initialized a char array or ur code doesn't run i will dislike and report u you can use link list to store data
Solve in C++ program. Modify the use of queue data structure such that the array used...
Solve in C++ program. Modify the use of queue data structure such that the array used to implement the queue is dynamically allocated for a fast food autoservice
(Data structure) Show the contents of the array below, once the “pivot” element is placed at...
(Data structure) Show the contents of the array below, once the “pivot” element is placed at its appropriate location after each call of the “Partition” algorithm, in the process of running Quick-Sort on said array. Arrange the data in descending order (from largest to smallest value). Always select the first element of the partition as “pivot” Apply sorting on the following data set s,       f,       p,      a,      g,      e,       v,      q,      i,        c
In C Programing Create a stack using an array. Define the index variable of the array...
In C Programing Create a stack using an array. Define the index variable of the array name to be stacktop. Initially set stacktop to -1. Next create two functions push and pop. Both take as input 3 items: a pointer to the stack in memory, stacktop, and maxstack. Make sure to inc stacktop by one and also remember that stacktop[0] is the bottom of the stack and by stack rule cannot be accessed until all the other items are popped....
3 . a) What tissue structure are unique to animal and what are the benefits of...
3 . a) What tissue structure are unique to animal and what are the benefits of these structures? b.) In what way do animal cells differ from that of other multicellular eukaryotes? Explain. c.) In what way(s) are sponges (Porifera/Parazoa) different from other animals (eumetazoans)? d.) Describe the process of sexual reproduction in a typical animal. e.) Describe the most common mode of asexual reproduction in animals. f.) What is parthenogenesis?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT