• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Recurrence relation for methods

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone I came across this question in my textbook but there is no solution for it, so I tried solving it by my own

So can you check it and explain the last part for me

Given Method 1



Method 2:



The first question was what is the function of the both methods: I think that it reverses the given string
however I was stuck at determining the recurrence relation for each method I didn't know how to start or even think so can you help me

Thanks
 
Marshal
Posts: 79278
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You cannot reverse a String. You can create a new String which is the reverse of it, or you can display the String forwards or backwards.
 
Marshal
Posts: 8869
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

mira pareksha wrote:I came across this question in my textbook

Which textbook? I hope given examples were well indented in that book and you just copied incorrectly. Am I right?
Please keep your code well indented. Should look similar to:


[addition] each separate block suppose to be shifted by four spaces to the right. Don't use tab's as these could be interpreted differently in different environments (OS; editors). In case there is an option in your editor, you could make that tab would behave and be equivalent to four spaces.
 
reply
    Bookmark Topic Watch Topic
  • New Topic