-
2 Attachment(s)
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?
Attachment 12488Attachment 12489
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.
-
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
-
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.
-
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.
-
So write what you think is the answer and we can go from there...
-
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
-
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.
-
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.
-
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
-
1 Attachment(s)
Attachment 12490
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.
-
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
-
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?
-
Well line 6 does say <=
So I guess your table should have 5 columns, for 2 to 6 inclusive.
-
thanks salem... and I will be careful how I post in the future.