Pseudocode help

This is a discussion on Pseudocode help within the Tech Board forums, part of the Community Boards category; Hello... I thought I understood this but apparently I do not... Rather than putting what I think the answers are ...

  1. #1
    Registered User
    Join Date
    Feb 2013
    Posts
    13

    Unhappy Pseudocode help

    Hello... I thought I understood this but apparently I do not... Rather than putting what I think the answers are I just want someone to explain it to me like I am an idiot who has no preconceived notions... can someone break down these pseudocode examples for me?

    Name:  Screen Shot 2013-02-06 at 3.10.20 AM.png
Views: 19315
Size:  99.1 KBName:  Screen Shot 2013-02-06 at 3.12.16 AM.png
Views: 9525
Size:  115.9 KB

    I am just confused... I have been working on 3 different classes without much sleep all week and I just started this thinking it was simple and I would pound it out in 10 minutes but my brain just cannot wrap itself around this.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,677
    Your request is logically equivalent to asking forum members to do your homework. This site has a policy about homework at this link.

    In brief, the policy requires you to do your own homework
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    I understand what you are saying... however these were 2 of many problems which are not actually graded just discussed in groups which end up doing more difficult problems during class together. Understanding these 2 problems will help me finish the remaining 8 greatly.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Or at the very least, show some kind of attempt at solving the problem.

    This would go a long way to making us think you're a genuine student, and not just some drive-by who has come straight from the lesson (via the page scanner) to dump their homework on us.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    So write what you think is the answer and we can go from there...

  6. #6
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    I do not care if the problems are spelled out or if it is helped by having a discourse about the problem... I am just asking for help

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,308
    Well...

    Steps 1 and 2 describe the input.
    Steps 3 to 5 tell you what are the initial values of the variables involved.
    Steps 6 to 9 are part of the same while loop, as seen by the indentation.
    Steps 7 and 8 are part of the same if statement, as seen by the indentation.
    Step 10 prints the output.
    Step 11 isn't really a step.

    Now, to answer problems 1.1 and 1.2, follow the steps, step by step.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    And help you will be given.

    It's just that for any of us here it is pretty obvious from the images you shown this is elementary stuff. The pseudo code actually could look like a programming language. It has a 1:1 relationship with real code. So we are a bit bummed you are clearly being lazy.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    Ok here is what I was thinking for the first one:
    S1| S2| S3| S4| S5| S6| n=6 (number after S for each character in pepper)
    p e p p e r ch= S1 (p)
    i (more confused by this point) is maximum amount of times the
    characters can be checked in order to stop it at the right time?
    So if i is less than or equal to n (6) then continue process (is what I am thinking) If this is so... by the time we reach the last p, the process could not continue even if more of that character existed? so the count would end at 2+3=5? (ch appeared 5 times) because i starts at 2 before we even count any p?

    I will type out the next one in another reply... sorry i did not do this first but all my answers were handwritten lol

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Name:  Screen Shot 2013-02-06 at 3.10.20 AM.png
Views: 1393
Size:  98.7 KB
    Print it out on paper, and start drawing on it.

    Each row of boxes is whatever you want to track the value of.
    Each column of boxes is each loop iteration.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    my response looked more lined up before i posted it... but i was trying to place S1,S2 etc above each corresponding letter in pepper

  12. #12
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    salem that is how I did it the first time as well... But I thought I had to keep going while i <= 6? so would I not go on until i reaches 6?

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    Well line 6 does say <=

    So I guess your table should have 5 columns, for 2 to 6 inclusive.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  14. #14
    Registered User
    Join Date
    Feb 2013
    Posts
    13
    thanks salem... and I will be careful how I post in the future.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pseudocode help
    By dantheman4 in forum Tech Board
    Replies: 3
    Last Post: 09-29-2011, 07:19 PM
  2. Pseudocode ?
    By sarajko in forum C Programming
    Replies: 1
    Last Post: 11-19-2010, 06:40 AM
  3. pseudocode
    By samsung in forum C Programming
    Replies: 8
    Last Post: 10-28-2007, 01:46 PM
  4. Pseudocode - I'm confused
    By ICool in forum C Programming
    Replies: 5
    Last Post: 09-16-2007, 01:32 AM
  5. help with pseudocode?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 08-11-2002, 07:33 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21