Question: Background Recall that a Linked List is a data structure that relies on the idea of having a collection of Node's that are linked together.
Background
Recall that a Linked List is a data structure that relies on the idea of having a collection of Node's that are linked together. This link comes from the Node having not only data but also a pointer to the next node in the list.
A Stack is another data structure that could be implemented either static fixed sized arrays
or dynamically using a linked list or vector. he key thing about the stack is that it is a Last In First Out LIFO data structure meaning that you only ever interact with the top of the stack at
any given time.
The Assignment
For this assignment, you should use stack to reverse the contents of a file. You must implement a dynamic stack using a Linked List in order to solve this. I would encourage you to attempt to implement the Stack from scratch first, but if you get stuck, remember that we did this in class
so you can always go back and review how we implemented it in class.
REVERSEDFILE.dat input:
"reituork ecapS"
ecaps bguorbt dexenruoi rerolpxE eht noerF, snoitareneg rof pwod dessap
moolrieh vlimaf suoiretsym a htiw demrA noissim laicurc a no dekrabme rerolpxE
eht noerF deman rerolpxe gnirad a raey eht
sxad tsui ni noitcurtsed decaf dlrowemoh esobw, sporedezxX eht port devirta
pleh rof aelp thegru nA
eud era sbaL nebw yllatnedicnioc si hcihw mp: ta yadick yb dexortsed eb
dluow titcaf
noitalihinna porf dlrow s'snoredezax eht exas at sruob wef a tsuihtiw sredluohs.
rieht no detser yxalag eht fo etaf eht, noitanitsed rieht deraen rerolpxE eht noerF
sA tenalp s'snoredezyX eht ot resolc gnibcni, stac detcepxenu dna otaton egnarts a
deretnuocne rerolpxE eht noetF, exloser gnidleivnu htiW
Sample Run
Enter file to reverse: reversedfile.dat
"Space Frontier"
In the year a daring explorer named Freon the Explorer embarked on a crucial mission. Armed with a mysterious family heirloom passed down for generations, Freon the Explorer journeyed through space.
An urgent plea for help arrived from the Xyzederons, whose bomewarld faced destruction in just days
In fact, it would be destroyed by Friday at :which is coincidentally when Labs are due
With unyielding resolve, Freon the Explorer encountered a strange potato and unexpected cats, inching closer to the Xyzederons's planet. As Freon the Explorer neared their destination, the fate of the galaxy rested on their shoulders, with just a few hours to save the Xyzederons's world from annibilation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
