Includes and intuitive and precise introduction to iterators that are at the core of modern data structures. Covers with the same careful style advanced topics such as red-black trees, hash tables, heaps, and graphs. Provides the reader with an extensive development of advanced recursion and inheritance as applied to data structures. Makes available valuable pedagogical features including chapter objectives and summaries; many complete programs with runtime output; case studies; review exercises with solutions for each chapter; extensive written and programming exercises; and a programming project for each chapter.
Supplement: Instructor CD with solutions and a test item file; Companion Website containing language tutorials, students assessment materials, and PowerPoint slides. Author : David R. Moreover, it is more concerned with performance and tools for its measurement. Both changes are very welcome. Written by authors who have been instrumental in the creation and practical application of STL, STL Tutorial and Reference Guide, Second Edition includes a tutorial, a thorough description of each element of the library, numerous sample applications, and a comprehensive reference.
You will find in-depth explanations of iterators, generic algorithms, containers, function objects, and much more. Algorithms: Algorithm are functions for processing container elements. Example: copy, sort, find, etc.
Sequential containers represent linear data structures, e. Associative containers are nonlinear containers that typically can locate search elements stored in the containers quickly, e. Container adapters are simply variations of the above containers, e. The container adapters do not support iterators. Support direct access to any elementvia operator "[]". Best for rapid insertion and deletion at front and back.
No duplicate element allowed. Elements are automatically sorted. Best for rapid lookup searching of element. Collection of key, value pairs with non-duplicate key.
Elements are automatically sorted by key. Best for rapid lookup of key. STL Iterator Iterators are similar to pointers and are used to point to container elements. Container's begin method returns an iterator pointing to the first element of the container. Container's end method returns an iterator pointing to the first element past the end of the container an element that doesnt exist. Iterator type must match container type.
Initialize iterator it to the first element of container. Move to the next element. See next slide for sort function. Many STL algorithms returns an iterator. See the example on STL set class for find function. STL set Class A set is a collection of non-duplicate sorted elements called keys. Use set when you want a sorted collection and you do not need random access to its elements. It makes use of a function called sort. Binary Search: Searching is a task used to find for the desired element.
It is very much needed to perform a sorting before any searching is applied. Algorithm: Within the standard template, the library plays a very important role in the sense it makes use of certain very important algorithms on vectors like:.
Containers, as its name suggests, make use of classes within the container to store various objects and data. It is used for working on a sequence of values. Functions include that can overload any function with call operator. Such types of classes have special instances which are called as function objects. Subscribe to our free eBooks blog and email newsletter. Download it once and read it on your Kindle device, PC, phones or tablets. Use features like bookmarks, Reading, Massachusetts.
Harlow, England.
0コメント