 # DS&A

Data Structures and Algorithms ## Choose the Right Data Types

Apr 302018

One of the most important and overlooked parts of designing algorithms is choosing the right data types. We often assume that the types of data an algorithm will use are determined by the inputs and the output — but it might help to use a temporary collection of some data, if that collection has useful operations. Those operations are determined by the collection’s type.

In this post we’ll look at a couple of examples where using the right data types makes the problem simpler.

## Algorithmic “Plans”

Mar 192018

“Plans” are the basic “blueprints” or “building blocks” for algorithms — they are canned solutions to common programming problems which are simple but appear in many variations. Thinking about plans makes it easier to understand code, because we can see the intentions rather than thinking about one line at a time. Each plan usually only solves part of a problem, so a given piece of code may use many plans, and some plans always use other plans.

## Specifying Problems

Mar 192018

We want to write algorithms, because algorithms solve computational problems. Before writing an algorithm, we need to make the problem specific enough — we need to understand exactly what our algorithm is required to do.

## A Problem-Solving Process

Mar 192018

A computer programmer is somebody who converts computational problems into computational solutions. This is a “meta-problem”:

• Given a problem, write a computer program which solves it.
• Input: a problem statement.
• Output: a computer program.

A computer can’t do this — writing programs requires insight and ingenuity.﻿(1) But there are some systematic processes we can follow when writing programs, so most of the time we don’t have to hope for a “eureka!” moment.

Atom

hosted on werp.site