Java
code7.png
Circular Linked List
Algorithm
* Define a Node class which represents a node in the list. It has two properties data and next which will point to the next node.
* Define another class for creating the circular linked list and it has two nodes: head and tail. It has two methods: add() and display() .
* add() will add the node to the list:
* It first checks whether the head is null, then it will insert the node as the head.
* Both head and tail will point to the newly added node.
* If the head is not null, the new node will be the new tail, and the new tail will point to the head as it is a circular linked list.
a.display() will show all the nodes present in the list.
* Define a new node 'current' that will point to the head.
* Print current. data till current will points to head
* Current will point to the next node in the list in each iteration.
Algorithm
* Define a Node class which represents a node in the list. It has two properties data and next which will point to the next node.
* Define another class for creating the circular linked list and it has two nodes: head and tail. It has two methods: add() and display() .
* add() will add the node to the list:
* It first checks whether the head is null, then it will insert the node as the head.
* Both head and tail will point to the newly added node.
* If the head is not null, the new node will be the new tail, and the new tail will point to the head as it is a circular linked list.
a.display() will show all the nodes present in the list.
* Define a new node 'current' that will point to the head.
* Print current. data till current will points to head
* Current will point to the next node in the list in each iteration.
Print Program in Java (Another way)
You can also use a method where number or string is not predefined. Here, user has to put the number or string as input to check if the number/string is palindrome.
Palindrome number algorithm
* Get the number to check for palindrome
* Hold the number in temporary variable
* Reverse the number
* Compare the temporary number with reversed number
* If both numbers are same, print "palindrome number"
* Else Print "not palindrome"
#Source_code
#13
You can also use a method where number or string is not predefined. Here, user has to put the number or string as input to check if the number/string is palindrome.
Palindrome number algorithm
* Get the number to check for palindrome
* Hold the number in temporary variable
* Reverse the number
* Compare the temporary number with reversed number
* If both numbers are same, print "palindrome number"
* Else Print "not palindrome"
#Source_code
#13
Media is too big
VIEW IN TELEGRAM
Java class initialization Everything you never wanted to know.
#Video
#Video
Java Program to find Sum of Natural Numbers
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.
#Source_code
#78
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.
#Source_code
#78
code.png
686.8 KB
Java program to find the maximum and minimum value node from a doubly linked list.
#Source_code
#Doubly_linked_list
#Data_structure
#Source_code
#Doubly_linked_list
#Data_structure
Java
Java Program to determine whether two matrices are equal #Source_code #106
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 same corresponding elements.
* Both the matrices should have the same number of rows and columns.
* Both the matrices should have the same corresponding elements.
Java
code.png
Insertion of a new node into the list, above given the source code for particular problem solving in java programming language.
#107
#107
Anagram Program in Java Using sort() and equals() Methods
What is Anagram ?
Two string are called anagrams if they contain same set of characters but in different order For example, "keep-peel", "Dormitory - Dirty Room" are some anagrams.
#Source_code
#108
What is Anagram ?
Two string are called anagrams if they contain same set of characters but in different order For example, "keep-peel", "Dormitory - Dirty Room" are some anagrams.
#Source_code
#108