14.7 Practice using C++ hash templates C++ has two built in hash structures that will suite for most programming needs of hashes. The two types are unorderedmap and orderedmap. In this weeks program you are going to practice creating, inserting and iterating over the two types of maps. Your assignment is to create an unordered map and an ordered map, both with have key value pairs of type . You will read the key value pairs in from a dataFile using the file stream operator storing the first value (an integer into the integer key) and the second one into a string. You will then insert each pair into both the unordered and ordered maps. Lastly you will use an interator to iterate through the map printing them out. Your output should make it clear by label which list is the ordered map and which is the unordered map. The test provided is merely for your assistance - your program will be graded on it's content regardless of the results of book test. You will need the following references to help you with this assignment: https://www.cplusplus.com/reference/unorderedmap/unorderedmap/unordered_map/ https://www.cplusplus.com/reference/map/map/map/ https://www.cplusplus.com/reference/map/map/begin/ main.cpp #include #include #include #include #include using namespace std; typedef unsigned int uint; int main() { //create two hashes - //one using unordered map //one using ordered map //read in the key data pairs from dataList //store in both maps //iterate through both using auto //print the data } dataList.document 1 John 2 Jacob 3 Jingle 4 Heimer 5 Schmidt 6 His 7 name 8 is 9 my 10 name 11 too
Types of Linked List
A sequence of data elements connected through links is called a linked list (LL). The elements of a linked list are nodes containing data and a reference to the next node in the list. In a linked list, the elements are stored in a non-contiguous manner and the linear order in maintained by means of a pointer associated with each node in the list which is used to point to the subsequent node in the list.
Linked List
When a set of items is organized sequentially, it is termed as list. Linked list is a list whose order is given by links from one item to the next. It contains a link to the structure containing the next item so we can say that it is a completely different way to represent a list. In linked list, each structure of the list is known as node and it consists of two fields (one for containing the item and other one is for containing the next item address).
14.7 Practice using C++ hash templates
C++ has two built in hash structures that will suite for most programming needs of hashes. The two types are unorderedmap and orderedmap. In this weeks program you are going to practice creating, inserting and iterating over the two types of maps. Your assignment is to create an unordered map and an ordered map, both with have key value pairs of type . You will read the key value pairs in from a dataFile using the file stream operator storing the first value (an integer into the integer key) and the second one into a string. You will then insert each pair into both the unordered and ordered maps. Lastly you will use an interator to iterate through the map printing them out. Your output should make it clear by label which list is the ordered map and which is the unordered map. The test provided is merely for your assistance - your program will be graded on it's content regardless of the results of book test.
You will need the following references to help you with this assignment:
https://www.cplusplus.com/reference/unorderedmap/unorderedmap/unordered_map/ https://www.cplusplus.com/reference/map/map/map/ https://www.cplusplus.com/reference/map/map/begin/
main.cpp
#include <fstream>
#include <map>
#include <unordered_map>
#include <string>
#include <iostream>
using namespace std;
typedef unsigned int uint;
int main() {
//create two hashes -
//one using unordered map
//one using ordered map
//read in the key data pairs from dataList
//store in both maps
//iterate through both using auto
//print the data
}
dataList.document
1 John
2 Jacob
3 Jingle
4 Heimer
5 Schmidt
6 His
7 name
8 is
9 my
10 name
11 too
Trending now
This is a popular solution!
Step by step
Solved in 2 steps