• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/14

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

14 Cards in this Set

  • Front
  • Back

Algorithm

A finite sequence of unambiguous instructions performed to achieve a goal or compute a desired result




Noth a solution, but a precisely defined procedure for deriving solution

Algorithmics

The study of algorithms

Process

A sequence of operations performed to achieve a goal

Algorithm vs Process

Algorithm:


-each step unambiguously specified


-clearly defined termination


Process:


-higher complexity of work, may contain multiple algorithms as steps


-specification may contain ambiguity ("Increase customer awareness")


-may be continually ongoing ("improve business process")

An algorithm should specify:

Name and purpose


Input and output


Unambiguous finite sequence of steps


Termination condition or state

Examples of Algorithms: Selection Sort

Selection Sort


-purpose: sort array of ints in ascending order


-input: array of ints (size = n)


-output: sorted array of ints ascending


-steps:


for each cur = 0 to n-2...


determine min value from cur+1 to n-2


if cur>min, swap the two


output and terminate when done all

Examples of algorithms

Converting CAD to yen


Selection sort

Data structure

coherent organization of related data items for storage and usage


organized way to manage large amounts of data efficiently


facilitates design of algorithms




in C++ we use structs or classes to represent data structures

Structs

typically declared globally (but no mem allocated)
When structure type defined, we can declare variables of this new type and allocate memory: 
ex. CDAccountV1 = account;

typically declared globally (but no mem allocated)


When structure type defined, we can declare variables of this new type and allocate memory:


ex. CDAccountV1 = account;



Dot Operator

used to access struct or class members (ex. account.balance, account.interestRate)


These members are called member variables


Can also be used to access member function (ex. today.output(); )

Classes

Focus of classes is on objects (OOP)
Variables of the class type are objects
Members are usually private
Only the function declaration is provided, implementation must be done later

Focus of classes is on objects (OOP)


Variables of the class type are objects


Members are usually private


Only the function declaration is provided, implementation must be done later

Objects

Contain data (members) and operations (functions/methods)


Declared as:


Type objectName;


ex. DayOfYear today;



Implementing class member functions

Can be after main


Must specify class


void DayOfYEar::output(){ ... }


:: is the scope of resolution operator


specifies what class the definition comes from


item before :: is the type qualifier

Abstract Data Type (ADT)

Collection of data items given a name, purpose and a set of operations that operate on the data items


Only the interface (operations) are exposed, data organization is hidden