Purchase Solution

Use a stack to reverse the contents of a file

Not what you're looking for?

Ask Custom Question

File Reverser
Write a program that opens a text file and reads its contents into a stack of characters. The program should then pop the characters from the stack and save them in a second text file. The order of the characters saved in the second file should be the reverse of their order in the first file.

Requirement: stack class implementation (with push/pop) to accept input file of any size

Hint: Use dynamic stack implementation to accept input file with any size

you can use/modify LinkedList class in stack implementation

Purchase this Solution

Solution Summary

This solutions shows how to reverse the characters in a file using a stack. It is a good example of how a stack is implemented and used.

Solution Preview

The first thing that needs to be done is that the LinkedList that is
included with the posting needs to be changed to store characters
instead of integers. This primarily requires changing the type of the
data field in the Node class. We also need to change the DeleteAtHead
and DeleteAtTail methods so that they return the deleted ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.