Common1

Common1 - CS 114 Exam 1 Name_ 1. Section_ Write a recursive...

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

View Full Document Right Arrow Icon
CS 114 Exam 1 Name___________________________________ Section_______________________ 1. Write a recursive method void hex(int n) that takes an integer parameter and prints the number in hexadecimal. You can assume that the input is greater than zero. Page 1 of 5
Background image of page 1

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

View Full DocumentRight Arrow Icon
The following problems use the classes below. The methods in the List class are described but the implementations are not given. public class Link { public Object data; public Link next; public Link(Object d, Link n){data = d; next = n;} } public class List { private Link head; // reference to head of linked list private Link tail; // reference to tail of linked list public List(){head = tail = null;} public void insertHead(Object data){//insert at head of list} public Object removeHead(){//remove from head of the list} public Object peekHead(){//return head item without removing} public void insertTail(Object data){//insert at tail of list} public Object peekTail(){//return tail item without removing} } 2. Fill in the implementation for the method:
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.

Page1 / 5

Common1 - CS 114 Exam 1 Name_ 1. Section_ Write a recursive...

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