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

CSE205 Lecture 16

CSE205 Lecture 16

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

Javier Gonzalez-Sanchez

September 26, 2021
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

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

    Data Structures I Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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;
  7. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 11 jgs

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

    Previously | Objects MyPoint anObject = new MyPoint(1,3); // java 0x73 anObject 1 3 x y 0x73
  9. 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
  10. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 16 jgs

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

    I introduce you a List, a Linked List
  12. 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
  13. Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 24 jgs

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

    Class Node aNode 0x73 5 7 null fooNode 0x11 1 0x73
  15. jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez,

    Ph.D. [email protected] 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.