Category Archives: data structure algorithm

This page is about data structure and Algorithm

Sorting of Stack in Java

Oracle JavaWell, when I heard first time about sorting of stack, I thought why we required to sort of any stack. Initially I thought , this is rubbish and time pass thing, but later point of time, realize this can be interview question. In-fact, most of the interviewer ask this question, how to sort stack in java. I tried to demonstrate the exercise of writing program of sorting stack in java.
Continue reading Sorting of Stack in Java

How to Implement Fixed Size Stack in Java

Oracle JavaStack is ADT type of data structure which has different implementation for different purpose for fulfilling of different contextual requirement. In this article tried to implement how to implement by using fixed size array based implementation. If you want to know something basic about Stack, you can visit What is Stack Data structure.

Continue reading How to Implement Fixed Size Stack in Java

How to Reverse Array In Java

Oracle Java
Well this my second post to reverse of string. In this post I tried to write how to reverse either string array or int array in java. Although, there are different way do this but I choose in place. you can reverse a string by using library ( prefer library in real life day to day activity in real project). there are different ways: iteration, recursive, in place. This is one of the important interview question which is being asked frequently specially in initial career.
Continue reading How to Reverse Array In Java

How to Convert String to int in Java

Oracle Java
There are various way to convert from string to int in java. It depends where you have to applied this. if any interview will ask then you can ask him/her , library can be used or not. if he/she says yes, then reply by using Integer class to convert but if he wanted to check you logic then you have to chose plain way to convert from string to int. Please ask precondition to Interviewer before replying anything .
Continue reading How to Convert String to int in Java

How to Check two String are Anagram or not in Java

Oracle Java
First of all let us understand what is anagram. if two string having same character in same or different order it means those words are anagram. There are different way to find whether two strings are anagram or not. What are those way , let us explain one by one by using program. This is one of the important question which is being asked by Interview frequently to check the logic.

Continue reading How to Check two String are Anagram or not in Java

How to Reverse String in Java

Oracle Java
There a re different way you can reverse a string by using library, iteration and recursive iteration. This is one of the important interview question which is being asked frequently specially in initial career. The answer is simple but if you reply one way perhaps iteration way, you are being asked to reply in another way perhaps recursive approach. There are so many string based question can be asked .
Continue reading How to Reverse String in Java