-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sample submissions for Zucchini Sample Assignment
- Loading branch information
0 parents
commit e522ff3
Showing
7 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Student name: Alice | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.LinkedList; | ||
|
||
public class LLQueue implements QueueInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLQueue() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void enqueue(Object o) { | ||
backingLL.add(o); | ||
} | ||
|
||
@Override | ||
public Object dequeue() { | ||
return backingLL.remove(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Student name: Alice | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.EmptyStackException; | ||
import java.util.LinkedList; | ||
import java.util.NoSuchElementException; | ||
|
||
public class LLStack implements StackInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLStack() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void push(Object o) { | ||
backingLL.push(o); | ||
} | ||
|
||
@Override | ||
public Object pop() { | ||
return backingLL.remove(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Student name: Bob | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.EmptyStackException; | ||
import java.util.LinkedList; | ||
import java.util.NoSuchElementException; | ||
|
||
public class LLStack implements StackInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLStack() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void push(Object o) { | ||
backingLL.push(o); | ||
} | ||
|
||
@Override | ||
public Object pop() { | ||
try { | ||
return backingLL.pop(); | ||
} catch (EmptyStackException e) { | ||
throw new NoSuchElementException(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Student name: Charlie | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.LinkedList; | ||
|
||
public class LLQueue implements QueueInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLQueue() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void enqueue(Object o) { | ||
backingLL.add(o); | ||
} | ||
|
||
@Override | ||
public Object dequeue() { | ||
return backingLL.remove(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Student name: Charlie | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.EmptyStackException; | ||
import java.util.LinkedList; | ||
import java.util.NoSuchElementException; | ||
|
||
public class LLStack implements StackInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLStack() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void push(Object o) { | ||
backingLL.push(o); | ||
} | ||
|
||
@Override | ||
public Object pop() { | ||
return backingLL.pop(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Student name: Dave | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.LinkedList; | ||
|
||
public class LLQueue implements QueueInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLQueue() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void enqueue(Object o) { | ||
backingLL.add(o); | ||
} | ||
|
||
@Override | ||
public Object dequeue() { | ||
return backingLL.remove(); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Student name: Dave | ||
|
||
package edu.utopiatech.cs1337.hw1; | ||
|
||
import java.util.EmptyStackException; | ||
import java.util.LinkedList; | ||
import java.util.NoSuchElementException; | ||
|
||
public class LLStack implements StackInterface { | ||
private LinkedList backingLL; | ||
|
||
public LLStack() { | ||
backingLL = new LinkedList(); | ||
} | ||
|
||
@Override | ||
public void push(Object o) { | ||
backingLL.push(o); | ||
} | ||
|
||
@Override | ||
public Object pop() { | ||
try { | ||
return backingLL.pop(); | ||
} catch (EmptyStackException e) { | ||
throw new NoSuchElementException(); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return backingLL.isEmpty(); | ||
} | ||
} |