Eman Samy Diyab

Lecturer
CS Department, Purdue University

MSc, Purdue University, Computer Science (2021)
BS, Ain Shams University, Computer Science

  • Email: E then my lastname AT Purdue DOT edu, OR my firstname AT Purdue DOT edu
  • Office: HAAS - G022
  • Office hours: Thursday 11:00am - 12:30pm & Friday 11:00 am - 12:30 pm
  • Finals Week Office hours: Monday, Tuesday & Wednesday 11:00 am - 1:00 pm

  • Spring 2023 - CS15900

    Lecture # Date Lecture Quiz Notes Recording Pages Lab HW Keywords
    WEEK 1
    1
    Jan 10
    ---
    Pdf
    Video
    1 - 8
    Lab #0
    ---
    Introduction, course policies and motivations
    2
    Jan 12
    Demo
    Pdf
    Video
    71 - 76
    Lab #0
    ---
    Chapter 2: Structure of a C program, Commenting, Identifiers, Data types
    WEEK 2
    3
    Jan 17
    1
    Pdf
    Video
    76 - 81
    Lab #1
    HW #1
    Chapter 2 cont.: Variables, Literal Constants, Symbolic/Defined Constants, Formatted I/O, Width and precision modifiers.
    4
    Jan 19
    2
    Pdf
    Video
    81 - 83
    Chapter #2 cont.: Revisiting important concepts: Width & precision modifiers. printf and scanf. syntax & runtime errors. Live coding demonstrates: 1- hello world program. 2- uninitialized variable undefined behavior. 3- printf and scanf in action along with some syntax and run time errors (debugging)
    WEEK 3
    5
    Jan 24
    3
    Pdf
    Video
    83 - 88
    Lab #2
    HW #2
    Chapter #3: Expressions(Operators and operands).Operator precedence.Assignment expressions.Simple & Compound assignments. Prefix and postfix (Undefined vs. Well-defined behavior example). Single and mixed data type expressions. implicit data type conversion.
    6
    Jan 26
    4
    Pdf
    Video
    88 - 92
    Chapter 3: Live coding example (Undefined vs. Well-defined behavior examples) Single and mixed data type expressions. implicit (safe), explicit (type casting), and assignment (unsafe) data type conversions.
    Rounding, truncation using floor(), type casting to int, truncation in printing using precision modifiers. What changes the value stored in a variable: assignment (simple or compound), scanf() in this variable address and pre/post-fix operators.
    Selection by calculation with examples: (1) Using factors --> how to always get their values to be 0 and 1 (including trimming all positive numbers to 1) . (2) Using thresholds.
    WEEK 4
    7
    Jan 31
    5
    Pdf
    Video
    92 - 95
    Lab #3
    Chapter #3 cont.: Selection via calculation. What are the tricks/facts used to get the output calculated from the input?
    Chapter#4: Purpose of functions. Motivation - why? Factor – smaller is easier. Reuse - by you or others. Remove redundancy. Protect data – using the variable doesn't change its value. Top-Down design. Factoring: Each function does a single task (functionally cohesive). Functions terminology. Call / calling / called / Return. Parameter passing.
    8
    Feb 2
    6
    Pdf
    Video
    95 - 101
    Chapter# 4: cont. Types of functions: 1- No parameters - no return value: ex. welcome() , menu_options(). 2- No parameters - with return value: ex. get_input(). 3- With parameters - with return value - Many math.h functions, sin(). 4- With parameters - no return value - printf(), display_results().
    WEEK 5
    9
    Feb 7
    7
    Pdf
    Video
    102 - 107
    Lab #4
    HW #3
    Chapter 4: cont. Types of functions. 3- With parameters - with return value - Many math.h fx, sin(). 4- With parameters - no return value - printf(), display_results().
    What is permitted in main() Function? - only local variable definitions, function calls and limited selection or repetition (to call functions).
    Parameter passing: 1- Pass by address.
    10
    Feb 9
    8
    Pdf
    Video
    107 - 110
    Chapter#4 cont. Parameter passing: 1- Pass by address.2- Pass by address. Pointer operations. Scope. Structure Charts. How to read a structure chart. Bad structure charts examples.
    WEEK 6
    11
    Feb 14
    9
    Pdf
    Video
    111 - 114
    Lab #5
    Chapter #4 cont. Problem-solving method (specify, analyze, design, code, test and debug, refine).
    Chapter #5: Selection. Logical data. logical operators (NOT, AND, OR). Logical operators truth table. Logical expressions evaluation. Short circuit method with example.
    12
    Feb 16
    10
    Pdf
    Video
    114 - 116
    Chapter#5 cont. : Short circuit examples. Relational operators (<, <=, >, >=). Comparative operators (==, !=). Compound statements. Examples illustrating compound statements with short circuit method.
    WEEK 7
    13
    Feb 21
    11
    Pdf
    Video
    117 - 124
    Lab #6
    HW #4
    Chapter 5: Complements: 1- Relational and comparative operators. 2- Logical operators.
    Examples on complements. Two-way selection: if-else with examples. Nested selection. Dangling else. Conditional expressions. if else vs. conditional expressions.
    The advantage of "the single-line expression":
    1. Return the expression, no need to store it in a variable.
    2. Eliminate the curly brackets (outside CS159).
    3. Use conditional expressions.
    Midterm Exam #1 - Date: Wednesday, February 22 *** Time: 8:00pm - 9:00pm *** Location: ELLT Hall of Music
    14
    Feb 23
    12
    Pdf
    Video
    125 - 128
    Chapter 5: Multiway selection: (1) if / else if / else with examples compared to if if structure. (2) switch construct.
    WEEK 8
    15
    Feb 28
    13
    Pdf
    Video
    128 - 132
    Lab #7
    Chapter #5 cont.: Multiway selection (2) switch construct. Fall through behavior. testing floating points for equality challenges. Switch construct rules. When to use a switch and when not to use a switch. if else vs. conditional expressions vs. switch statements.
    Chapter #6: Repetition using loops. looping basics and terminology.
    16
    Mar 2
    14
    Pdf
    Video
    133 - 138
    Chapter #6: Repetition using loops. looping basics and terminology. Repetition Flow chart example (calc avg, min and max of exam scores). Pretest and post-test loops. How to choose the right construct. Factorial example. Event-controlled vs. Counter-controlled processes. Input validation. Basic syntax of while and do while loops.
    WEEK 9
    17
    Mar 7
    15
    Pdf
    Video
    138 - 145
    Lab #8
    HW #5
    Chapter #6 cont. : Basic syntax of while and do while loops. Revisiting Factorial example to demonstrate while and do while loops. Nesting concept. Nested loops with example (range of factorials example). The infinite loop. The for loop basic syntax.
    18
    Mar 9
    16
    Pdf
    Video
    145 - 153
    Chapter 6 cont. : The for loop. Converting while loops to for loops examples. Rearranging digits in a number example. Extract a specific digit from a number. Determine the largest digit in the number( Maximum function). Add the largest digit to correct location. Keep finding the next numbers and when to stop. Counting zeros in a number. Recursion: concepts with examples (Restaurant waiting line example).
    SPRING BREAK
    ---
    Mar 14
      No lecture
    ---
    Mar 16
      No lecture
    WEEK 10
    19
    Mar 21
    17
    Pdf
    Video
    153 - 157
    Lab #9
    Chapter #6 cont.: Recursion example with tracing 4! in memory. When to use Recursion. When to not use Recursion. Review on repetition construct (while, do-while, for loops and recursion) and when to use each of them.
    Chapter #8: Arrays: Meaning, motivation and examples from reality. Problem of students’ scores stored in memory.
    Lecture Quiz: 3 questions about for loops, and nested for loops explained in details.
    20
    Mar 23
    18
    Pdf
    Video
    157 - 160
    Chapter #8 cont.: Declaring and defining an array. What is stored in a newly declared array and how to initialize it properly. Accessing array elements. scanf() in an array element. how to loop over all elements in the array.
    Lecture Quiz: 4 questions about nested loops explained in details checking for even and odd numbers, 2 recursion questions.
    WEEK 11
    Midterm Exam #2 - Date: Monday, March 27 *** Time: 8:00pm - 9:30pm *** Location: ELLT Hall of Music
    21
    Mar 28
    19
    Pdf
    Video
    160 - 167
    Lab #10
    HW #6
    Chapter #8 cont.: Accessing array elements. scanf() in an array element. how to loop over all elements in the array. Index range checking. Arrays and Functions: 1- Pass a single element by value. 2- Pass multiple elements by value. 3- Pass one or more elements by address. 4- Pass the whole array (can be done only By address).
    22
    Mar 30
    20
    Pdf
    Video
    168 - 170
    Chapter 8 cont.: Objects learned till now (Variables, Array elements, Whole Arrays).
    Arrays and Measures of Efficiency with examples. Exchanging values appropriately.
    Selection Sort: 1- Animated. 2- Solved step by step. How many passes are needed to sort a list of n elements?
    WEEK 12
    23
    Apr 4
    21
    Pdf
    Video
    171 - 175
    Lab #11
    Chapter 8 cont.: Previous exam sorting algorithm question. (2) Bubble sort: Basic idea about how the algorithm works. Implementation of Bubble sort (Whole array vs. part of the array). (3) Insertion sort with examples. Summary thoughts of sorting algorithms.
    24
    Apr 6
    22
    Pdf
    Video
    187 - 189
    Chapters 9 & 10: Pointers and pointer applications. What is a pointer? How to store an address in a pointer? and how to print the address stored in a pointer? Declaration of a pointer. Pointer initialization (Between functions & within the same function). Example on Pointers and Variables addresses.
    WEEK 13
    25
    Apr 11
    23
    Pdf
    Video
    187 - 194
    Lab #12
    HW #7
    Chapters 9 & 10 cont.: Quick revision on pointers: motivation, applications, and how to declare, initialize and update pointers. Arrays and pointers. Pointer arithmetic and arrays: (1) Values stored in the array and (2) The addresses of each single element of the array. How to use this relationship to get a dynamic memory allocation during the runtime (malloc).
    26
    Apr 13
    24
    Pdf
    Video
    192 - 194
    176 - 183
    Chapter 8: Searching: (1) Sequential search: Best and worst case scenarios. Implementation of a sequential search. (2) Binary search: Best and worst case scenarios. Binary search examples: (1) Target is found in the list. (2) Target is not found. Implementation of Binary search. Previous exam questions on Binary search.
    WEEK 14
    27
    Apr 18
    25
    Pdf
    Video
    184 - 186
    Lab Quiz #13
    Chapter 8 - Multidimensional Arrays: Declaration and Definition. 1D, 2D, 3D and 4D arrays. 2D arrays example.
    Previous final exam' questions.
    28
    Apr 20
    26
    Pdf
    Video
    ---
    Revision and more previous exams' questions.
    WEEK 15
    ---
    Apr 25
      No lecture - Lecture is canceled to compensate for evening exams 🎉
    ---
    Apr 27
      No lecture - Lecture is canceled to compensate for evening exams 🎉
    Final Exam - Date: Thursday, May 4 *** Time: 8:00am - 10:00am *** Location: ELLT Hall of Music