Maps I - Laboratory #9 - Data Structures | CSCI 1200, Lab Reports of Data Structures and Algorithms

Material Type: Lab; Class: DATA STRUCTURES; Subject: Computer Science; University: Rensselaer Polytechnic Institute; Term: Fall 2008;

Typology: Lab Reports

Pre 2010

Uploaded on 08/09/2009

koofers-user-qfm-1
koofers-user-qfm-1 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCI-1200 Computer Science II Fall 2008
Lab 9 Maps I
This lab gives you practice initial practice in working with the STL associative container, maps. No
downloads are needed until Checkpoint 3.
Checkpoint 1
Write a program from scratch that uses a map to find all the modes in an input sequence of integers.
Remember, a mode is an integer that occurs at least as many times in the sequence as any other integer.
Thus, in the sequence
19, 83, -12, 83, 65, 19, 45, -12, 45, 19, 45
the two modes are 19 and 45. Include one command-line argument to provide an input file. Use operator[]
for maps when inserting values.
To complete this checkpoint: show a TA your debugged implementation and how it runs correctly on
several interesting test cases.
Checkpoint 2
Rewrite your program from checkpoint 1 to use find or insert or both instead of operator[].
To complete this checkpoint: show a TA your revised and tested program.

Partial preview of the text

Download Maps I - Laboratory #9 - Data Structures | CSCI 1200 and more Lab Reports Data Structures and Algorithms in PDF only on Docsity!

CSCI-1200 Computer Science II — Fall 2008

Lab 9 — Maps I

This lab gives you practice initial practice in working with the STL associative container, maps. No downloads are needed until Checkpoint 3.

Checkpoint 1

Write a program from scratch that uses a map to find all the modes in an input sequence of integers. Remember, a mode is an integer that occurs at least as many times in the sequence as any other integer. Thus, in the sequence

19, 83, -12, 83, 65, 19, 45, -12, 45, 19, 45

the two modes are 19 and 45. Include one command-line argument to provide an input file. Use operator[] for maps when inserting values.

To complete this checkpoint: show a TA your debugged implementation and how it runs correctly on several interesting test cases.

Checkpoint 2

Rewrite your program from checkpoint 1 to use find or insert or both instead of operator[].

To complete this checkpoint: show a TA your revised and tested program.