Computer Science

# Queues - Intermediate

The java code below is a simple implementation of a linked list based queue data structure. The three methods one(1),two(2) and three(3) need to be renamed. How should they be renamed so that they describe their functions?

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  private int N; private Node

A polish expression or prefix expression is a notational form for logic, arithmetic, and algebra which places operators to the left of their operands. What is the value of the polish expression below when evaluated?

- 7 + * - 9 40 17 35

$$100$$ children numbered $$1$$ to $$100$$ are gathered in a circle. A teacher approaches and starts eliminating every fourth child starting from 4 she encounters ($$4,8,12,...$$). When a child is eliminated, he/she leaves the circle and the teacher continues to eliminate every fourth child looping around the circle. The last child to be eliminated wins the game. Which child wins this game?

A polish expression or prefix expression is a notational form for logic, arithmetic, and algebra which places operators to the left of their operands. What is the value of the polish expression below when evaluated?

- 7 + * - 9 40 17 35

The java code below is a simple implementation of a linked list based queue data structure. The three methods one(1),two(2) and three(3) need to be renamed. How should they be renamed so that they describe their functions?

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  private int N; private Node

×