473,499 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can Someone Please Help Me To Dry Run The Following Pseudo-code

2 New Member
a) Dry run the following pseudo-code using the test data shown below it. Draw up a table with one column for
Expand|Select|Wrap|Line Numbers
  1.      EACH variable in the algorithm.     [12]
  2.         Input (P)
  3.         While P ≠ 0
  4.             Input (K)
  5.               T  0
  6.               For R  1 to K
  7.                 Input (X,Y)
  8.                  If X > Y 
  9.                     then T  T + 2
  10.                     else If X = Y
  11.                             then T  T + 1
  12.                         Endif    
  13.                 Endif
  14.             Endfor
  15.             Output (P, K, T)
  16.             Input (P)
  17.         Endwhile        
  18.         USE DATA 10, 3, 4, 3, 5, 2, 1, 1, 20, 4, 5, 5, 2, 2, 1, 2, 0, 0, 30, 2, 1, 2, 3, 4, 0
  19.     b)    List the outputs that are produced.    [3]
May 7 '07 #1
1 2338
bartonc
6,596 Recognized Expert Expert
a) Dry run the following pseudo-code using the test data shown below it. Draw up a table with one column for
Expand|Select|Wrap|Line Numbers
  1.      EACH variable in the algorithm.     [12]
  2.         Input (P)
  3.         While P ≠ 0
  4.             Input (K)
  5.               T  0
  6.               For R  1 to K
  7.                 Input (X,Y)
  8.                  If X > Y 
  9.                     then T  T + 2
  10.                     else If X = Y
  11.                             then T  T + 1
  12.                         Endif    
  13.                 Endif
  14.             Endfor
  15.             Output (P, K, T)
  16.             Input (P)
  17.         Endwhile        
  18.         USE DATA 10, 3, 4, 3, 5, 2, 1, 1, 20, 4, 5, 5, 2, 2, 1, 2, 0, 0, 30, 2, 1, 2, 3, 4, 0
  19.     b)    List the outputs that are produced.    [3]
That'll depend on the programming language that you are using.

Moving to Misc. Discussions from Member Intro.
May 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1879
by: kevin | last post by:
hi there I am struggling with javascript. Can you please help me I've managed to get the get URL in flash to open a html that has the function that opens the Feedback form I want. I Couldn't...
2
2811
by: Andrew Thompson | last post by:
I would like to create a menu that uses the 'active' pseudo-class to highlight the current page, but I cannot get it to work. The URL http://www.lensescapes.com/tst/nav/1.jsp shows the attempts...
2
3680
by: John | last post by:
Now and again I like to start a sentence with a large capital, maybe in a different font. This upsets the line spacing and I've failed to find any css that will effectively crop the capital letter...
4
4487
by: Stephen Poley | last post by:
The issue of the focus pseudo-class came up a few weeks ago, and I finally got around to trying it out (better late than never ...) The recommended order given for the pseudo-classes is link,...
8
6978
by: Kerberos | last post by:
As you might know, IE doesn't support the :hover pseudo-class on every tag (just the "a" tag AFAIK) Is there a simple JavaScript that would solve the problem? I have images that have a light blue...
1
3299
by: Steven T. Hatton | last post by:
ISO/IEC 14882:2003: "5.2.4 Pseudo destructor call The use of a pseudo-destructor-name after a dot . or arrow -> operator represents the destructor for the non-class...
6
3960
by: Fungii | last post by:
Hello, I have a stylesheet that sets p:first-letter to a certain size and colour. I was playing around with Javascript to change paragraph stylesheets using an array like this: var paras =...
70
6169
by: Ben Pfaff | last post by:
One issue that comes up fairly often around here is the poor quality of the pseudo-random number generators supplied with many C implementations. As a result, we have to recommend things like...
3
4717
by: yawnmoth | last post by:
I've seen a few webpages that use the javascript pseudo-protocol with event handlers. eg. <input onkeyup="javascript: ..." /> Correct me if I'm wrong, but isn't onkeyup always supposed to be...
0
1106
by: Kevin Frey | last post by:
WebControl contains properties such as ControlStyle and Style for controlling the style of a web-control. In particular the Style property is a CssStyleCollection that simply comprises key-value...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.