Data Structures and Algorithms

Introduction

To write good code, developers must take advantage of data structures and algorithms. A good developer must understand the trade off between readability, memory, and speed.

Basic Terminology

Data Structure
A collection of values, that can have relationships and functions.
  • Each data structure is different and specialized for different purposes.
  • Common data structures include arrays, lists, stacks, queues, maps, trees, etc.
  • Algorithm
    An algorithm is any well-defined computational procedure that
  • Takes some value, or set of values, as input.
  • Produces some value, or set of values, as output.
  • An algorithm should be correct and efficient.
  • Design
    Method for developing an algorithm.
    Analysis
    Abstract mathematical comparison of algorithms.

    Analyzing Algorithms

    There are several items to consider when analyzing algorithms including:

    Pseudocode

    An algorithm is a step by step procedure to solving a task, whereas pseudocode is a method for writing an algorithm.

    Fibonacci Psuedocode:

    Fib(n):
    1   if n == 0 or n == 1
    2       return 1
    3   else 
    4       return Fib(n - 1) + Fib(n - 2)