Profile cover photo
Profile photo
Rajesh Dixit
47 followers
47 followers
About
Posts

Post has attachment
Java | Reverse a String without using String class function
package com.java.tricks; import java.lang.reflect.Field; public class ReverseString {      /**       * This method is used to reverse string without using any string class method.       */      private static void reverseString(String value ) {            t...
Add a comment...

Post has attachment
Ping an IP address in Java | Java Networking
We
can ping an IP address using java.net.InetAddress.isReachable() method. This
example is by using ProcessBuilder class, Process class. ProcessBuilder class
is used to create operating system processes and ProcessBuilder.start() starts
the sub-process whic...
Add a comment...

Post has attachment
To Maximize the Probability of Red Marble
You
have 50 red balls and 50 blue balls, you have to place these balls in two
containers in such a way that probability of a person picking up a red ball
from any container is maximum. 1. For
Jar 1, You
should have to place one red marble into 1st Jar. By t...
Add a comment...

Post has attachment
Search an element in an unsorted array using minimum number of comparisons
Given
an array and an element, search the element x in the array using minimum number
of comparisons. /**This is generic
algorithm which takes 2n+1  * comparisons(worst case) to search element.
*/ private static int searchElementUsingGenericAlgo( int [] arr...
Add a comment...

Post has attachment
Types of Java Garbage Collectors
In java, Garbage means unreferenced
objects. Garbage
Collection is process of reclaiming the run-time  unused memory automatically. In
other words, it is a way to destroy the unused objects. Garbage collection is
an automatic process in Java which relieves ...
Types of Java Garbage Collectors
Types of Java Garbage Collectors
javaexplorer03.blogspot.com
Add a comment...

Post has attachment
Minimize Cash Flow among the friends who have borrowed money from each other
There
are a number of friends who have to give or take some amount of money from one
another. Task is to design an algorithm by which the total cash flow among all
the friends is minimized. Approach# The approach
is using the Greedy algorithm where
we are s...
Add a comment...

Post has attachment
Check if a singly linked list is palindrome or not
Given
a singly linked list of integers, check whether the linked list is palindrome
or not using O(1) space complexity. In
this approach, we need to modify the existing linked list. 1)
Get the middle of the linked list. 2)
Reverse the second half of the lin...
Add a comment...

Post has attachment
Find next greater number with same set of digits
Given
a number, find the smallest number that has same set of digits as number and is
greater than number. Examples: Input:  329876 Output:
362789 Input:  3689 Output:
3698 Input:
98732 Output:
No possible sequence !! -1 Input:
n = 645987 Output:
647589 App...
Add a comment...

Post has attachment
Abstract Class vs Interface
An
interface is a " contract ".
If a class implements an interface it has to propose all the services listed in
the interface. An
abstract class is a skeleton. It defines a certain way its extended classes
will work while letting them some free space (the a...
Add a comment...

Post has attachment
Find the next smallest palindrome for a number
For a
given a number, find the next smallest palindrome larger than this number. Examples: 1. If
the input number is “3 4 6 5 6”, the output should be “3 4 7 4 3”. 2. If
the input number is “9 9 9 9”, the output should be “1 0 0 0 1”. Approach: There
can be...
Add a comment...
Wait while more posts are being loaded