Tag: Ruby

  • insert into linked list

    The post outlines the implementation of an insert method for a Linked List. It emphasizes writing tests to ensure functionality and error handling when inserting elements. The method includes a prepend option for inserting at the start and ensures valid locations by raising errors when necessary. The process culminates in successfully adding new nodes.

  • node_at

    This time around, we’ll be making a method that allows you to search for a specific node, and tell you what it contains. We’ll have to use a counter to keep track of the index. As usual, let’s write a test This makes a list of ‘a’, ‘b’, ‘c’, ‘d’, ‘e’ and we’re asking what…

  • Prepend – LinkedList

    The post discusses implementing a “prepend” method for a linked list, allowing items to be added at the beginning. It begins with tests for appending items and then fails to recognize “prepend” as a method. The author details the implementation and confirms that the tests pass successfully after defining the method.

  • Linked List to String

    The post discusses the implementation of a “stringify” method for a LinkedList class, allowing the conversion of node data into a string. Initial tests are conducted to ensure it functions for single and multiple data points, leading to code modifications for proper formatting and handling of empty lists.