Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE110 Lecture 31

CSE110 Lecture 31

Principles of Programming with Java
Final Review
(202007)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez

July 07, 2017
Tweet

Transcript

  1. CSE110 Principles of Programming with Java Lecture 31: Review Javier

    Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com Office Hours: By appointment
  2. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 2 Disclaimer

    The following questions are just examples. They are NOT a comprehensive list of topics Review All the Slides for a full list of topics The exam is NOT limited to the topics covered in this review. Midterm Exams are comprehensive
  3. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 3 Midterm

    1
  4. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 4 Midterm

    2
  5. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 5 Midterm

    3 19. Constructor 20. Null and This 21. Practice 22. Arrays I 23. Arrays II 24. References 25. References II 26. Recursion 27. Searching 28. Sorting and Review
  6. Getting everything together

  7. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 7 Case

    1 Step by step: {6, 3, 0, 5, 1} {3, 6, 0, 5, 1} {3, 0, 6, 5, 1} {3, 0, 5, 6, 1} {3, 0, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 1, 5, 6} {0, 3, 1, 5, 6} {0, 1, 3, 5, 6} {0, 1, 3, 5, 6}
  8. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 8 Case

    1 Step by step: {6, 3, 0, 5, 1} {3, 6, 0, 5, 1} {3, 0, 6, 5, 1} {3, 0, 5, 6, 1} {3, 0, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 5, 1, 6} {0, 3, 1, 5, 6} {0, 3, 1, 5, 6} {0, 1, 3, 5, 6} {0, 1, 3, 5, 6} public static void bubbleSort(int[] ar) { int tmp; for(int p1=0; p1 < ar.length-1; p1++){ for (int p2=0; p2 < ar.length-1-p1; p2++){ if (ar[p2] > ar[p2+1]){ tmp = array[p2]; array[p2] = array[p2+1]; array[p2+1] = tmp; } } } }
  9. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 9 Case

    2 Searching and Sorting Arrays of Objects John Mary Alice Robert 4 1 3 2
  10. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 10 Case

    3 • A two-dimensional array can be thought of as a table of elements, with rows and columns 0 1 2 3 4 5 int [][]array = new int [6][3] array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2
  11. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 11 Case

    3 with Code
  12. Test Yourselves

  13. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 13 Question

  14. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 14 Question

  15. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 15 Question

  16. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 16 Question

  17. Topics By Day

  18. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 18 Lecture

    19 • Constructor, default Constructor, multiple constructors • The toString method • What is encapsulation? • Modifiers public and private • getters • setters
  19. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 19 Lecture

    20 • null • NullPointerException • this • static and not static
  20. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 20 Lecture

    21
  21. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 21 Lecture

    22 • Create arrays • Arrays of Primitive types • Arrays of Objects • Default values • Index: 0 to n-1 and ArrayIndexOutOfBoundsException type name [ ] = new type [size]
  22. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 22 Lecture

    23 • length variable • for-loop to show data, add data, etc. • Initializer lists type [] name = { value, value, value, …}
  23. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 23 Lecture

    24 • References (pointers) • References to Objects • References to Arrays • Arrays of Objects • Objects with Arrays as attributes
  24. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 24 Lecture

    25 • Parameters using References (pointers) • Objects as Parameters • Arrays as Parameters • Arrays of Objects as Parameters • Objects with Arrays as Parameters
  25. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 25 Lecture

    26 Recursion • How does it work • Understand factorial. Fibonacci, Searching, etc. • What about print numbers n to m? • What about add numbers 0 to n?
  26. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 26 Lecture

    27, 28 Searching • Linear Search • Binary Search Sorting • Bubble Sort • Selection Sort
  27. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 27 Disclaimer

    The following questions are just examples. They are NOT a comprehensive list of topics Review All the Slides for a full list of topics The exam is NOT limited to the topics covered in this review. Midterm Exams are comprehensive
  28. CSE110 - Principles of Programming Javier Gonzalez-Sanchez javiergs@asu.edu Summer 2020

    Disclaimer. These slides can only be used as study material for the class CSE110 at ASU. They cannot be distributed or used for another purpose.