Question: Lab #12 Linked lists are cool data structures that offer several significant benefits to arrays. Since they grow as they're needed and don't need to


Lab #12 Linked lists are cool data structures that offer several significant benefits to arrays. Since they grow as they're needed and don't need to be allocated ahead of time, they're really efficient in size and speed of creating and adding items to it. However, since you have to iterate through them from the start to get any data inside, they are slower to search through In lecture, you have been learning how to create one from scratch. This lab will introduce you to the Standard Template Library's (STL) list class, which implements the linked list for you. STL Containers You have learned about vectors and maps in the past. These are two of the container classes available to you built into C++. More types are deques (doubly-ended queues, or basically a dynamic array), lists (a doubly-ended linked list), and a forward_ list (singly-ended linked list). Just like with vectors and maps, lists have many of the same function names that the previous containers have begin( clear) empty) end() erase) pop_back() removes/pops an element from the back of the container pop front) removes/pops an element from the front of the container push back() inserts/pushes an element into the back of the container push front() inserts/pushes an element into the front of the container size() returns the pointer to the beginning of the container empties a container returns a Boolean if the container is empty returns the pointer past the end of the container removes an element at a given position (passed in by an iterator) returns an integer of the number of elements in the container and so on. To get the functionality, make sure you #include at the beginning Iterators also work the same: vectorctype>::iterator mapctype,type>:iterator listctypes::iterator Strings also are containers of characters. They can be used exactly like the types above, and they also include built-in iterators. What You Will Do This program should create linked lists from strings, and then remove all of the vowels. ) Create the file Lab12.cpp 2) Write a function called fillList that takes parameters for a list and the string to add. The function should iterate through the string and add each to the list. (So a string "ABC" should be inserted into a list which will consist of elements [AJ>BJ-[C]). Test this function before continuing. Write a function called printList which takes in a list and an ostream (output stream). It should iterate through a list and print out each element, showing the order they are connected. (Fromm step 2 above, it should print out like "[A] - [B] [c] e", where 8 is the NULL 3) re continuing 4) Write a fu nction called removeCharacter that takes parameters for the list and a character to e. It should iterate through the list, moving each instance of the character. Think about what mov happens when you remove characters in a list, and what different types of conditions might occur after doing this. Test this function before continuing Page 1/2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
