Class 12 ISC- Java

Class 12th Java aims to empower students by enabling them to build their own applications introducing some effective tools to enable them to enhance their knowledge, broaden horizons, foster creativity, improve the quality of work and increase efficiency.
It also develops logical and analytical thinking so that they can easily solve interactive programs. Students learn fundamental concepts of computing using object oriented approach in one computer language with a clear idea of ethical issues involved in the field of computing
Class 12th java topics includes revision of class 11th, constructors, user-defined methods, objects and classes, library classes , etc.


Linked List

  • Linked list is also a data structure that stores data in linear form. In this the data is stored dynamically, you can store as many elements as you want to store inside it later.

  • In linked list we have nodes. Nodes carries two things inside it one is data part and other is reference of next node.


  • It requires the refrence of next node so that we can traverse further inside linked list.



Creation of Linked list :

  • So suppose we created a node and we had to store data 18.


    A node is created inside memory as shown above.

  • If you want to add next element inside it. Suppose 16 so first you go to last element and check whether element is there after it (i.e. next == null). So next element will be created as shown below :



Insertion in Linked List :

If any new element is to be added in link list then new node is inserted with data part along with the reference to the next node as shown below :


Deletion in Linked List :

If you need to delete an element from the linked list then you have to only change the reference address and then the node will be deleted as shown in the example below :

Before Deletion :



After Deletion :



Difference between Array and Linked List :

Linked list is also a data structure that stores data in linear form, array also does the same work. Array also stores data in linear form let us talk about what is the difference between array and linked list.

In array you first define what is the size of array going to be when you initialise it. So that memory is pre allocated. In this way elements are stored in continuous manner inside the memory.



But in linked list you do not define its size in starting. Elements are stored dynamically in linked list, you can store as many elements as you want inside it later. You cannot do this thing in arrays.

Program :



Testing Linked List :


Contact Us

REACH US

SERVICES

  • CODING
  • ON-LINE PREPARATION
  • JAVA & PYTHON

ADDRESS

B-54, Krishna Bhawan, Parag Narain Road, Near Butler Palace Colony Lucknow
Contact:+ 919839520987
Email:info@alexsir.com