Java program to create a Circular Linked List of N nodes and count the number of nodes8 Jan 2025 | 2 min read In this program, we have to find out the number of nodes present in the circular linked list. We first create the circular linked list, then traverse through the list and increment variable 'count' by 1. Algorithm
a. countNodes() will count the number of nodes present in the list.
Program:Output: Nodes of generated doubly linked list: 4 2 5 1 6 3 7 Next TopicJava Programs |
Java program to print the following pattern Algorithm: STEP 1: START STEP 2: SET lines=8 STEP 3: DEFINE i, j STEP 4: SET i=1.REPEAT STEP 5 to 14 UNTIL i STEP 5: SET j=1 STEP 6: REPEAT STEP 7 and 8 UNTIL j <=(lines/2) STEP 7: IF j is equals to...
3 min read
Java Convert int to char We can convert int to char in java using typecasting. To convert higher data type into lower, we need to perform typecasting. Here, the ASCII character of integer value will be stored in the char variable. To get the actual value in char...
2 min read
In this program, we will create a circular 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...
9 min read
It is 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 to...
6 min read
In this program, we need to find out the duplicate words present in the string and display those words. Example: big black bug bit a big black dog on his big black nose To find the duplicate words from the string, we first split the string into...
3 min read
In this program, we will create a doubly linked list and insert every new node at the end of the list. If the list is empty, then head and tail will point to newly added node. If list is not empty then, insert the new...
5 min read
Java String to long We can convert String to long in java using Long.parseLong() method. Scenario It is generally used if we have to perform mathematical operations on the string that contains long number. Whenever we get data from textfield or textarea, entered data is received as a string....
1 min read
In this program, we will create a singly linked list and delete a node from the middle of the list. To accomplish this task, we will calculate the size of the list and then divide it by 2 to get the mid-point of the list....
5 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, we need to create a binary search tree, delete a node from the tree, and display the nodes of the tree by traversing the tree using in-order traversal. In in-order traversal, for a given node, first, we traverse the left child then...
11 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