Tag: Linked Lists

  • Linked List

    I have pretty much covered the linked list, at least for now. I know there is more stuff to add. This was interesting to revisit, and I started at the beginning of mod3 and am finishing it in mod4. Going through this, there are some things I would definitely change, but this is an interesting…

  • Includes & Find

    These are the last two methods I’ll probably write about in this linked list series. You know the drill by now, so here are the tests (I’m giving you all of them at once, apologies for the big code block) Alright, so there are quite a few edge cases for find, so we will start…

  • 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 – Append

    The content details the development of an append method for a linked list using test-driven development (TDD). Initially, tests fail due to an undefined append method, prompting the creation of functionality to append data correctly. The implementation iterates through nodes to add multiple elements, ensuring they link appropriately without overwriting existing nodes.

  • Linked List Class

    The content outlines the initial steps to build a Linked List in Ruby, emphasizing the creation of the LinkedList class and basic tests. It details the importance of ensuring the class exists, initializing the head as nil, and implementing an empty? method to verify the list’s state. Subsequent additions are planned for functionality expansion.