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)

Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

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

    Gonzalez-Sanchez [email protected] 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 | 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
  4. 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}
  5. 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; } } } }
  6. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 9 Case

    2 Searching and Sorting Arrays of Objects John Mary Alice Robert 4 1 3 2
  7. 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
  8. 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
  9. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 19 Lecture

    20 • null • NullPointerException • this • static and not static
  10. 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]
  11. 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, …}
  12. 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
  13. 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
  14. 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?
  15. Javier Gonzalez-Sanchez | CSE110 | Summer 2020 | 26 Lecture

    27, 28 Searching • Linear Search • Binary Search Sorting • Bubble Sort • Selection Sort
  16. 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
  17. CSE110 - Principles of Programming Javier Gonzalez-Sanchez [email protected] 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.