• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can someone please help me re-write this pseudo code?  RSS feed

 
Michael Johnsons
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been working with a code that uses recursion (non-tail recursion) to do a powerset. There are a few lines that I could do in english, but not sure how to write in code...


Thank you! Any help is appreciated.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

What is StringList; why are you not using the standard List / ArrayList?

The "for each string x in partial" suggests that you have to loop over the elements of the StringList that partial refers to, but we can't tell you how to do that because we don't know what methods class StringList has to do this. Likewise for line 14; we don't know what methods StringList has to insert elements.

If you would be using a standard List or ArrayList, you could do something like this:

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!