array is used to store the ame datatypes syntex:
int array[]=new int[size];
dynamic declaration of array
insertion
array[1]=20;
2nd way:
int array[]={10,20,30};
*important:-
int array[20]={20,30,49,....}
this way is wrong in java as this is static way and in java all is done dynamically
An associative array is one of a number of array-like data structures where the indices are not limited to integers.
Both are linear data structures.
A subarray is a contiguous sequence of elements within an array. In the context of data structures and algorithms, a subarray is defined as a subset of elements from an array that maintains the order of the original elements. It is commonly used in algorithms to analyze and manipulate specific parts of an array efficiently.
Nothing, but a two dimensional array can be used to represent a matrix.
The elements of the arrays are structures. Example: struct { int x, y, z; } cube [8]; cube[0].x = 1;
No, it can be array, structure or union as well.
3 differences.................. 1. length wise.... 2.initialization 3. null terminated length of char array is differ from string........ initialization of string is differ from char....... and string is null terminated...........
By writing in C code the mathematical methods for finding the mean, median and mode of your data taking into account how your data is stored (eg an array; two separate arrays one with data and the other with frequencies; a two dimensional array containing both data and frequencies; an array of structures containing the data instead of arrays; a linked list of structures; etc).
The main differences between an array and a structure are: An Array is a collection of similar data items.An array is derived data type.It behave like a built in data type. An array can be increased or decreased. A structure is a collection of dissimilar data items.It is a user defined data types.It must be declared and defined.A structure element can be added if necessary.
Merge sort is a divide-and-conquer algorithm used in data structures to sort an array or list. It works by recursively splitting the input array into two halves, sorting each half, and then merging the sorted halves back together. The process continues until the entire array is sorted. Merge sort is efficient, with a time complexity of O(n log n), making it suitable for large datasets.
Array Pros:can access any element of an array directlycan be used to create other useful data structures (queues, stacks)light on memory usage compared to other structuresArray Cons:rigid structurecan be hard to add/remove elementscannot be dynamically resized in most languages
You can use unlimited number of variables for a structure and you can also declare array of structures.