I’m a beginner coder trying to work on converter for words which should work that way:Input= “zero;six;eight;two” Output = “0682”. But in my case the output I get is “0282”. Are there any solutions to that? Or like maybe I should program differently?. I found that LinkedLists or HashMap could work, if so could you show how? Answer You should
Tag: linked-list
Why does the class fields update their data after the method works
Help me please. Let’s say I have a Link class for linked lists. And there is the SortedList class where there are methods for working with data created by the first class. The insert method uses the first field. The first field passes its data to the current field. After the method exits with the current field, no changes are
implementation of LinkedList without last node
I have been asked to re-implement a linked list without the use of a tail. So I have to change its methods so it can work without using a tail node. The removeLast method confused me: here is what I tried to do, but it didn’t remove the node. What is wrong with my attempt? Test class Answer You need
Leetcode #2, getting detected a cycle error
I was trying to solve leetcode#2, You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0
Is it possible to use 2 Data Type in an Custom ADT(Sorted Linked List)?
I am trying to do a Leaderboard for a game by using a Sorted Linked List. I was able to do so by sorting the point in descending order which mean higher point to lower point. Moreover, I will also …
LinkedList inside a LinkedList iteration in java
Im trying to iterate a Linked List inside of a linked list but I’m not sure how to proceed with it. I’m used to using a passed parameter for what will be iterated but when I’m iterating a linked list …
Creating a sorted link list out of a normal linked list
As I’ve just started programming a few months back a lot of new information is coming and I’m having trouble catching up.So here I have created what I thought was a sorted linked list.Turns out it is not sorted The method works,it inserts the persons,but they arent sorted like they should be.What part of the code do I need to
Doubly Linked List, Insert Before A Given Node in Java
The method not working: Another add method which is working: A print method to debug: DoublyLinkedList class: LinkedList and Node implementations are very straightforward. Find here: https://www.geeksforgeeks.org/doubly-linked-list/ I first create a linkedlist, insert_front() a value to make the head not null, then use the method above to insert something else. Insertion to front, end, after a node are working, however,
Reverse Linked-List Recursive
I’ve traced through my code to reverse a linked-list using recursion, and I cannot find anything wrong with it, but I know it does not work. Can anyone please explain why? Answer Below is a working version of your code, added with some helping structures:
toString method for a linkedList
I am getting strange output for my toString in my linkedList class. I cannot use any methods, only String concat. So limited in how to approach this. Here is the code: I wrote a JUnit test that: and that noOrderList().toString() comes from: When I run the test I get: Was is the cause of this , in the [, ]