a) Dry run the following pseudo-code using the test data shown below it. Draw up a table with one column for - EACH variable in the algorithm. [12]
-
Input (P)
-
While P ≠ 0
-
Input (K)
-
T 0
-
For R 1 to K
-
Input (X,Y)
-
If X > Y
-
then T T + 2
-
else If X = Y
-
then T T + 1
-
Endif
-
Endif
-
Endfor
-
Output (P, K, T)
-
Input (P)
-
Endwhile
-
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
-
b) List the outputs that are produced. [3]
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 - EACH variable in the algorithm. [12]
-
Input (P)
-
While P ≠ 0
-
Input (K)
-
T 0
-
For R 1 to K
-
Input (X,Y)
-
If X > Y
-
then T T + 2
-
else If X = Y
-
then T T + 1
-
Endif
-
Endif
-
Endfor
-
Output (P, K, T)
-
Input (P)
-
Endwhile
-
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
-
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
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 =...
|
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...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |