Selection Sort Implementation in Java Example

Selection Sort Implementation in Java Example:   Psudeocode for selection sort: Take an array with N elements (say new long[]{3,3009, 76,172,271,2}) Outer for loop to iterate all the elements in the array. (index starts from 0) Create a currentMinimum variable with index value(initially 0) Create a nested for loop to iterate from innerIndex(index+1) (because till index it is already sorted,

283 total views, no views today

» Read more

Reversing a string using Stack Implementation

In our previous post, we saw how to create a custom stack implementation in java.¬†Today we are going to extend the same implementation to perform additional operations like reversing, checking empty or full etc. Approach 1: [Simple & Best Approach]   We have used the same Stack class from this post [Java Stack Implementation Simple Example]¬†with small modification like array

278 total views, no views today

» Read more