Java program to create a Circular Linked List of n nodes and display it in reverse order8 Jan 2025 | 3 min read In this program, we create a circular linked list, then traverse the list in the reverse order and print the nodes. Algorithm
a. display() will show all the nodes present in the list.
a. reverse() will print the circular linked list in reverse order.
Program:Output: Original List: 1 2 3 4 5 6 Reversed List: 6 5 4 3 2 1 Next TopicJava Programs |
In this program, we will create a doubly linked list and delete a node from the middle of the list. If the list is empty, display the message "List is empty". If the list is not empty, we will calculate the size of the list...
7 min read
The natural numbers are the numbers that include all the positive integers from 1 to infinity. For example, 1, 2, 3, 4, 5, ......, n. When we add these numbers together, we get the sum of natural numbers. In this section, we will create the following programs: Java...
3 min read
In this program, we need to check whether all the leaves of the given binary tree are at same level or not. A Node is said to be leaf if it doesn't have any child node. In the below diagram, nodes 4, 5 and 6 are...
5 min read
Java Program to add two matrices We can add two matrices in java using binary + operator. A matrix is also known as array of arrays. We can add, subtract and multiply matrices. To subtract two matrices, use - operator. Let's see a simple example to add two...
1 min read
Java Convert String to boolean We can convert String to boolean in java using Boolean.parseBoolean(string) method. To convert String into Boolean object, we can use Boolean.valueOf(string) method which returns instance of Boolean class. To get boolean true, string must contain "true". Here, case is ignored. So, "true" or "TRUE"...
1 min read
In this program, all the subsets of the string need to be printed. The subset of a string is the character or the group of characters that are present inside the string. All the possible subsets for a string will be n(n+1)/2. For example, all possible subsets...
2 min read
Java Convert String to double We can convert String to double in java using Double.parseDouble() method. Scenario It is generally used if we have to perform mathematical operations on the string that contains double number. Whenever we get data from textfield or textarea, entered data is received as a...
1 min read
In this program, we need to create a doubly linked list and rotate it by n node. This can be achieved by maintaining a pointer that starts from the head node and traverses the list until current points to the nth node. Move the list...
7 min read
: The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. The formula for calculating the factorial of a number n is: n! = n * (n-1) * (n-2) * ... * 2 * 1 Factorial of...
6 min read
It is a very interesting problem frequently asked in interviews of top IT companies like Google, Amazon, TCS, 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 going...
19 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