Skip to content

1.1 Algorithms

1.1-1

Describe your own real-world example that requires sorting. Describe one that requires finding the shortest distance between two points.

  • Sorting: rankings in games
  • Finding the shortest distance between two points: takeout delivery always requires deliveryman finding the shortest distance

1.1-2

Other than speed, what other measures of efficiency might you need to consider in a real-world setting?

Memory efficiency and coding efficiency.

1.1-3

Select a data structure that you have seen, and discuss its strengths and limitations.

arrays:

  • Strengths: random access.
  • Limitations: push, pop, insertion and deletion.

1.1-4

How are the shortest-path and traveling-salesperson problems given above similar?How are they different?

  • Similar: finding shortest-path.
  • Different: the latter traves every points and returns.

1.1-5

Suggest a real-world problem in which only the best solution will do. Then come up with one in which "approximately" the best solution is good enough.

  • Best: sovling an equaion.
  • Aooroximately: find a solution for which an inequality holds.

1.1-6

Describe a real-world problem in which sometimes the entire input is available before you need to solve the problem, but other times the input is not entirely available in advance and arrives over time.

In team work:

  • Available: if teammates finish their work in time
  • Not avalibale: teammates not finish their work you need in time