![]() Preserved Topic: Java Question (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: Weddington, NC, US |
![]() 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 |
![]() 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 |
![]() The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
![]() The poster has demanded we remove all his contributions, less he takes legal action. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() 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 |
![]() 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 |
![]() 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 |
![]() 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 |
![]() The reason for the 2's is so your string will follow the following metamorphisis |