Skip to main content

All Questions

Tagged with
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 ...
rcgldr's user avatar
  • 282
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 ...
Strange Alchemist's user avatar
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: ...
coderodde's user avatar
  • 30.2k
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: ...
coderodde's user avatar
  • 30.2k
1 vote
2 answers
439 views

My LRU Cache implementation in Java

...
learner's user avatar
  • 31
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, ...
coderodde's user avatar
  • 30.2k
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): ...
kesarling's user avatar
  • 352
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: ...
coderodde's user avatar
  • 30.2k
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 ...
coderodde's user avatar
  • 30.2k
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 ...
coderodde's user avatar
  • 30.2k
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 = ...
Uomolepre's user avatar
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 <...
Justtoasktheneededquestions's user avatar
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 ...
Jen Weatherwax's user avatar
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, ...
Daniel Widdis's user avatar
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 ...
Alex Goncalves's user avatar

15 30 50 per page
1
2 3 4 5
17