Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
Jobreceive.com for sale
Blogerwiki
Updated:
Yesterday at 8:55 PM
Post Your Vehicle for Sale — FREE! - https://libro.lk
Kalu_Puth
Updated:
Yesterday at 7:38 PM
ඔයාගෙ Assignment හෝ Thesis එක හරියට හදාගමු
ErMurazor
Updated:
Saturday at 10:52 PM
Ad icon
BlackWall V2ray servers
hu KANNA
Updated:
Sep 23, 2026
Peppa Pig Family Plush Toy Set – 5 Characters
anil1961
Updated:
Sep 19, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Thread for Programming and Realeted Topics
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="rclakmal" data-source="post: 6018953" data-attributes="member: 98858"><p>Sry Bro ....Had lots of work this week !! So couldn't reply !!</p><p></p><p>I gave a try !! </p><p></p><p>[code]</p><p>package example1;</p><p></p><p>import java.util.LinkedList;</p><p>import java.util.Random;</p><p>import java.util.Scanner;</p><p>import java.util.TreeSet;</p><p></p><p>class Permutations {</p><p></p><p> static LinkedList numbers = new LinkedList();</p><p> static TreeSet permutations = new TreeSet();</p><p> static Scanner input = new Scanner(System.in);</p><p></p><p> public void getInput() {</p><p> int i;</p><p> do {</p><p> System.out.println("Enter a negative number to stop entering the numbers");</p><p> i = input.nextInt();</p><p> if (i >= 0) {</p><p> numbers.add(i);</p><p> }</p><p> } while (i >= 0);</p><p></p><p> }</p><p></p><p> public void getPermutations() {</p><p> Random r1 = new Random();</p><p> int size = numbers.size();</p><p> LinkedList tmpNumbers=new LinkedList();</p><p> do {</p><p> tmpNumbers.addAll(numbers);</p><p> String s = "";</p><p> int tmpRandom;</p><p> while (tmpNumbers.size() > 0) {</p><p> tmpRandom = r1.nextInt(tmpNumbers.size());</p><p> s += "" + tmpNumbers.get(tmpRandom);</p><p> tmpNumbers.remove(tmpRandom);</p><p> }</p><p> permutations.add(s);</p><p> </p><p> } while (permutations.size() < calculateSize(size));</p><p> }</p><p></p><p> static int calculateSize(int number) {</p><p> int fib = 1;</p><p> for (int i = number; i > 0; i--) {</p><p> fib *= i;</p><p> }</p><p> return fib;</p><p> }</p><p></p><p> public static void main(String[] args) {</p><p> Permutations p1 = new Permutations();</p><p> p1.getInput();</p><p> System.out.println("You input =" + numbers);</p><p> System.out.println("****Non Repeating Permutations****");</p><p> p1.getPermutations();</p><p> System.out.println(permutations);</p><p> }</p><p>}</p><p></p><p>[/code]</p></blockquote><p></p>
[QUOTE="rclakmal, post: 6018953, member: 98858"] Sry Bro ....Had lots of work this week !! So couldn't reply !! I gave a try !! [code] package example1; import java.util.LinkedList; import java.util.Random; import java.util.Scanner; import java.util.TreeSet; class Permutations { static LinkedList numbers = new LinkedList(); static TreeSet permutations = new TreeSet(); static Scanner input = new Scanner(System.in); public void getInput() { int i; do { System.out.println("Enter a negative number to stop entering the numbers"); i = input.nextInt(); if (i >= 0) { numbers.add(i); } } while (i >= 0); } public void getPermutations() { Random r1 = new Random(); int size = numbers.size(); LinkedList tmpNumbers=new LinkedList(); do { tmpNumbers.addAll(numbers); String s = ""; int tmpRandom; while (tmpNumbers.size() > 0) { tmpRandom = r1.nextInt(tmpNumbers.size()); s += "" + tmpNumbers.get(tmpRandom); tmpNumbers.remove(tmpRandom); } permutations.add(s); } while (permutations.size() < calculateSize(size)); } static int calculateSize(int number) { int fib = 1; for (int i = number; i > 0; i--) { fib *= i; } return fib; } public static void main(String[] args) { Permutations p1 = new Permutations(); p1.getInput(); System.out.println("You input =" + numbers); System.out.println("****Non Repeating Permutations****"); p1.getPermutations(); System.out.println(permutations); } } [/code] [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom