answersLogoWhite

0


Best Answer

Sum(All elements in B) - Sum(All elements in A)

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Given two arrays A and B Array 'A' contains all the elements of 'B' but one more element extra.Find out the extra element?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can element of character arrays be accessed in the same way as the elements of a numeric arrays?

Yes, it can.


Given two arrays A and B Array?

distinguish extra element in two arrays


Which data structure can't store the non-homogeneous data elements?

arrays


How are arrays processed?

Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.


How arrays used in vc plus plus?

Arrays are used to store two or more variables of the same type in contiguous memory. Since all elements are of the same type, they are also of the same size (in bytes), thus every element can be accessed as an offset from the start of the array. In an array of n elements, index 0 is the first element and index n-1 is the last element. By multiplying the index by the type size, the compiler can determine the start address of each element, thus permitting constant time, random access to any element within the array, as well as bi-directional traversal of the array. Arrays provide the most compact method of storing multiple values of the same type. So long as you know the start address of the array (which is obtained by the array name alone) and the number of elements in the array (which must be stored separately), you can access any element in constant time. C++ supports fixed-length arrays (std::array) and variable-length arrays (std::vector) as well as C-style arrays (both static and dynamic). In most cases you will use std::vector and std::array as they both provide bounds-checking, can be easily passed to functions by value, reference or pointer, and you enlist the compiler to ensure type safety. Both std::vector and std::array encapsulate the array, its type and its size, while std::vector uses a built-in memory manager to minimise reallocation of the array. With C-style arrays, the onus is entirely upon the programmer to ensure bounds-checking and type safety are adhered to. In particular, passing a C-style array to a function via a pointer should be avoided as the function has no way to determine how many elements are actually in the array, let alone what type of elements were originally placed in the array.

Related questions

Can element of character arrays be accessed in the same way as the elements of a numeric arrays?

Yes, it can.


What is the differnce between linked list and arrays?

A linked list is a series of elements, each containing a pointer or index to the next element in the list. You can dynamically add and delete elements in the list. An array is a contiguous block of repeated elements. Since each element is address-wise adjacent to the next element, there is no need for pointers or indexes to the "next" element. You can not dynamically add and delete elements in an array, although you can create "dynamic arrays" with (templates and) classes that auto-resize themselves. The STL does this for you, but it is a good exercise to implement it yourself.


Program in c plus plus to delete an element in sorted array?

If the array is dynamic then use a vector instead of an array. You can then use the vector::erase() function to delete an element or a range of elements. Remember that if the vector contains pointers to unshared memory, then you must release the pointer before erasing the element containing that pointer. If the array is static then you cannot delete elements. The assumption with static arrays is that you will neither add nor delete, you will only modify existing elements. However, you can emulate a deletion by shunting elements to the left, and keeping track of how many used elements there are (which must always be less than or equal to the upper bound plus one). Again, if the array contains pointers to unshared memory, you must release the pointer before shunting elements. You can also do the same thing with dynamic C-style arrays, but once you've shunted elements to the left you can reallocate the array with the new size to physically delete the final element.


Given two arrays A and B Array?

distinguish extra element in two arrays


What is the limitation of the linear array?

The main limitations of linear arrays are 1. The prior knowledge of number of elements in the linear array is necessary 2. These are static structures. Static in the sense that memory is allocated at compilation time their memory used by them cannot be reduced or extended. 3. Since the elements of these arrays are stored in the these arrays are time consuming this is because of moving down or up to create a space of new element or to occupy the space vacated by the deleted element.


Which data structure can't store the non-homogeneous data elements?

arrays


How are arrays processed?

Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.Usually one element at a time. If you want to process all elements of an array, you write a loop.


What are matrix questions?

They are questions which deal with rectangular arrays of elements.


What an array?

An array is an aggregate of data elements of the same type. Arrays are allocated in contiguous memory. An element of an array can be another array type, also known as a multi-dimensional array.


Which data structure can't store the homogeneous data elements?

arrays


What are matrices made of?

In mathematics matrices are made up of arrays of elements.


How can two single dimensional array values be stored in a third single dimensional array?

You need to create a new array with enough elements to cater for both arrays. Thus if the first array has 10 elements and the second has 5, you must create a 15 element array to store both. You then copy elements from the first array into the third and immediately follow with the elements from the second. Note that the first two arrays must be of the same type. You cannot combine an array of numeric values with an array of strings, for instance.