Ask Experts Questions for FREE Help !
Ask
    joegonota's Avatar
    joegonota Posts: 2, Reputation: 1
    New Member
     
    #1

    Mar 14, 2011, 07:31 AM
    Closed Form Problem
    Hi all,

    Please have a look of following question


    Q:

    Find the exact number of times, in terms of the natural number n that s is executed in the following algorithm


    I:=0

    while I<n do

    s;

    I:i+3;

    od


    Please give me some advise to solve this question... thanks a lot
    Unknown008's Avatar
    Unknown008 Posts: 8,076, Reputation: 723
    Uber Member
     
    #2

    Mar 14, 2011, 11:30 PM

    I'm having trouble understanding your problem...

    I'm particularly not familiar with the functions 'do', 's' and 'od' do...
    jcaron2's Avatar
    jcaron2 Posts: 986, Reputation: 204
    Senior Member
     
    #3

    Mar 15, 2011, 10:30 AM
    The variable i starts at 0, then gets incremented by 3 each time through the loop (assuming I'm reading the syntax correctly; I'm not familiar with whatever language that is). The loop ends when i is no longer less than n. That means the loop runs approximately n/3 times.

    If you want to get really specific, it actually runs (floor(n/3) + 1) times, where the "floor" function means that you round down to the nearest integer.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

How do I rewrite each equation in standard form? Here's the problem:(1) y=x+9. [ 5 Answers ]

The rest:(2) y=3x+7 (3) y=4x+8 (4) y=7x (5) y-8=3(x+1) (6)y+2=2(x-1) (7) y-1=4(x+3) (8) y-3=x+7. When answering please label which one you answer. And tell me how I do it on my own . Thanks

Servlet,html form problem [ 1 Answers ]

Servlet,html form problem? Hi,this is hancok.I am getting the error when I click submit button after filling the fileds of the form. the eror is as follows. This webpage is not found. No webpage was found for the web address: file:///C:/formapp/f1?text1=madhu&age=18… More information on...

Form element (list) problem. [ 7 Answers ]

I'm using style="width:200px" in the select tag to control the width of list boxes, but I'm missing the horizontal scroll bar: See the Construction list at http://ohiobusinesslist.com/query2.html How can I get a horizontal scroll bar for the lists that have items in them that are wider...

Mistake on W-2 form, serious problem [ 1 Answers ]

My wife and I both worked in New York City for all of 2004. In August of that year, we moved to New Jersey, from New York City. My W-2 accurately reflects the NY state taxes taken out over the entire year, as well as the city taxes taken out during the time we were residents. The huge...

Tax Problem: Wrong form [ 2 Answers ]

Hi, I have a tax question. I am a student on an F1 visa here. I have filed for taxes 2 times now. My uncle basically did my taxes for me and both times he filled out the 1040 instead of 1040 NR. Just this semester I came to know about the 1040 NR thing. Can anyone tell me how to rectify this...


View more questions Search