Vectors - Vectors 9:03 AM Outline and Reading The Vector...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
4/1/2003 9:03 AM Vectors 1 Vectors 4/1/2003 9:03 AM Vectors 2 Outline and Reading The Vector ADT (§5.1.1) Array-based implementation (§5.1.2) 4/1/2003 9:03 AM Vectors 3 The Vector ADT The Vector ADT extends the notion of array by storing a sequence of arbitrary objects An element can be accessed, inserted or removed by specifying its rank (number of elements preceding it) An exception is thrown if an incorrect rank is specified (e.g., a negative rank) Main vector operations: elemAtRank (int r): returns the element at rank r without removing it replaceAtRank (int r, Object o): replace the element at rank r with o insertAtRank (int r, Object o): insert a new element o to have rank r removeAtRank (int r): removes the element at rank r Additional operations size () and isEmpty () 4/1/2003 9:03 AM Vectors 4 Applications of Vectors Direct applications Sorted collection of objects (elementary database) Indirect applications Auxiliary data structure for algorithms Component of other data structures 4/1/2003 9:03 AM Vectors 5 Array-based Vector
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern