CS3240: Data Structures and Algorithms

Some beginning Thoughts................

Data Structures

 

A set of data items together with fundamental operations for manipulating these items.

Examples: Lists, Stacks, Queues, Trees, even simple Arrays, etc.

Choice of data structure can affect whether a program runs in a few seconds or requires days

Questions to ask when choosing a data structure:

1. are data items inserted at beginning or are insertions randomly done with other operations?

2. can data items be deleted?

3. are data items processed in order or randomly?

4. do you know anything about the nature and frequency of the data

5. is a data item related to other data items in any way

 

Algorithms

  • Recipe for getting things done successfully
    • "Recipe" - well defined sequence of computational steps
    • "things" - computational problems specifying an input/output relation
    • "done" - in finite steps and time
    • "successfully" - correctly

Design Techniques

  • divide and conquer
  • iteration versus recursion
  • greedy method
  • depth-first versus breadth-first search
  • others

Applications of Algorithm Design

  • sorting
  • data retrieval / search
  • finding the best/worst (optimization)
  • other

Algorithm Analysis

  • Efficiency - worst case analysis (big-O)
  • Examine methods of analyzing algorithm correctness and efficiency Recursion equations Lower bound techniques O, Omega and Theta notations for best/worst/average case analysis
  • other options ---benchmarking

Methods of Proof of Correctness of Algorithm

  • Proof by Contradiction
    Assume a theorem is false; show that this assumption implies a property known to be true is false -- therefore original hypothesis must be true

  • Proof by Counterexample
    Use a concrete example to show an inequality cannot hold

  • Mathematical Induction
    Prove a trivial base case, assume true for k, then show hypothesis is true for k+1 Used to prove recursive algorithms

 

© Lynne Grewe