Question

PRONS AND CONS OF USING ARRAYS: Set 01: Pro: It can hold the collection of similar...

PRONS AND CONS OF USING ARRAYS: Set 01: Pro: It can hold the collection of similar items Con: It can hold the collection of similar items only Set 02: Pro: Memory allocated is continuous. You can increment the index to move to next element. You can refer to any item in array using its index Con: Memory allocated is continuous. If that required amount of memory is not continuously avail, well, problem! Insertion and deletion in between the array are tedious to handle. Set 03: Pro: You can do operations on this homogeneous collection of items like sort, search, etc. Con: If the size of data grows huge (Huge data as well as huge integer range), arrays are not the ideal data structures to be used. Set 04: Pro: Many other data structures can be implemented using arrays (Stack, Queue, Matrices etc) Con: The static size and no direct bound checking mechanism is always a disadvantage.

Set 01 to Set 04 refers to what in java?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Set 01: in java
Prons:
In java Array creation is dynamic..where as in c it is not dynamic..Arrays first created and initialized.Since we can store many of elements at a time.
Cons:
yes,in java array can hold ony similar type of data types .different types are not posible.if we create array of type integers it allows only integers .not strings chars etc.

Set2:
Prons:
In java we can access element by index value. we can add many elements at a time.which is fast.we can access any particular element by using index of array randomly .

Cons:In java if the elements reaches the limit of array..it throws an exception called ArrayIndexOutOfBoundsException..this exception is thrown when supose array size is 5 and we inserted or try to access element more than size it throws exception
Set3:
Prons:
In java arrays are widely used for sorting and searching of elements.and it is faster
Cons:
arrays are very expensive in deletion
arrays are very expensive in adding compare linked list
arrays are fixed in size ..size cannot be increased once created.but where as linked list are not limited they can increase size dynamically..
and also size of arrays are not even decreased


Set 4:
arrays can be used for implemented many data structures like stack queue etc,and accessing elements from these data structures are quite good
and java also provides predefined data structures like stack queue..

cons:
when even any element is accessed java checks the index values are within limit or not which is causes the reduction in speed limit.arry bound checks elimination identifies a situation that such ones are redundant

Add a comment
Know the answer?
Add Answer to:
PRONS AND CONS OF USING ARRAYS: Set 01: Pro: It can hold the collection of similar...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Description An array in C++ is a collection of items stored at contiguous memory locations and...

    Description An array in C++ is a collection of items stored at contiguous memory locations and elements can be accessed randomly using indices of an array. They are used to store similar type of elements as in the data type must be the same for all elements. One advantage of arrays is easy data manipulation and accessibility of elements stored in consecutive locations. The Problem: One teaching assistant of a computer science department in Engineering University got a simple question...

  • C++ problem to use dynamic memory allocation (of arrays) and pointer manipulation in order to implement...

    C++ problem to use dynamic memory allocation (of arrays) and pointer manipulation in order to implement the Inner and Outer classes (Circular Buffer of circular buffers using Queues). No need of any classes from the Standard Template Library (STL), not even vector. Add the member functions of those classes by following the codes of InnerCB.h and CBofCB.h below: // file: InnerCB.h // Header file for Inner Circular Buffer. // See project description for details. // #ifndef _INNERCB_H_ #define _INNERCB_H_ class...

  • This lab, for which you may work in groups of two, will require you to use...

    This lab, for which you may work in groups of two, will require you to use a C structure to hold a record of any kind of data, i.e., address book, library of books as with chapter 14, etc. These records will be held in dynamic memory using memory allocation (malloc) to create new memory and the function (free) to release memory created via (malloc). Do not use linked lists for this assignment, we are using dynamic memory allocation to...

  • c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please...

    c++ can use if else, loop,function ,array,file i.o. Can not use swtich, global variables etc..   Please do all parts. previously I post 3 time for part1 ,2 and 3 but I can't make it into one complete program code. I even try to post a questions ask and post the 3 parts of code for experts to put it together. But experts said it's not enough information. please help... Thank you ! Program Objectives: Allow students to create arrays Allow...

  • Write a program in C++ that uses a class template to create a set of items....

    Write a program in C++ that uses a class template to create a set of items. . . The Problem Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 Hint: Use vectors and vector functions to store the set of...

  • Please write below code in C++ using Visual Studio. Write program that uses a class template...

    Please write below code in C++ using Visual Studio. Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...

  • Project Description: In this project, you will combine the work you’ve done in previous assignments to...

    Project Description: In this project, you will combine the work you’ve done in previous assignments to create a separate chaining hash table. Overview of Separate Chaining Hash Tables The purpose of a hash table is to store and retrieve an unordered set of items. A separate chaining hash table is an array of linked lists. The hash function for this project is the modulus operator item%tablesize. This is similar to the simple array hash table from lab 5. However, the...

  • C++ problem with dynamic arrays is that once the array is created using the new operator...

    C++ problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example, you might want to add or delete entries from the array similar to the behavior of a vector. This project asks you to create a class called DynamicStringArray that includes member functions that allow it to emulate the behavior of a vector of strings. The class should have: A private member variable called dynamicArray that references a...

  • Program in C++ Implement Conway's Game of Life using 2-dimensional arrays. All the tips, tricks, techniques...

    Program in C++ Implement Conway's Game of Life using 2-dimensional arrays. All the tips, tricks, techniques we have been using in class are allowed. Nothing else. The program should read the initial state of the board by reading in "alive" cells from a user input data file. Meaning your program should ask the user the name of the data file. Assume all the other cells are "dead." Make sure to use modular coding techniques. The main program should be pretty...

  • Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your...

    Lab 3 – Array-Based Stack and Queue Overview In this assignment, you will be implementing your own Array-Based Stack (ABS) and Array-Based Queue (ABQ). A stack is a linear data structure which follows the Last-In, First-Out (LIFO) property. LIFO means that the data most recently added is the first data to be removed. (Imagine a stack of books, or a stack of papers on a desk—the first one to be removed is the last one placed on top.) A queue...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT