0

I am new to pseudocode and completely computer science idiot ! need help urgently for answers for following questions:
1.) Design an algorithm for finding all the factors of apositive integer. For example, in the case of the integer 12, your algorithm should report the values 1,2,3,4,6, and 12.
2.) The following is an addition problem in traditional base ten notation. Each letter represents a different digit. What digit does each letter represent? how did hyou get your foot in the door?
XYZ
+ YWY
_________
ZYZW

3.) What letters are interragated by the binary search if it is applied to the list A, B, C, D, E, F, G, H, I, J, K, L, M, N, O when searching for the value J ? what abot searching for the value Z ?

4.) After performing many sequential searches on a list of 6,000 entries, what would you expect to be the average number of times that the target value would have been compared to a list entry? What if the search algorithm was the binary search ?

5.) What problems do you expect to arise if the following program is implemented on a computer ? (Hint: Remember the problem of round-off errors associated with floating-point arithmetic.)
Countnt <---one-tenth
repeat
(print the value assigned to Count and
Count <---- count + one-tenth)
until (Count equals 1)

6
Contributors
5
Replies
9
Views
7 Years
Discussion Span
Last Post by Truthful
0

I've never written pseudocode before so I don't know about the style.

1) Simple but not efficient:

list=empty
for integer i=1 to n
if i divides n exactly
put i in the list
end if
end for
sort the list
print the list

That's probably some horrible mix of Fortran and Python.
Suppose you use that for n=100. If you put n/i into the list as well as i you only need to loop from 1 to 10 (the square root of 100), for instance when you get to 5 you also get 20, so you can obviously improve on the simple version.

0

liujanet, if you copy all of your answers from the internet, you are going to remain "completely computer science idiot". Study, think, and ask specific questions about the parts you don't understand.

If you expect to paste homework and get the answers to turn in, you've wasted your time and ours here.

1

in addition to that, I don't see the urgency.

It refers to the timeframe in which we ignore his question.

-4

Please check out <<snip>>- it gives the answers and explanations to most of these questions. Obviously the folks here just don't know the answers...

Edited by Nick Evan: n/a

Votes + Comments
sigh...
Or perhaps we just don't like helping people cheat their way through class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.