CS112_22_assignment 3B

CS112_22_assignment 3B - Handout 22 Spring 2003 Yinglin...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout 22 Spring 2003 Yinglin Wang Assignment 3B – Editor Buffer Due date: April 10 In this assignment, you will complete the quest we described in class this week: designing an implementation for buffer.h in which all six of the fundamental editing operations run in constant time. The basic technique that you will use in your implementation is the doubly linked list, which is described informally in Chapter 9 but not completely coded. Moreover, to give you a sense of how to avoid the substantial space overhead imposed by cells containing two links for every character, this assignment also asks you to implement a hybrid strategy in which blocks consisting of several characters are linked together. The first part of the assignment is designed to give you an understanding of the dynamics of doubly linked lists before you move on to the more complicated task of combining characters into blocks. You will not turn in the code for the first part . You may thus feel tempted to go directly to Part 2, but we don ’ t recommend that approach. Students who have done this assignment in the past have found that they learned a great deal in Part 1, and that doing it was the best preparation for Part 2. As always, be sure you read the entire handout before you begin. The supplied modules Under Assignment 3 on our web site, you will find compressed files to download for the PC and Mac. When you download the appropriate file and expand it, you will find the following files: editor.c The outer editor application. Makes calls to buffer.h interface buffer.h The interface library for the buffer. listbuf.c A singly-linked list implementation of buffer.h DemoEditor A demo version of the program so you can see how it behaves When you create your project, you will need to add editor.c and listbuf.c to it. This should give you a program that behaves in the same way as the demo app. Getting that working and trying it out might be considered "Part 0" of the assignment. listbuf.c is the linked list version of the editor buffer given in Chapter 9 of the text. You will need to write your own buffer.c to replace the listbuf.c file for Part 1 of this assignment, and then you will create yet another version of buffer.c for Part 2. You should not change the buffer.h interface for Part 1 or Part 2 . If you ’ve got some terrific new extension that you want to add to the editor in search of an extra-credit score, get the assignment working first and then extend the buffer.h interface to support the new features in your editor. You will still be responsible for turning in a version that fulfills the basic requirements using the given buffer.h interface.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Part 1—Reimplement buffer.h using a doubly linked list From the standpoint of computational complexity, the only remaining problem with the linked-list implementation of buffer.h is that various operations are fast in one direction but slow in the other. Deleting, moving forward, and moving to the beginning of the buffer are all constant time operations. Unfortunately, moving backward and moving to
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 7

CS112_22_assignment 3B - Handout 22 Spring 2003 Yinglin...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online