cse 333 sec on
play

CSE 333 Sec(on Sec(on 8 Upcoming Important Dates Exercise 7 due - PowerPoint PPT Presentation

CSE 333 Sec(on Sec(on 8 Upcoming Important Dates Exercise 7 due 11/20 @ 11:15 AM Homework 3 due 11/30 @ 11:59 PM Lecture 11/25 Op(onal Material No Class on 11/26 and 11/27 Standard Template Library C++s library for:


  1. CSE 333 Sec(on Sec(on 8

  2. Upcoming Important Dates • Exercise 7 due 11/20 @ 11:15 AM • Homework 3 due 11/30 @ 11:59 PM • Lecture 11/25 Op(onal Material • No Class on 11/26 and 11/27

  3. Standard Template Library • C++’s library for: – Containers (familiar data structures) – Iterators – Algorithms (such as sort and find) • Stored by value

  4. STL vector • Analogous to Java’s ArrayList – Con(nuously stored memory – Dynamically size • Located in the <vector> package • Documenta(on @ h]p://www.cplusplus.com/reference/vector/vector/

  5. STL Iterator • Each container has an iterator • Common Opera(ons: – Incremented with (++) – Copied – Copy Constructed • Addi(onal Opera(ons – Dereferencing (LHS/RHS) – Decremented with (--) – Random Access

  6. Itera(ng over a vector

  7. Itera(ng over a vector (in reverse)

  8. Random Access Vector Iterator

  9. STL Algorithms • Func(ons used on range of elements • Range = sequence of items accessible through iterators or pointers • Algorithms operate on values using assignment or copy constructors • Useful Algorithms: – find, count, binary_search, sort, transform, … • Documenta(on @ h]p://www.cplusplus.com/reference/algorithm/

  10. STL Algorithms on vector

  11. STL Algorithms on vector

  12. Sec(on Exercise • Func(on Signature: vector<int> ProcessQuery(<list<list<string>> wordLists, list<string> query>); • Input: wordLists - A list of lists of words. query - A list of words • Output: The index of each word list that contains all the words in query sorted by decreasing matching word count. (This is similar to the part B6 of Homework 3)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend