I'm an idiot.  Need Recursion assistance.

I need help writing a simple program that finds the largest value in an array using recursion (yes, an assignment. Simple one at that). Can anyone point me in the right direction? My teacher is of no help at all.

public class LargeTest
     public static void main(String[] args)
          LargeArray thelarge = new LargeArray();
          System.out.println(thelarge.getLarge(0));
public class LargeArray
     public int n;
     public int[] a;
     public int large;
     public LargeArray()
          n = 0;
          int[] a = { 2, 3, 9, 7, 5 };
          int large;
     public int getLarge(int n)
          if (a[n + 1] < a[n])
               large = a[n];
          if ((n + 1) < a.length)
               getLarge(n + 1);
          return large;
Sorry, still an idiot. This code compiles, but doesn't run. This is the jGRASP error:
----jGRASP exec: java LargeTest
java.lang.NullPointerException
     at LargeArray.getLarge(LargeArray.java:17)
     at LargeTest.main(LargeTest.java:8)
Exception in thread "main"
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

Similar Messages

  • How do i install mySQL on my macbook air,please i need the assistance urgently,because i need to use the program for my course.

    how do i install mySQL on my macbook air.please i need urgent assistance,as it would help me do my course work.
    regarde garabella.

    Call AppleCare and ask them to send you a replacement set. They will charge you a nominal fee for shipping and handling.
    Allan

  • InDesign Newbie in need of assistance

    Hi,
    I hope I am in the right place.
    I need to produce a book, and am looking for a bit of guidance.
    The templates have been created in Photoshop. I will also need to include photos and text and am wondering I am better of (for quality purposes) adding the text and photo's in InDesign or Photoshop.
    Thanks
    B

    ALWAYS include your version of InDesign and your OS in your post. We cannot help you if we don’t know what tools you have available. ALWAYS include some hint of your problem in your subject line. “InDesign Newbie in need of assistance” tells us nothing, since this forum is for InDesign users (noobs and otherwise) in need of assistance.
    Use InDesign. If your book has more than one page, has any text in it, has anything bleeding (printing to the edge of the page), or will be printed professionally, then InDesign wins over Photoshop in a first round knock out.
    Import the photos without text, then add the text in InDesign. You can place the photos with the text so you can see how to format and position the text in InDesign, then hide the text layers in the Photoshop file by right-clicking on the image in InDesign and selecting Object Layer Options.

  • Hello Apple. Yesterday I have purchased app «OS X Mountain Lion», but it didn't download completely and disappeared from my purchased list. Need you assistance.

    Hello Apple.
    Yesterday I have purchased app «OS X Mountain Lion», but it didn't download completely and disappeared from my purchased list.
    Need you assistance.

    See if the purchase is hidden:
    http://support.apple.com/kb/HT4928

  • HT1222 I visited the USA and bought an Apple iPhone 4 5.1.1, the latest model.  I would like to unlock it and use in my country.  How can I get it unlocked so the I can use my local micro sim card?  What info about it do you need to assist me in unlocking

    I visited the USA and bought an Apple iPhone 4 5.1.1, the latest model.  I would like to unlock it and use in my country.  How can I get it unlocked so the I can use my local micro sim card?  What info about it do you need to assist me in unlocking it?

    Sounds like you bought an AT&T no contract phone. You will need to contact AT&T for unlocking but they are only doing so for current and previous account holders. If you have never had service with them they will not unlock your phone.

  • I visited the USA and bought an Apple iPhone 4 5.1.1, the latest model.  I would like to unlock it and use in my country.  How can I get it unlocked so the I can use my local micro sim card?  What info about it do you need to assist me in unlocking it?

    I visited the USA and bought an Apple iPhone 4 5.1.1, the latest model.  I would like to unlock it and use in my country.  How can I get it unlocked so the I can use my local micro sim card?  What info about it do you need to assist me in unlocking it?

    Contact the original cellular provider, as they are the only ones that can provide unlocking.

  • I have been on hold for 40 mins 16 sec Need tech assistance!

    I have been on hold for 40 mins 16 sec Need tech assistance!

    One Horse wrote:
     …Photoshop CS4 will not install on a new MacPro…
    Did you happen to remove a previously installed trial or regular copy of CS4 or a CS3 installation improperly?
    "Improperly" means by any other means other than using the respective Adobe Uninstallers in Applications/ Utilities/ Adobe/ ….
    For instance, if you dragged anything to the trash.  That would have been improper starting with CS3.  Previous versions could be trashed, but no more.
    If that was the case you need to look for the CS3Clean and CS4Clean scripts on the Adobe site, download them and run them.

  • Apparently the default country for an account is US. I want it changed to Netherlands without having to call customer service. In need of assistance please.

    Hi,
    Apparently the default country for an account is US. I want it changed to Netherlands without having to call customer service. In need of assistance please, is there someone from Adobe on this forum who can help me? Or does someone know an email address?
    thanks!
    Arjan de Jong

    Change/Verify Account https://forums.adobe.com/thread/1465499 may help
    -http://helpx.adobe.com/x-productkb/policy-pricing/change-country-associated-with-adobe-id. html

  • Need some recursion assistance

    Hello,
    I'm trying to understand recursion,. I understand most of it, but this one thing is confusing me.
    public class recursion {
         public static void main(String[] args) {
              System.out.println(t(5));
         public static int t(int n) {
              if (n == 1 || n == 2) {
                   return 2 * n;
              else {
                   return t(n - 1) - t(n - 2);
    }I'm trying to understand the process for doing this recursion. -4 gets outputted from t(5), but I don't understand how to get that answer.
    I understand that t(n - 1) is called, and when it reaches 2, the base case is true. The part that confuses me is the t(n - 2) and how that comes into play. Can anyone help?

    E11 wrote:
    t(5)
    = t(4) - t(3)
    = (t(3) - t(2)) - (t(2) - t(1))
    = ((t(2) - t(1)) - t(2)) - (t(2) - t(1))
    = ((4 - 2) - 4) - (4 - 2)
    = (2 - 4) - (4 - 2)
    = -2 - 2
    = -4Nicely done.

  • DAQmx driver for DAQ 6009? Need DAQ Assistant in Block Panel palette.

    Do I understand things right?  The Ni USB DAQ 6009 is supported in DAQmx base and not DAQmx, or is this only true for the 6008? I need the DAQ Assistant in my LV 2009 Block Panel palette.  Do I go to my Ni-DAQmx 8.8 CDs, or do I download something.  Maybe I have the DAQmx base already?  I'm going to search my palette and NI Max.  I am also going to look at http://www.ni.com/support/daq/version_portable.htm#du.   If I'm going about this all wrong, please help.
    Thanks
    Norm

    Hi Dennis
    My DAQmx Cds are 8.8.  I don't  have a selection for the DAQ Assistant on my block panel palette, so I'm looking to get an update for my DAQmx driver for my USB 6009 DAQ that I'll be using with my  student software for LabVIEW 2009 version 9.0.  I've looked at a NI document "NI-DAQmx and NI-DAQ Driver Support: Portable Devices"  that was published on Jan 17, 2013.  It says for Windows 7 I should be using 9.6mx, but this document make no reference to a version of LabVIEW.  The date of the document is 1/17/13; maybe it is refering to  only to version LabVIEW 2013.  Can you help?  
    From what I've read I believe I need to use DAQmx and not DAQmx base, but I can't help wondering if the DAQmx base has something to do with the "NI DAQmx Device Basics" that I see on the right side of the screen when I'm in NI MAX getting ready to run the test panels.    ????? 
    Thank you for your time
    N.D.

  • Idiot needs help increasing speed of motion template "blizzard".

    I need to overlay some snow over an existing shot done on exterior location with snow machines.
    I've found the "blizzard" setup in motion and, since I really don't know motion at all, I want to ask if a kind expert out there can help me simply on how to speed it up, so that the snow falls/moves faster.
    Please understand that I can't learn "Motion" in order to do this one effect and I'd appreciate it if you guys and gals would not berate me for being so lazy as to ask for your help on this one issue.
    Many thanks if you can and will help,
    Best wishes,
    An idiot,
    Harry

    This is just an FYI on forum use - Please click on the or buttons over posts as appropriate - you not only reward those who answer your questions, but point future readers to where you found your answers...
    Patrick

  • I need immediate assistance!

    I just noticed my verizon lan line is not working. I use this line for business calls mostly so I need it working asap. There is no dial tone. I have checked the box and it is working. I went through the online support and still nothing. Please help

    It looks like your issue may require technical assistance. Please visit our Support page for a variety of ways to contact Verizon, including “Ask Verizon,” our virtual chat agent..

  • I need migration assistance

    I have an old iMac (lampshade) that I want to migrate over to an Intel iMac. However, I need to run Tiger on the Intel due to a compatibility issue with one of the apps that I'm running on the current lampshade iMac.
    So, what is the best way to do this? I don't want to use Migration Assistant because the new iMac has Leopard on it. I guess I basically need to clone the old computer and install it on the new Mac. Do I do this through target disk mode and then use Carbon Copy Cloner or something like that? Any advice would be appreciated.
    Thanks, Greg

    You've got some cross purpose statements. You say you want Tiger on the Intel machine so you can run certain applications, but you say you don't want to to clone because you don't want to erase the Leopard install, or...?
    All the above is moot. If the intel Mac came with Leopard originally it will not run Tiger, period. If it came with Tiger originally (a few models did for a short period) it will run Tiger so reinstall the Intel version of Tiger on it because you can't migrate a PPC version onto an Intel computer. If it is a Tiger-capable computer and you want both Leopard and Tiger on it you will need to partition the drive so you can have a dual boot computer. Let us know exactly what model computer you have.

  • I need bootcamp assistant original Info.plist please

    Hello,
    I am currently trying to run windows 7 on my mac through bootcamp. I have a 2010 macbook pro and so it requires a CD to install windows 7. I know you can alter the Info.plist file so that bootcamp assistant can recognize a USB version of windows 7 for the install.
    I was correctly fixing the Info.plist code, saved it to my desktop, all that good stuf...until, like a moron, I dragged it from my desktop right over the original Info.plist file which I had named InfoOLD.plist so I knew which was which. By doing this I think it like combined the two and there are duplicate lines of code, and I am not great with coding stuff unless im following strict guidlines, or a tutorial walking me through it.
    If someone can give me the correct bootcamp assistant Info.plist I can copy and paste that so that it reverts it to the one it came with. Then when I alter it, I will drag it into the white space of the finder folder so I will have two info.plist folders, the original one and the modified one with the USB radio button coded in.
    Whoever decides to help, I am happy to answer any questions you need regarding what type of macbook pro I have exactly, to ensure I am getting the right bootcamp assistant Info.plist.
    Thank you!

    HI and welcome to Apple Discussions...
    Try posting in the BootCamp Forum
    Carolyn

  • Do I have a virus/malware problem? Idiot needs help

    Hello, Received an email from 'Royal Mail Global' saying that they had failed in delivering a package and to open the attached '.zip' file. Without thinking, I opened the file- it didn't launch anything. I realise this is incredibly stupid and I am mortified. However, I am now concerned that I have a virus, malware, etc. As I am a computer idiot: how do I check if a virus is on the system or a malware programme is stealing all my details? People say "you'll be ok, Mac's don't get virsus" but how do you know? I have encountered no issues, as yet.... I run OS X and have a mac mini. Please help- will be eternally grateful. Thank you in advance

    MacHagan wrote:
    Hello, Received an email from 'Royal Mail Global' saying that they had failed in delivering a package and to open the attached '.zip' file. Without thinking, I opened the file- it didn't launch anything.
    First of all, your Lion OS would have notified you if that was anything currently known to be dangerous. If it was malware it was almost certainly designed for Windows and of no consequence to OS X. If you are certain that the email is spam/junk/hoax then use the delete button in your e-mail client to get rid of it. Check the trash folder and delete it from there, if necessary. If this is a Gmail account, let me know as there may be one more step.
    When you say you opended the file, I assume you used an open button or double-clicked the attachment symbol? And then it didn't launch anything, but it should have launch the Archive Utility to unzip the attachment. Did that not happen? Did you see anything after you "opened it"?
    Even if it was unzipped, sitting in an attachment folder somewhere and is malware, it won't do anything at all until you attempt to open it. And as I said previously, it's almost certainly for Windows users, anyway.
    If you followed the suggestion to use ClamXav (or any other A-V software), there are some special considerations regarding e-mail. Here are my standard cautions:
    Never use ClamXav (or any other A-V software) to move (quarantine) or delete e-mail. It will corrupt the mailbox index which could cause loss of other e-mail and other issues with functions such as searching. It may also leave the original e-mail on your ISP's e-mail server and will be re-downloaded to your hard drive the next time you check for new mail.
    So, if you choose to "Scan e-mail content for malware and phishing" in the General Preferences, make sure you do not elect to either Quarantine or Delete infected files.
    When possibly infected e-mail files are found:
    Right-click/Control-click on either the infection or file name in the ClamXav window.
    Select "Reveal In Finder" from the pop-up menu.
    When the window opens, double-click on the file to open the message in your e-mail client application.
    Read the message and if you agree that it is junk/spam/phishing then use the e-mail client's delete button to delete it (this is especially important when the word "Heuristics" appears in the infection name).
    If you disagree and choose to retain the message, return to ClamXav and choose "Exclude From Future Scans" from the pop-up menu.
    If this is a g-mail account and those messages continue to show up after you have deleted them in the above manner, you may need to log in to webmail using your browser, go to the "All Mail" folder, find the message(s) and use the delete button there to permanently delete them from the server.
    For instructions on how to handle any infections that do not involved e-mail, use the Help menu or go directly to this link Dealing with Infected Files.

Maybe you are looking for

  • APEX Listener as a replacement for modplsql ?

    Will APEX Listener ever be, or is it able to be now, a replacement for modplsql driven applications that are not APEX. It seems that it already takes care of everything needed to be a full scale modplsql replacement... In all honesty looking to see i

  • One report or three reports?

    Hi guys, I have three reports in SAP BW (im using SAP BI 7.0): 1) Credit Management 2) Sales 3) Profit Center Each report has it´s own view, data source and infocube. So for example the customer number, company code are the same. The key figures are

  • MSMPENG Requiring large amounts of CPU Time

                     <---Time This is a picture of the CPU consumption on a multiprocessor cpu activity monitor on Win 7 SP1 running a Sandybridge Extreme. I know there was a problem during XP days. This has been going on for about an hour and one half.

  • Blank Labels in frame

    G'day, New to Java and having trouble working out how to use the GUI functionality correctly. I have a frame and container initiated in this way inside a function:           JPanel frame2= null;           frame2 = new JPanel();           JFrame mycon

  • Grants needed for form on procedure in other schema

    Hi, I'm running Apex 4.1.0.00.32 and want to create a form on a procedure in a package. My package is not in the parsing schema. The wizard lets me select the schema of the package ("procedure owner") and lists package.procedure in the list. When I c