Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


There are benefits to this implementation: less thought is needed about generic data types because Ruby is a less typed language than C.  Multiple data types can be added to the list and then the same functions can be used to modify it (see extensions below).  But, the class in Ruby requires explicit get and set functions, which seem rather unnecessary and wasteful. 

This is the output of the program:

Image AddedImage AddedImage Added


  1.  The first extension I completed was to add a delete function to my LinkedList implementation. This allows the user to delete a node at any index in the list.  This challenged me to improve my looping through the list so I did it in a thoughtful and deliberate way (which actually made me go back and change some other functions).  The output of this is shown above. 
  2. The second extension that I completed was to figure out how to include a Ruby program in another program to be able to use its functions.  This made my code much more organized because my test functions can be separate from the main Linked List class and functions.  I also figured out how to get a Ruby main function to be called only when it is the file being called on the command line, not if it is included in another file.

  3. The third extension that I completed was to create another LinkedList to show that in Ruby it is possible to make and modify Linked Lists with multiple data types in the Nodes.  C would not be able to do this because although different functions can be used to modify different data types, it would be very hard to loop through a linked list and use a different function on different nodes based on the types of their node's item.  This is the output of making a list with an int, string, and float.