Java program to delete a node from the end of the Circular Linked List17 Mar 2025 | 3 min read In this program, we will create a circular linked list and delete a node from the end of the list. If the list is empty, it will display the message "List is empty". If the list is not empty, we will loop through the list till second last node is reached. We will make second last node as the new tail, and this new tail will point to head and delete the previous tail. ![]() Circular linked list after deleting node from end ![]() Here, in the above list, D is the last node which needs to be deleted. We will iterate through the list till C. Make C as new tail and C will point back to head A. Algorithm
a. display() will show all the nodes present in the list.
Program:Output: Original List: 1 2 3 4 Updated List: 1 2 3 Updated List: 1 2 Updated List: 1 Updated List: List is empty Next TopicJava Programs |
Java Convert Octal to Decimal We can convert octal to decimal in java using Integer.parseInt() method or custom logic. Java Octal to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts a string to an int with the given radix. If you pass 8 as a radix, it converts an octal...
2 min read
In a Jail, a corridor is provided. The length of the corridor is L units. An array lightArr[] is given, which is also of the size L. The lightArr[] contains only to values 0 & 1. At each unit of the corridor a light is given....
14 min read
Java Program to transpose matrix Converting rows of a matrix into columns and columns of a matrix into row is called transpose of a matrix. Let's see a simple example to transpose a matrix of 3 rows and 3 columns. public class MatrixTransposeExample{ public static void main(String args[]){ //creating a matrix int...
3 min read
It is a problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, HCL, IBM, and Accenture, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section, we are...
4 min read
In this program, we need to find the most repeated word present in given text file. This can be done by opening a file in read mode using file pointer. Read the file line by line. Split a line at a time and store in...
4 min read
In this program, we need to check whether given matrices are equal or not. Two matrices are said to be equal if and only if they satisfy the following conditions: Both the matrices should have the same number of rows and columns. Both the matrices should have the...
5 min read
In this program, we create a circular linked list and insert a new node in the middle of the list. If the list is empty, both head and tail will point to new node. If the list is not empty, then we will calculate the...
8 min read
How to Reverse a String in Java Word by Word In this section, we reverse a string in Java word by word. Example 1: Reverse a string word by word using recursion import java.util.Scanner; public class ReverseStringExample1 { public static void main(String[] args) { String str; System.out.println("Enter a string: "); Scanner scanner =...
1 min read
It is a very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, Accenture, Adobe, Apple, Infosys, etc. By solving the problem, one wants to check the logical ability, critical thinking, and problem-solving skill of the interviewee. So, in this section,...
5 min read
Java Convert Binary to Decimal We can convert binary to decimal in java using Integer.parseInt() method or custom logic. Java Binary to Decimal conversion: Integer.parseInt() The Integer.parseInt() method converts string to int with given redix. The signature of parseInt() method is given below: public static int parseInt(String s,int redix) Let's see...
2 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India