|
|
|
Lab 9 Worksheet Linked Lists.docx
Lab_9_Worksheet__Linked_Lists.docx
Showing 1-3 out of 9
Lab 9 Worksheet Linked Lists.docx-Lab 9: Linked L...
Lab_9_Worksheet__Linked_Lists.docx-Lab 9: Linked Lists Due Thursday
Lab 9 Worksheet Linked Lists.docx-...
Lab_9_Worksheet__Linked_Lists.docx-Lab 9: Linked Lists Due Thursday
Page 1
Lab 9: Linked Lists
Due
Thursday June 11, 2020 at 11:59PM EDT
on
Gradescope
. Each lab is graded out of two
points for each person -- one point for the group completing the worksheet, one point for
individual participation.
You can click File > Make a Copy in the menu bar to make an editable copy to fill out. The
Scribe is responsible for sharing a link to a copy that everyone can edit.
We expect this worksheet to take about 90 minutes.
Person A
Questioner
Person B
[fill in based on e-mail
you received from the
staff]
Scribe
Remember to share a
copy of the
worksheet with the
group and to do a
find and replace for
Person A/B/C/D with
each person's actual
name.
Person C
Includer
Person D
Leader
Page 2
Warm-up Questions
Question
Discussion
Leader
Your answer
If you were attempting to insert an
element at the beginning of an
array
(assuming it has room to fit another
element), what would have to be done
before the insertion?
Person B
If you wanted to do the same with a
linked list, how would the algorithm
differ? As a specific example, consider
inserting an element into the linked list
above before the node containing
1
as
its datum. How might a linked list be
better suited to this task?
Person C
Linked list ADTs generally do not have
any member functions that return
nodes or pointers to them. Instead,
they have begin() and end() functions
that return iterators. What are some
reasons why this is a better design?
Person D
What data is stored in a linked list
iterator? How is that data used to
determine whether two iterators point to
the same linked list node?
Person A
Page 3
Blast from the Past (Lecture): Singly linked lists
In last week’s lecture, you looked at a container ADT
IntList
that was an implementation of a
singly linked list for
int
s. Today in lab, you’ll be taking a similar container
SinglyLinked
which is a templated singly linked list container.
The
Scribe
will download the SinglyList folder within the
lab9
folder
and load the code in an
IDE.
The file
SinglyList.h
contains code for a templated singly linked list. Your team will be
implementing the
insert()
and
has_duplicate()
public member
functions of
SinglyList
as well as
write test cases
for these functions in
SinglyList_tests.cpp
.
The
Scribe
will share their screen and type the implementation for these functions. The
Discussion Leader
will start the discussion by sharing their ideas for the code. Then the entire
group will collaborate to come to an agreement on the code.
The
insert()
function will insert an element
before
the position
pos
passed in. Before you
start implementing the function, it will be helpful to write down some examples for the behavior
of this function. Try to cover as many edge cases as you can. Refer at the
insert()
RME for
what the parameters mean.
Discussion
Leader
List
pos
datum
After calling
insert()
{ 0, 1, 2, 3 }
2
4
{ 0, 1, 4, 2, 3 }
Person B
Person C
Person D
Modify the diagram below for the first example (inserting 4 at position 2 in list
{ 0, 1, 2,
3 }
).
Discussion
Leader
Diagram
Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
University of Michigan-An...
University_of_Michigan-Ann_Arbor
School:
Programming_and_Introduction_Data_Structures
Course:
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades
Students also viewed documents
lab 18.docx
lab_18.docx
Course
Course
3
Module5QuizSTA2023.d...
Module5QuizSTA2023.docx.docx
Course
Course
10
Week 7 Test Math302....
Week_7_Test_Math302.docx.docx
Course
Course
30
Chapter 1 Assigment ...
Chapter_1_Assigment_Questions.docx.docx
Course
Course
5
Week 4 tests.docx.do...
Week_4_tests.docx.docx
Course
Course
23
Week 6 tests.docx.do...
Week_6_tests.docx.docx
Course
Course
106