Thread: data structures
View Single Post
  #3  
Old 03-19-2009, 08:42 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by napo_p2p View Post
That's a fairly good exercise. I remember taking a data structures course a few years ago, and we had to implement these things from scratch (sort of similar to what you did). Any chance this is inspired by such a course?

Just some things I noticed:
You could simplify the empty() function:
PHP Code:
public function empty() { 
  return 
front() == null;

And, the front() function just needs to be:
PHP Code:
public function front() { 
    return 
this.data[0]; 

I have a feeling you may have ported that bit over from Java or something from the way you're dealing with the null case.

I've written mostly in java, haven't done data structures since sophomore year in high school when I took AP CS AB.

Was working on something earlier today, thought a queue would be useful, couldn't find a graal version anywhere.
Reply With Quote