Docsity

Double Linked Nodes - Assignment 9 - Data structures I | COMP 380, Assignments of Data Structures and Algorithms

Toggle sidebar
bg1
Wentworth Institute of Technology
Division of Professional and Continuing Studies
COMP380 Section 71 - Data Structures I - Spring, 2007
Homework 9 โ€“ Double Linked Nodes
Instructor: Bob Goldstein (617) 912-2512
http://home.comcast.net/~goldsteinr/Courses/index.html
http://goldstein.eri.harvard.edu/courses/index.html
http://myweb.wit.edu/goldsteinr/Courses/index.html
Due Date: April 10, 2007
Hand In: Printout of program code and dialogue of how it runs.
Purpose: Practice using Double Linked Nodes to implement linked lists
1. Start with the UseDNodes program we did in class. You will also need to make a copy, in your
own project of the Ford and Topp DNodes Class and DNode class. The first step is just to get this
project implemented on your own machine and run it.
2. Add a method , rotateLeft(int n,DNode<T> header) that will shift the list
to the left by n items. Make sure you put error checks into your program so that it will do the
proper thing if there are too few nodes. Test your method.
3. Add a similar method rotateRight(int n,DNode<T> header) to your
program and test.
Extra Credit:
Start with the ListCommand program we did in class. Add the โ€œSโ€ command to the command line
options that will Shift the list to t he left or right.
S 2 //this will shift the list to the right by two nodes
S -2 //this will shift the list to the left by two nodes
/app/work/qkd8xx-463599-2765037-homework9-doc.doc 1 12/2/2020 12/2/2020

Partial preview of the text

Download Double Linked Nodes - Assignment 9 - Data structures I | COMP 380 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Wentworth Institute of Technology

Division of Professional and Continuing Studies

COMP380 Section 71 - Data Structures I - Spring, 2007

Homework 9 โ€“ Double Linked Nodes

Instructor: Bob Goldstein (617) 912- [email protected] http://home.comcast.net/~goldsteinr/Courses/index.html http://goldstein.eri.harvard.edu/courses/index.html http://myweb.wit.edu/goldsteinr/Courses/index.html Due Date: April 10, 2007 Hand In: Printout of program code and dialogue of how it runs. Purpose: Practice using Double Linked Nodes to implement linked lists

  1. Start with the UseDNodes program we did in class. You will also need to make a copy, in your own project of the Ford and Topp DNodes Class and DNode class. The first step is just to get this project implemented on your own machine and run it.

2. Add a method , rotateLeft(int n,DNode header) that will shift the list

to the left by n items. Make sure you put error checks into your program so that it will do the proper thing if there are too few nodes. Test your method.

3. Add a similar method rotateRight(int n,DNode header) to your

program and test. Extra Credit: Start with the ListCommand program we did in class. Add the โ€œSโ€ command to the command line options that will Shift the list to t he left or right. S 2 //this will shift the list to the right by two nodes S -2 //this will shift the list to the left by two nodes /app/work/qkd8xx-463599-2765037-homework9-doc.doc 1 12/2/2020 12/2/