# Homework 4 - b All integers in the linked list – loop-c...

This preview shows page 1. Sign up to view the full content.

1) a. I need to shake hands with everybody - I need a loop – b. Each person shake hands with everybody else – nested loop – c. Assuming that I don’t stand on each step, I get a loop –where is number of steps d. I am sliding down – no loops - e. I am in the elevator. The only think that I do is pressing the button of the nth floor, no loops – f. Read book twice – , the same as where n is a number of page 2) I need to make one step up – then one step down; again: two steps up – two steps down; steps up – steps down. In this case I will get. 3) a. All integers in the array – I need a loop -
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b. All integers in the linked list – loop -c. integer in the array - d. The sum of all even integers in the array - ) 5) (7.21) clear () - , no changes (7.22) add() - , no changes (7.23) add( int newPosition, T newEntry) - , no changes (7.24) remove (int givenPosition) - , no changes ) Algorithm X is , so Algorithm Y is , so 0) a) loop # 1 - times b) loop # 2 - times c) loop # 3 – 10 times So, the order is going to be), which is ) which is ) 19) 20) a. b. c. Sprinted runs yards, while the football player runs. By subtracting, we will get that football player runs yards more that sprinter....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online