0% found this document useful (0 votes)
58 views4 pages

DS List

2D arrays can be defined as arrays of arrays organized in rows and columns. They allow for bulk data storage in a relational database-like structure. To declare a 2D array, the syntax is similar to a 1D array but specifies the maximum rows and columns. 2D arrays can be initialized by creating the array, getting input using a scanner, and storing the inputted elements in the array using nested for loops.

Uploaded by

webdegital
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views4 pages

DS List

2D arrays can be defined as arrays of arrays organized in rows and columns. They allow for bulk data storage in a relational database-like structure. To declare a 2D array, the syntax is similar to a 1D array but specifies the maximum rows and columns. 2D arrays can be initialized by creating the array, getting input using a scanner, and storing the inputted elements in the array using nested for loops.

Uploaded by

webdegital
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

2D Array

2D array can be defined as an array of arrays. The 2D array is


organized as matrices which can be represented as the
collection of rows and columns.

However, 2D arrays are created to implement a relational


database look alike data structure. It provides ease of holding
bulk of data at once which can be passed to any number of
functions wherever required.

How to declare 2D Array

The syntax of declaring two dimensional array is very much


similar to that of a one dimensional array, given as follows.

int arr[max_rows][max_columns];

Initializing 2D Arrays

import java.util.Scanner;

public class TwoDArray

public static void main(String[] args)

int[][] arr = new int[3][3];

Scanner sc = new Scanner(System.in);

for (int i =0;i<3;i++)

for(int j=0;j<3;j++)
{

System.out.print("Enter Element");

arr[i][j]=sc.nextInt();

System.out.println();

System.out.println("Printing Elements...");

for(int i=0;i<3;i++)

System.out.println();

for(int j=0;j<3;j++)

System.out.print(arr[i][j]+"\t");

}
}
A linked list is a linear data structure, in which the elements are
not stored at contiguous memory locations. The elements in a
linked list are linked using pointers as shown in the below
image:
In simple words, a linked list consists of nodes where each node
contains a data field and a reference(link) to the next node in
the list.
Linked List Uses:

1)Linked List is Dynamic in Nature

Linked List Data Structure is Dynamic in nature.

We can have to just create Linked List structure and memory


will be allocated at run time i.e while running program.

2 Insertion and Deletion Operations are easy:

Insertion and Deletion operations in Linked List is very flexible.

We can insert any node at any place easily and similarly we can
remove it easily.

3)Memory Utilization:

Memory is allocated at run time as per requirement, so that


Linked list data structure provides us strong command on
memory utilization.

Insertion

The insertion into a singly linked list can be performed at


different positions. Based on the position of the new node being
inserted, the insertion is categorized into the following
categories.

SN Operation Description

1 Insertion at beginning:It involves inserting any element at


the front of the list. We just need to a few link adjustments to
make the new node as the head of the list.
2 Insertion at end of the list:It involves insertion at the last
of the linked list. The new node can be inserted as the only
node in the list or it can be inserted as the last one. Different
logics are implemented in each scenario.

3 Insertion after specified node It involves insertion after


the specified node of the linked list. We need to skip the
desired number of nodes in order to reach the node after which
the new node will be inserted. .

You might also like