All Questions
Tagged with java linked-list
253 questions
3
votes
3
answers
1k
views
Java class subset of C++ std::list with efficient std::list::sort()
Issues with generics < E > and < E extends Comparable > in code below. What changes are needed in the code below to prevent DLList.push_front() and DLList.push_back() from accepting ...
2
votes
2
answers
197
views
Reversing in between a linked list
I have written code for this leetcode problem :-
Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list from position left to ...
1
vote
2
answers
116
views
Circular list vs. doubly-linked list: which is faster?
In this post, I will compare performance of a circular list and a conventional list with head/tail -references:
...
0
votes
1
answer
151
views
LeetCode - LRU Cache by rodde
I have solved this LeetCode problem. Depending (perhaps) on the server load, I once scored the following performance figures:
My code follows:
...
1
vote
2
answers
439
views
1
vote
1
answer
90
views
Reverse a sublist of a singly-linked master list in constant space and maximum of one pass (Java)
So I found this funky programming challenge somewhere on Quora. The idea is to take the head of a singly-linked list, and reverse a specific sublist. The requirements are:
runs in constant space,
...
2
votes
1
answer
100
views
Finding better logic for addition and removal of Nodes in a Linked List
Consider the following piece of code I wrote (a templated Linked List):
...
0
votes
1
answer
58
views
Faster, indexed, heuristic doubly-linked list data structure in Java: unit tests
Here I have the unit tests for the indexed doubly-linked list.
It goes like this:
...
2
votes
1
answer
87
views
Faster, indexed, heuristic doubly-linked list data structure in Java: benchmark
I have this benchmark program for my indexed linked list.
It looks like this:
com.github.coderodde.util.benchmark.LinkedListBenchmarkRunner
...
2
votes
1
answer
228
views
Faster, indexed, heuristic doubly-linked list data structure in Java: implementation
I have this doubly-linked list data structure that runs all the single-element operations in \$\Theta(\sqrt{n})\$ time (refer to this post and this repository).
(See this for benchmarks.)
(See this ...
1
vote
2
answers
310
views
SumList Cracking the coding Interview
Sum of 2 numbers, represented with linked lists, where digits are in backward order or forward order.
Backward order Example
INPUT:(7->1->6) + (5->9->2) = 617+295
OUTPUT: 2->1->9 = ...
3
votes
0
answers
310
views
How can I filter and sort LinkedList faster and more effective?I have list of orders that should be processed
I have method that fetches all orders from Database and filtering, sorting that data(I know better to do It by specific query to Database but I dont know how).
I have Order entity that has following
<...
3
votes
1
answer
351
views
Java Singly-linked List: how to be efficient and clean
this is my first time on StackExchange. I am new to writing code. This is a singly-linked list I made in Java using generics with no sentinel nodes (i.e. no empty head and tail nodes). Looking for ...
3
votes
2
answers
167
views
Linked List implementation of FileSystem directories
I am writing wrapper classes in Java which override methods of an existing implementation, in order to handle an edge case. The full implementation is a bit more complex than needs to be posted here, ...
5
votes
1
answer
81
views
Dynamic-sized Hash table with Linked List
Below is an implementation heavily based on climberig's implementation on Leetcode for LeetCode 706. Design HashMap. Just to preface, I am doing this in preparation for an exam.
The one below is ...