Finding a local minimum

im trying to write some code that can find the local minimums in an array of integers. for example in
[8 7 6 5 4 5] the 4 would be a local min. Heres my code so far
public class Localmin
    public static void main (String args[])
        int[] array = {10,9,8,7,6,5,4,3,2,3};
        int x;
        int counter = 0;       
        for(int i = 1; i < array.length-1; i++)
            if(array[ i ] <= array[ i-1] && array[ i ] <= array[ i+1 ])
                x = array; //saves minimum position
counter++; //saves number of minimums found
else
x = array.length-1;
System.out.println("minimum is at: " +x);       
Compiling this above it says 'x has not been initialized', and when I include the print statement inside the for loop, it gives an array out of bound message.
But if I run the loop with just x = array[i] then it prints each statement with no problems. I think the if statement must be incorrect, but I cant spot a fault. Can anyone see what the problem is?
-t

couldnt find an edit button, thats last bit was supposed to be:
But if I run the loop with just x = array[i| then it prints each statement with no problems. I think the if statement above must be incorrect, but I cant spot a fault. Can anyone see what the problem is?
and for my example [8 7 6 5 4 5], the 4 would be a local min as the 2 numbers either side of it are greater. (the 1st and last variables in an array cant be mins as they have nothing to compare to on one of their sides).
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Can I use my ipad in australia with my o2 sim card to find a local carrier like my iphone does?

    Can I use my ipad with an o2 sim card to to find a local carrier like I can with my iphone ?

    Yes. You need a wall plug adater for the countries you will be travelling to.
    Post iPad 2 iPads work worldwide. Read the specifications.
    http://www.apple.com/ipad/specs/
    http://www.apple.com/ipad/LTE/

  • How to find the local system name in remote desktop through oracle

    Hi all,
    i am useing oralce 9i,D2K (Forms 6i) ,Presently i had a small problem when ever i am useing the application through the remote desktop i can not able to find the local system name .If i am accessing from the local system name then i can get the system name but when the user accessing the application through remote desktop i want to find from which local system he is accessing the remote desktop through the application is there any way to find it .If please let me know .
    Thanks in advance
    Srini

    Hi,
    Not sure of what you want.
    Have a look at v$session view. Machine column is maybe what you're looking for.
    If you want to retrieve the local host executing remote desktop, it's actually not possible natievely, since it's still remote host that is connecting to the database.
    Hope it helps.

  • Can'n find option local aggregation in InfoSet

    Hello!
    I use BI 7.0.
    My problem is that I cant find option "local aggregation" in editing mode of InfoSet.
    This option is described here http://help.sap.com/saphelp_nw70/helpdata/en/43/de444c23a46194e10000000a1553f7/content.htm
    but in glolbal properties of InfoSet I have only 3 options:
    1) join is time-dependent;
    2) most recent reporting for InfoObjects;
    3) left outer: add filter value to on-condition.
    Best Regards,
    Antoshkin Vitaly.

    Does anybody know what happen? SAP program always set this field invisible in InfoSet 's global properties.
    Best Regards,
    Antoshkin Vitaly.

  • Cannot find USA Local Setting in SBO 2007 release B

    I tried to install SBO 2007 release B in my dummy computer today. However, I cannot find USA Local Setting when creating new company.
    The only available countries are: Brazil, India, Japan, Korea, P.R. China, and Singapore. So the Chart of Account will follow these countries.
    Did I miss something here?
    See below for screenshot:
    http://img299.imageshack.us/img299/6369/40428164wv0.jpg

    Tom
    2007 B is for Asia and Brazil.  You will need 2007A to get USA local settings
    Suda

  • How can I find the local maximum in each interval from a graph?

    I have very less experience in labview and need some helps. I am currently using Labview 2013.
    I am analysing a very big data file. I want to find the  values of the local maximum (the peak) in every 1000 data points. Is there anyway to do it?
    I also want to have a control on when to start finding the local maximum point (after 10000 data points) and when to end it ( at 30000 data points)
    The attachment is a very similar graph of what I am analysing.
    Thank you very much.
    Attachments:
    A06-1-11_1.xlsx ‏642 KB

    Hi John,
    save that Excel spreadsheet as CSV file (form Excel).
    The use ReadFromSpreadsheetFile to load the data into LabVIEW. Now you get an array of data and you can do anything with it.
    - You might use a loop to pick an ArraySubset of each 1000 datapoints and analyze it.
    - You might use numeric controls to provide an input for the user...
    Where's your problem? It seems you already know where the goal is...
    And try to THINK DATAFLOW! You don't want to analyze data from a graph, you want to analyze spreadsheet data. A graph is just a data sink (in LabVIEW)...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • I keep getting a message that the computer can not find a .local server

    I keep getting a message that the computer can not find a .local server

    Hi, ImTiffanyA. 
    The most common cause for this issue would be media present that is purchased with another Apple ID.  The article below will walk you through the process of verifying if that is the case or correcting the issue if not.
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    http://support.apple.com/kb/TS1389
    Cheers,
    Jason H.

  • Various T61 software issues and finding a local service provider

    Hi all,
    just got t61 two weeks ago, already have several problems, 1, can't open task manage, virus??2, internet connection takes 1/2 hr, 3, can't into share network, 4, no revorery CD, either didn't come with it or didn't creat one at begining. 5, how to format, back to original ? anyone can help me out? thanks
    J
    Mod edited subject for clarity
    Message Edited by Tim_Lenovo on 06-17-2008 02:55 PM

    Hello J,
    It sounds like you've got a handful of software issues alright. Those are rather difficult to diagnose over the phone, much less the internet.
    I highly recommend you to take a look at our Welcome and FAQ board, where a lot of frequently asked questions & answers are compiled for easy rereference. If you look at the "Frequenty Asked Questions" thread which is locked at the top of that board, you will find a lot of good information including how to create your recovery CD's. I would recommend you do that first thing and go from there.
    You also seemed indicated wanting to find a local service location. You can find this information at http://lenovo.com/support and click "Find a service provider" under "Related Links" on the left side of the page.
    Take a look at these resources and let us know where you stand. Welcome to the community and we hope to see you around the boards!
    Tim Supples
    Lenovo Social Media
    Got a question? Don't PM me, post it on the forum!
    Lenovo Blogs
    X60 Tablet SXGA+ primary, Z61p fully loaded workhorse

  • Error -Can't find bundle ,locale en_US

    hi all,
    Im plementing custom reports for finding the empty folder
    in the repository..i had implemented successfully..
    i had encounted the following error while running the report..
    Error: Can't find bundle for base name com.sap.km.reporting.SimpleReport, locale en_US..
    could any one provide me a remedy for ths..
    Regards,
    Vinoth

    hi Detlev,
    im getting ths result as report in the output result of simple report..
    hi all,
    im implementing a report for reporting empty filder..
    i got an error while running the report in portal.
    i got this error..
    unexpected error accessing report com.sap.km.reporting.SimpleReport@641ffc: java.util.MissingResourceException: Can't find bundle for base name com.sap.km.reporting.SimpleReport, locale en_IE
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:839)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:729)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
    at com.sap.km.reporting.SimpleReport.getDisplayName(SimpleReport.java:68)
    at com.sapportals.wcm.repository.manager.reporting.monitor.ReportComponent$ReportWrapper.getDisplayName(ReportComponent.java:294)
    at com.sapportals.wcm.repository.manager.reporting.types.RPReportHandler$DisplayNameGen.getProperty(RPReportHandler.java:160)
    at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:110)
    at com.sapportals.wcm.repository.manager.reporting.types.RPPropHandler.getProperties(RPPropHandler.java:143)
    at com.sapportals.wcm.repository.manager.reporting.RPPropertyManager.getProperties(RPPropertyManager.java:89)
    at com.sapportals.wcm.repository.ResourceImpl.internalGetProperties(ResourceImpl.java:3699)
    at com.sapportals.wcm.repository.ResourceImpl.internalGetPropertiesExtended(ResourceImpl.java:1343)
    at com.sapportals.wcm.repository.ResourceImpl.getProperties(ResourceImpl.java:1308)
    at com.sapportals.wcm.repository.CollectionImpl.getChildren(CollectionImpl.java:383)
    at com.sapportals.wcm.service.resourcelistfilter.cm.ResourceListFilter.getChildren(ResourceListFilter.java:425)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.getChildren(InternalTree.java:1868)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1142)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.getFirstCallOpenResources(InternalTree.java:1172)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildNewTree(InternalTree.java:704)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.renderTree(InternalTree.java:852)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.render(InternalTree.java:546)
    at com.sapportals.wcm.rendering.collection.cm.InternalTree.buildContent(InternalTree.java:2295)
    at com.sapportals.wcm.control.util.components.base.BaseCompositeComponent.buildComposition(BaseCompositeComponent.java:196)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:33)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.AbstractCompositeComponent.preRender(AbstractCompositeComponent.java:34)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.htmlb.Container.preRender(Container.java:118)
    at com.sapportals.portal.htmlb.PrtContext.render(PrtContext.java:413)
    at com.sapportals.htmlb.page.DynPage.doOutput(DynPage.java:237)
    at com.sapportals.wcm.portal.component.base.KMControllerDynPage.doOutput(KMControllerDynPage.java:130)
    at com.sapportals.htmlb.page.PageProcessor.handleRequest(PageProcessor.java:129)
    at com.sapportals.portal.htmlb.page.PageProcessorComponent.doContent(PageProcessorComponent.java:134)
    at com.sapportals.wcm.portal.component.base.ControllerComponent.doContent(ControllerComponent.java:73)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:209)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)
    at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:646)
    at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)
    at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:240)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:522)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:405)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.servlet.InvokerServlet.service(InvokerServlet.java:156)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
    at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
    at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
    at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
    at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
    at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
    at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
    i think ths s bcoz i dnt hav any proprty file inside Portal-inf/private..
    is it bcoz of ths?
    if it is so could u tel me how to create that one..
    Regards,
    Vinoth

  • How to find out local or home interface  was used ?

    Hi !
    are there any ways in the code of methods ejbCreate and ejbRemove in my entity EJB to find out were they called via local or home interface provided that my bean has both local or home interfaces ?
    Thenks in advance.

    Why should you care, this logic should only be implemented in the client (SEJB or Servlet). Even then it should only be used to check if there is a LocalHomeInterface. If not you get the RemoteHomeInterface. I don't understand the question completely.

  • How can I find all local photos from ipad2?

    I am having difficulties finding photos in local album in ipad2. When I try to add photo from a event folder that has 500+ photos, only a subset comes up and I am not able to select the photo I want. Is there a setting I need to have? Thx.

    As a workaround you can enable "Always use native photo browsers"  in the PS Touch settings. It's listed under "Preferences" -> "Access Local Photos setting". See attached screenshot
    Guido

  • Can't see Computers/Servers in Finder on local ip network

    I'm trying to share some files between by Powerbook and iMac.
    Both are running Tiger.
    Both are configured with IP on the same subnet and can ping each other
    Both are using wifi as their network interface
    Both can get to the internet, iMac, iDisk fine...
    I turned on sharing on both systems.
    When I go to finder and browse under Network i can only see my local machine.
    This is true on both systems..
    Any ideas about how to fix or troubleshoot?

    Rebooting usually makes the machines show up in rhe network browser.
    The reliable way, of course, is to connect using Finder's "Connect to server" window. The address you enter looks like this:
    afp://Clamshell.local
    Once you type it in you can save them in a list. It's very professional. You can also remount servers using the "Recent Items" list in the Apple menu, but if the server is not online it makes your Finder spin wheels for a few minutes.
    Agonizing.
      Mac OS X (10.4.7)  

  • Finding enabled locales/dimensions and their respective ids for a site

    Hi,
    I am trying to find all the locales/dimensions which are enabled for a particular site, and their respective ids.
    I have tried using this code:
    webResource = webResource.path("/userlocales");
                   Builder builder = webResource.accept(MediaType.APPLICATION_XML);
                   UserLocalesBean enabledAssets = (UserLocalesBean) builder.get(UserLocalesBean.class);
                   List<UserLocale> userLocList=enabledAssets.getUserLocales();
    But this gives a list of all the locales in the entire system and not per site basis.
    Currently I am accessing the DIMENSION table directly to find out the enabled dimensions and their respective ids, but this is just a temporary solution.
    Can anyone pointout how to use the API to find the enabled locales and their respective ids for a particular site ?

    Sites uses jsp for its templates to render a page. Basically an element is a jsp that contains logic using jsp tag libraries and/or java scriplets. Please do take a look at the documentation that is available on the oracle website: http://docs.oracle.com/cd/E29495_01/index.htm
    The documentation that might be useful to you is the developers guide. Also look at the Developers tool guide that shows you how to setup your developer environment.
    Hope this will help you.
    Regards,
    Rodney

  • Can´t find my local stored email files

    Can´t find my old mails that i stored in seperate files local after lion update. Files saved in mobileme are available.

    Ty Ford1 wrote:
    Hi,
    I have a Mac Book running 10.5.2. I access the internet wirelessly through an airport. That's working. It sees the airport and the internet. It prints to my printer which is hardwired to router which is attached to the airport.
    The MacBook does not see the other computers. They all see it. I don't have a "network" icon in the finder. File sharing is turned on. When I Go>network, I get a blank network window.
    Are the other computers running Leopard 10.5.2?
    Help.
    Sometimes you need to help the connection along.
    In the Finder, Go, click on Connect to Server and type in the address of one of the other computers, like 192.16.2.3 or whatever. I think Apple uses 10.x.x.x but that's not important. Just enter the dotted quad for another computer.
    You might also open a terminal and ping the other computers.
    it might also be a firewall setup issue, on your machine or the others. You can verify this by temporarily turning off the firewall on your computer and one of the others. Sometimes you need to reboot in order for these changes to show up since the network browser may not run all the time.

  • How to find the local objects in the system

    Hi experts,
    How can i find what are all the local objects i created and transportable objects i created in the system.
    Thanks in advance.
    regards,
    Gopalakrishnan Ulagajothi

    Hi
    check in table TADIR you will get all kind of developments done in system just filter as per your requirement for local objects, give Package  (DEVCLASS) equals to $TMP.
    and for transportable object you have a request that you can check in same table as well as you are able to check in SE09 all transporatble objects.
    hope this will help

Maybe you are looking for

  • Apple TV is not showing all netflix content in Canada

    I've noticed a lot of content available on Netflix Canada is not available through Apple TV.  Programs like The West Wing, Louie, The Good Guys, Manhattan, etc.  They don't even show up in a specific search.   It's not just a case of displaying only

  • Cannot Add MP4 to Library

    I cannot add any mp4 files to iTunes, I have tried dragging and "Add file to library" but nothing happens, it does not appear in the library, any help much appreciated. Zetor iTunes 7.5 Vista build 6.00.6000

  • Not receiving my iMessages from my phone to my ipad

    Why doesn't my phone number appear as an option on my iMessage

  • Cryptographic functions in smartcard hardware

    Hi there, i have some code that uses some cryptographic functions of Java. My applet will run on a smartcard. Do you think that if the card has some kind of cryptographic co-processor, or other cryptographic hardware functions, it may help the applet

  • Delta selection question

    Hi guys, This is a concept question and must be obvious to most people but I thought I will confirm that. If a datasource allows selection option  which is delta enabled, I select a certain set of data from a delta. (Ex. I use company code US10 for s