Skip to content
Exercise · Q14

Q.Following is an algorithm for going to school or college. Can you suggest improvements in this to include other options?
Reach_School_Algorithm

a) Wake up
b) Get ready
c) Take lunch box
d) Take bus
e) Get off the bus
f) Reach school or college
Telangana TsbieTextbookSubjective· 2mImportance★★★★★est
89% · 32/36 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The original algorithm hard-codes one path (always bus, always lunch box); the improvement is to add decision steps — transport options, lunch alternatives, and preparation steps — so the algorithm works for every student and every day.

The idea (algorithm refinement). A good algorithm should cover the general case, not one specific scenario. The given Reach_School_Algorithm silently assumes: a lunch box is always taken, the bus is the only transport, and nothing is ever forgotten or delayed. Refinement means finding these hidden assumptions and replacing them with conditional steps (decisions) and any missing preparatory steps.

Shortcomings of the given algorithm

  1. No transport choice — a student who walks, cycles, or is dropped by car cannot use it (steps d–e assume a bus).
  2. Lunch box is unconditional — some days it is canteen/lunch-money instead.
  3. Missing steps — packing the bag per the timetable, having breakfast, checking it is actually a working day.
  4. No handling of the unexpected — bus missed, bad weather.

Improved algorithm

REACH_SCHOOL_IMPROVED
Step a: Wake up on time
Step b: IF today is a holiday THEN STOP
Step c: Get ready (bathe, dress in uniform, have breakfast)
Step d: Pack the school bag according to today's timetable
Step e: IF lunch box is prepared THEN take lunch box
        ELSE take lunch money for the canteen
Step f: Choose the mode of transport:
        IF the school is within walking distance THEN walk
        ELSE IF a bicycle is available THEN cycle
        ELSE IF the school bus/van is available THEN board the bus/van
        ELSE request parents to drop / take an auto or public transport
Step g: IF a bus/van/auto was taken THEN get off at the school stop
Step h: Reach school or college on time
END
``` …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.