• Register

Recent posts tagged array

41 2 2 min.
Here, we will write the Java programs to sort the array in descending order. Consider a list of an array element in an unsorted format, we will sort them in descending order.Algorithm:Take the input size of an element.Use a loop to Input array e...
posted Jun 2 Being human 148 points
16 2 2 min.
By the definition, an array is stored at contiguous memory locations in order that initially it size is fixed. Actually array identifier holds only the reference of memory location and access of elements using index is performed by the following math...
posted Jun 2 mhfaisal 262 points
30 0 4 min.
The issue to consolidate two arranged exhibits should be possible in 3 distinct strategies. They are Strategy 1: By crossing both the exhibits to monitor the current component in each clusters and tracking down the base worth among the two and r...
posted May 30 amna 112,545 points
18 0 2 min.
If you are a fresher, you might have encountered this question in your interviews i.e program to find a maximum and minimum number in an array in java. Let us understandAlgorithm to find the maximum and minimum number in an array in javaTake the...
posted May 30 Being human 148 points
8 0 2 min.
Difference between character array and string in c A major difference is: string will have static storage duration, whereas as a character array will not, unless it is explicitly specified by using the static keyword. Actually, a string is a cha...
posted May 28 Sanjana Sagar 427 points
3 0 1 min.
How to initialize two dimensional array in java // java program to initiliaze a 2D array import java.io.*; class GFG { public static void main(String[] args) { // Declaration along with initialisation // 2D integer array wi...
posted May 22 Sanjana Sagar 427 points
3 0 1 min.
How to call an array from another class in javaBy Creating an Object of other class and use that object to invoke the array from your class.For Example -You have two classes A and B.Now, You have something like this in A class -  class A{ p...
posted May 22 Sanjana Sagar 427 points
6 0 1 min.
How to create an array of generic type in javaArrays in Java usually contain the  information about their component type . However if the components are unknown, you have got yourself a generic array . Fear not , we can tackle this . I want you ...
posted May 22 offonime 232 points
0 0 1 min.
How to put a text file into an array in javaList<String> list = Files.readAllLines(new File("input.txt").toPath(), Charset.defaultCharset() );Java ArraysArrays are used to store multiple values in a single variable, instead of declaring separat...
posted May 20 Sanjana Sagar 427 points
0 0 3 min.
Using Arrays.sort method to Find Maximum and Minimum Values in an Array int[] nums={6,-1,-2,-3,0,1,2,3,4};Arrays.sort(nums);System.out.println("Minimum = " + nums[0]);System.out.println("Maximum = " + nums[nums.length-1]);You...
posted May 20 Sanjana Sagar 427 points
0 0 2 min.
There are numerous path for this inquiry for arrangement , yet I might want to call attention to that they can be stretched out essentially to accomplish much more unpredictable arranging. The solitary thing you need to do is to utilize the OR admini...
posted May 20 amna 112,545 points
0 0 2 min.
Assume we have two arranged exhibits and a number x, we need to discover the pair whose total is nearest to x. Also, the pair has a component from each cluster. We have two exhibits A1 [0..m-1] and A2 [0..n-1], and another worth x. We need to discove...
posted May 20 amna 112,545 points
0 0 1 min.
We can pass the java array to method so that we can reuse the same logic on any array.Let's see the simple example to get the minimum number of an array using a method.//Java Program to demonstrate the way of passing an array //to method. cla...
posted May 18 muliemes 100 points
0 0 1 min.
We can declare, instantiate and initialize the java array together by:int a[]={33,3,4,5};//declaration, instantiation and initialization Let's see the simple example to print this array.//Java Program to illustrate the use of declaration, instan...
posted May 18 muliemes 100 points
0 0 2 min.
Normally, an array is a collection of similar type of elements which has contiguous memory location.Java array is an object which contains elements of a similar data type. Additionally, The elements of an array are stored in a contiguous memory ...
posted May 18 muliemes 100 points
3 0 2 min.
In computer science, a data structure consisting of a collection of elements is known as an array,  stored at contiguous memory locations, each identified by at least one array index or key. The position of each element of an array can be comput...
posted May 13 mhfaisal 262 points
3 0 1 min.
C++ PointersIn C++, pointers are variables that store the memory addresses of other variables.This program declares the array of five element and the elements of that array are accessed using pointer.To understand this example, you should have the kn...
posted May 7 Ahsan29 143 points
3 0 4 min.
C++ PointersIn C++, pointers are variables that store the memory addresses of other variables.Here is how we can declare pointers.int *pointVar; Here, we have declared a pointer pointVar of the int type.We can also declare pointers in the follow...
posted May 7 Ahsan29 143 points
0 0 2 min.
Explaination and solutionThis is an error that even the best of us gets while using arrays, lists or any similar data type. With a small lack of attention or even from not typing the correct number, this error could easily happen and for beginners in...
posted May 4 Tegra Balonga 500 points
0 0 6 min.
The for loop:for (let index=0; index < someArray.length; index++) {   const elem = someArray[index];   // ··· }The for-in loop:for (const key in someArray) {   console.log(key); } The Array method .forEach(): someArray.forEach((elem, index)...
posted Apr 25 Lelin 764 points