Mark Nasr

Ranch Hand
+ Follow
since Mar 24, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Nasr

This is the solution I found
8 years ago
I solved the problem thanks guys
8 years ago
My method should do something similar to this
8 years ago

Campbell Ritchie wrote:Aha. Have you got an algorithm to create those permutations?

Why are you using a Queue?


No I have to create all the permutations in this method. I am using a Queue to hold the variables while going over the variables again in the for loop.
I should be using something similar to this method.
8 years ago
Sorry for the lack of information. This is what is asked "given an alphabet of N symbols and a size SZ, generates all partial permutations of the alphabet that has the size smaller than or equal SZ."
and an example
"for alphabets {a,b,c,d}
size=3 alphabet size=4
a;b;c;d;ab;ac;ad;ba;bc;bd;ca;cb;cd;da;db;dc;abc;abd;acb;acd;adb;adc;bac;bad;bca;bcd;bda;bdc;cab;cad;cba;cbd;cda;cdb;dab;dac;dba;dbc;dca;dcb;"
From what I unndrstand is that getSize() (which is the size = 3 above) returns the size which is used to generate all the possible letter combinations up to that size number and the alphabet size is the size of the alphabet array which is given.
@Knute size should only return 1 or more
8 years ago
Hey guys, I have an assignment and part of it is about getting the partial permutation of n numbers using LinkedQueue.
I started on the method but it keeps going on an infinite loop when I set s to an empty string (showed in the code by //here) but when I don't it only returns the variables for example if alphabet contains a,b,c,d it return abcd and that's it. I think it could be solved (or maybe not) when I change the while loop condition but I am not sure what to go with.


I have another method that will check for repeated variables that I will use when I am done with this method.
8 years ago

Campbell Ritchie wrote:Mark Nasr,
I have merged your topic into this topic. I hope that helps.


Thanks, but I already fixed the problem.
8 years ago

Campbell Ritchie wrote:And what was the solution?


I had to use all the code for the TextField in this class and create a method in the other class to add it to the panel
8 years ago
Can anyone help me find why these 2 classes giving me NullPointerException? I know its a lot of code but bear with me guys.





There are another 2 classes that I didn't post here
I get NullPointerException on
8 years ago
Hey I am trying to make an instance of a class that has the parameter of this class in its constructor, but its giving me null pointer exception.

8 years ago

Knute Snortum wrote:I believe you can access a field from the actionPerformed() method if you pass in the object that needs the setText() to the class that encloses the anonymous class. So like this:



This code is just giving you the idea. ActionPerformer is just a name I gave to the interface that has actionPerformed() in it.


Thanks, that is a great idea and would work great if I am using 1 or 2 buttons , but sadly I am using 81 buttons in an array of 9 x 9 so setting them all in the constructor would be crazy
8 years ago

Knute Snortum wrote:I (now) don't think it will work to have a static method because setText() acts on an object, right? And a static method has no object instance.


Yea thats what I thought but when you told me about changing it to static I thought maybe it could work.
Would it help if I add more code here?
8 years ago
Lets say I change it to static or create another method that is static Will it work normally(change the labels of the buttons without a problem) I am asking because I haven't practiced much with static methods I usually only create non static methods to use with objects
8 years ago
Yea but sadly I cant pass the class because its an implemented method changing it will give me an error
8 years ago