Save 37% off PRO during our Black Friday Sale! »

CSE205 Lecture 16

CSE205 Lecture 16

Object-Oriented Programming and Data Structures
Data Structures I
(202110)

B546a9b97d993392e4b22b74b99b91fe?s=128

Javier Gonzalez
PRO

September 26, 2021
Tweet

Transcript

  1. jgs CSE 205 Object-Oriented Programming and Data Structures Lecture 16:

    Data Structures I Dr. Javier Gonzalez-Sanchez javiergs@asu.edu javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. jgs Previously on Programming 101 (and Java fundamentals)

  3. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 3 jgs

    Previously
  4. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 4 jgs

    Previously byte
  5. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 5 jgs

    Previously 0x01 0x02 0xE6 0xE7
  6. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 6 jgs

    Previously int foobar = 7 // java 00000000 00000000 00000000 00000111 byte 0x73 byte 0x74 byte 0x75 byte 0x76
  7. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 7 jgs

    Previously | Variables int foobar = 7; // java 0x73 7 foobar 4 bytes aka a variable of type int
  8. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 8 jgs

    Previously | Variables with Primitive Types char x = 'a’; int y = 7; float z = 2.5; a 7 2.5 0x33 x 0x53 y 0x75 z
  9. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 9 jgs

    Previously | Arrays int[] myGrades = new int[3]; myGrades[0]= 100; myGrades[1]= 85; myGrades[2]= 97; // java 0x73 0x77 0x7B 100 myGrades 85 97
  10. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 10 jgs

    Previously | Reference // java 0x11 0x73 0x77 0x7B 100 myGrades 85 97 0x73 int[] myGrades = new int[3]; myGrades[0]= 100; myGrades[1]= 85; myGrades[2]= 97;
  11. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 11 jgs

    Previously | Objects MyPoint anObject = new MyPoint(1,3); // java 0x73 anObject 1 3 x y
  12. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 12 jgs

    Previously | Objects MyPoint anObject = new MyPoint(1,3); // java 0x73 anObject 1 3 x y 0x73
  13. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 13 jgs

    Previously | Summary Variable References Primitive data (int, float, char …) Complex data (arrays, objects,…) * They store a value They store an address
  14. jgs Data Structures 101 Beyond arrays

  15. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 15 jgs

    What is the problem with arrays?
  16. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 16 jgs

    What is the problem with arrays? predefined size contiguous memory But, Performance is good
  17. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 17 jgs

    I introduce you a List, a Linked List
  18. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 18 jgs

    I introduce you a List, a Linked List // myGrades = {100, 85, 97, 89} 100 85 97 89
  19. jgs Nuts and bolts of Lists in Java Nodes

  20. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 20 jgs

    Class MyNode
  21. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 21 jgs

    Class MyNode aNode 0x73 1 null
  22. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 22 jgs

    Class Node aNode 0x73 5 null
  23. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 23 jgs

    Class Node aNode 0x73 5 7 null
  24. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 24 jgs

    Class Node fooNode 0 null aNode 0x73 5 7 null
  25. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 25 jgs

    Class Node aNode 0x73 5 7 null fooNode 0x11 1 0x73
  26. jgs Nuts and bolts of Lists in Java A Linked

    List
  27. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 27 jgs

    Program.java
  28. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 28 jgs

    Class MyList | insert ( )
  29. jgs To be continued …

  30. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 30 jgs

    Questions
  31. jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez,

    Ph.D. javiergs@asu.edu Fall 2021 Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University. They cannot be distributed or used for another purpose.