Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In what programming situations would the use of an array be beneficial? What sit

ID: 3703951 • Letter: I

Question

In what programming situations would the use of an array be beneficial?

What situations would not warrant the use of an array? Provide an example explaining why?

Imagine a programming structure that would deal with these problems. What characteristics should the structure possess? Research the concept of class ArrayList in Java.

Describe the advantage of using the ArrayList class over an array. Also discuss in what circumstances you should use one over the other. Please use examples to justify your answers.

Explanation / Answer

Hi Dear,

Question is big, so I have answered first two question sin great details.

Please repost others in separate post.

Ans) concepts of Array

Definition: Array is a data structure to store fixed-size of homogeneous data.

In what programming situations would the use of an array be beneficial? :

     The array is used to store multiple variables of the same type. It can hold any primitive type of data and objects also in some languages.

If we want to store multiple data in the same type. we normally we used different variable declaration when we access that variable, we must remmeber the all variable names. It is sometimes difficult.

Instead of accessing different names by array. Array are easy to accessing values in it.

The size of the array should be fixed when declaring the array.

Examples: students marks, Employee salaries, students names, storing matrix ...etc.

Instead of declaring individual variables, such as salary0, salary1, ..., and salary49, you declare one array variable such as salaries and use salaries[0], salaries[1], and ..., salaries[99] to represent individual variables. A specific element in an array is accessed by an index.

What situations would not warrant the use of an array? :

1. when we don't know the size of the array particularly, then if you declare more size but need is small than wastage of memory. otherwise, if you declare less but actually need is more then required more memory.

2. if you want to store different type of values is not possible in arrays

Provide an example explaining why?:

The example program in c:

Instead of declaring 10 individual variables, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[9] to represent individual variables. A specific element in an array is accessed by an index.

Please DONT forgot to rate my answer. We are working hard for you Guys!!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote