Preserved Topic: Java Question (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Weddington, NC, US |
posted 02-10-2004 14:41
class question => A string contains only '0' and '1' characters and spaces. Write a method that takes such a string and makes and returns a "negative" string in which all 0's are replaced with 1's and 1's with 0's. Your methos must rely only on String's methods and not use any iterations or recursion. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 02-10-2004 17:37
AFAIK there isn't a "negative" string. I believe this was just the term used for the question. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-10-2004 18:22
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 02-10-2004 19:13
The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 02-10-2004 19:20
Nope recursion is only when a function calls itself not multiple calls to the same function. |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 02-11-2004 02:04
How about an example of the two: code: public Node findXinTree(Node root, int x){
code: public int findXinVector(Vector v, int x){
|
Nervous Wreck (II) Inmate From: Weddington, NC, US |
posted 02-11-2004 14:45
thanks for the help, my classmate and I came up with this, but I think it has the same problem as the first thing I posted |
Maniac (V) Inmate From: Cell 666 |
posted 02-11-2004 15:04
Whenever you have to "swap" two elements (like in sorting), chances are you're going to need a temporary placeholder for one of the elements so you don't lose it. This is something to keep in mind for tests and assignments, as (in my case anyhow) it comes up often. |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 02-11-2004 20:55
The reason for the 2's is so your string will follow the following metamorphisis |