Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I just need a List.h and a shot of the whole output. (Lab4Main.cpp) (Random.h) (Random.cpp) Just need: List.h Screen shot of entire output on terminal
I just need a List.h and a shot of the whole output.
(Lab4Main.cpp)
(Random.h)
(Random.cpp)
Just need:
List.h
Screen shot of entire output on terminal
Implement and test the ADT List from the lecture videos and textbook Chapter 3. You will only be responsible for the coding of file List.h. All other files are provided. Start by downloading these files: Random.h and Random.cpp Lab4Main.cpp With a working List implementation in file List.h, the running program will produce the following kind of output: My list of random numbers: -73 73 -36 29 -81 72 22 -28 66 -34 -67 93 39 34 95 -56 76 41 73 7 -97 -51 -51 -97 -95 The max subseq sum: 433 The max subsum squence: 72 22 -28 66 -34 -67 93 39 34 95 -56 76 41 73 7 My list after replacing all max subseg values with 0: -73 0 -36 29 -81 O O OOOOOOOOO000 g -97 -51 -51 -97 -95 One more time, we are seeing a maximal subsequence sum problem; the program determines the maximal subsequence, prints out the values of this sequence, and replaces (via erase+insert) each value in this subsum sequence with value 0. Since this program generates a list of random numbers (see files Random.h,.cpp), everyone's output is likely differ, with a sequence of Os in a different segment of sequence. When you code our class List, make sure that you include these three (without comment, to keep compiler happy): List(List&& rhs) : thesize{ rhs.thesize }, head{ rhs.head }, tail{ rhs.tail } { rhs.theSize = 0; rhs.head = nullptr; rhs.tail = nullptr; // keep for compiler List& operator= (List&& rhs) { std:: swap(theSize, rhs. theSize); std:: swap(head, rhs.head); std:: swap(tail, rhs.tail); return *this; } clear the list by remove all values; woid clear() { while( !empty()) pop_front(); } This program is different from others you have written for CSE 2020 in that the code is spread out over multiple.cpp files. This has consequences on how to compile for those of you who work under Linux. With Linux, compile the.cpp files separately and link them into the executable as follows: g++ -c Random.cpp g++ -c Lab4Main.cpp g++ Random.o Lab4Maino Then run with ./a.out Under Visual Studio C++, none of this is necessary. All you do is place all.h files in the 'Header Files' folder and all.cpp files in the 'Source Files' folder. Compile as usual. #include
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started