1-5


Course Objectives

  • Learning Goals:

    • Approach and solve problems differently, including interview-style questions.

    • Build programming skills to improve internship candidacy.

    • Required traits: Dedication and hard work.

  • Engagement Level: "Are you up for the challenge?"

Understanding Computer Science

  • Definition:

    • The study of computers and computational systems focusing on algorithms.

    • Intersects theory with practical applications.

    • Involves planning, designing, developing, and applying systems.

    • Emphasizes analysis on algorithm efficiency and software performance.

  • Areas of Study in Computer Science:

    • Artificial Intelligence, Big Data/Data Analytics, Machine Learning, Bioinformatics, Networks, Software Engineering, Graphics, Computer Systems, Security, Database Systems, and more.

The Concept of Algorithms

  • Definition of Algorithm:

    • A sequence of instructions that solves a problem.

  • Importance of Algorithms:

    • Enables solution automation.

    • Allows for repetition of solutions.

Activity: Triangle Drawing

  • Instruction:

    1. Verbally discuss an algorithm for drawing a triangle.

    2. Write down the algorithm.

    3. Execute the algorithm (draw the triangle).

  • Analysis Questions:

    • Did the triangle look as expected?

    • Were there miscommunications?

    • Was the algorithm complete and unambiguous?

Formal Definition of Algorithm

  • Components:

    • Well-ordered collection of unambiguous and effectively computable operations producing a result and halting in a finite amount of time.

Structure of Algorithms

  • Constructing Algorithms:

    • Sequenced Instructions: Do in given order.

    • Conditional Instructions: Execute if a condition is true.

    • Iterative Instructions: Execute while a condition is true.

High-Level Programming Languages

  • Definition:

    • Designed with elements of natural language, allowing easier programming compared to low-level languages which focus on machine logic.

  • Translation Issues:

    • Computers cannot directly understand high-level languages; they must be translated into machine language.

Compilation and Execution

  • Compiler Role:

    • Checks syntax correctness and translates the program into an object file with machine language instructions.

  • Linking and Loading:

    • Object files must be linked to use software libraries containing predefined code.

    • A loader program loads the linked program into memory for execution.

Integrated Development Environments (IDE)

  • Definition:

    • Combines compiler, linker, and loader with a source code editor.

  • Tools: Syntax highlighting, autocompletion (Intellisense), debugging tools, testing frameworks.

Software Development Method

  • Analogy: Similar to the Scientific Method.

  • Steps in Development:

    1. Specify problem requirements.

    2. Analyze the problem.

    3. Design an algorithm to solve the problem.

    4. Implement the algorithm.

    5. Test and verify the completed program.

    6. Maintain and update the program.

Iterative Nature of Software Development

  • Lesson: The first solution is rarely the best.

  • Example Problem: Compute the volume of a cone.

    • Data Requirements:

    • Input: radius, height.

    • Output: volume.

    • Formula: extvolume=rac13imesextpiimesextradius2imesextheightext{volume} = rac{1}{3} imes ext{pi} imes ext{radius}^2 imes ext{height}

Algorithm for Cone Volume

  • Steps:

    • Get radius and height.

    • Compute volume (extvolume=rac13imesextpiimesextradius2imesextheightext{volume} = rac{1}{3} imes ext{pi} imes ext{radius}^2 imes ext{height}).

    • Display the resultant volume.

Implementation Example in C

  • Code Snippet:
    ```c

include

define PI 3.14159

int main(void) {
int height = 0, radius = 0;
double volume = 0.0;
printf("Enter height of cone: ");
scanf("%d", &height);
printf("Enter radius: ");
scanf("%d", &radius);
volume = ((double) 1 / 3) * PI * radius * radius * height;
printf("Volume: %lf\n", volume);
return 0;
}
```

  • Testing & Debugging:

    • Run multiple test cases with various inputs.

    • Distinct between testing (executing the program with set inputs) and debugging (locating and fixing faults).

Software Maintenance

  • Definition: Continuous improvement, adaptation, and correction of software; software patches are results of maintenance.

Preparation for Next Lecture

  • Concepts covered: General software development methods.

  • Upcoming: Introduction to the C programming language, covering its elements and structures.

References

  • J.R. Hanly & E.B. Koffman, Problem Solving and Program Design in C (8th Ed.), Pearson Education, Inc., 2016.