Skip to main content

All Questions

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
2 answers
625 views

Josephus Problem with cyclic iterator

Given the Josephus Problem. Josephus Problem N people (numbered 1 to N) are standing in a circle. Person 1 kills Person 2 with a sword and gives it to Person 3. Person 3 kills Person 4 and ...
MAttti's user avatar
  • 35
1 vote
1 answer
2k views

Deleting the head node of a circular linked list

Today I tackled this coding challenge: Given a circular linked list, implement a method to delete its head node. Return the list's new head node. I would appreciate any feedback. ...
TheLearner's user avatar
4 votes
3 answers
10k views

Circular Singly Linked List using Java

Please review my implementation of a Circular Singly Linked List. ...
Abhinav Tyagi's user avatar
2 votes
3 answers
184 views

ADT Stack with a doubly circular linked list

I have managed to implement an ADTStack with a circular doubly linked list. I would like to know whether there are things I could have done better or, I should ...
user3683131's user avatar
2 votes
1 answer
6k views

Form a loop with previous and next

I have a class Edge which looks something like this: class Edge { Edge previous; Edge Next; } I have edges in an <...
clankill3r's user avatar
1 vote
1 answer
6k views

Doubly circular linked list implementation with successive update in O(1)

For the queries mentioned in link in 3 parts, the first two parts have been addressed, as mentioned below: Part I (6 points) list/DList.java contains a skeleton of a doubly-linked list class. Fill ...
overexchange's user avatar
  • 3,401
2 votes
3 answers
24k views

Josephus Problem in Java

Problem The Josephus Problem is a famous mathematical puzzle that goes back to ancient times. There are many stories to go with the puzzle. One is that Josephus was one of a group of Jews who ...
user2733436's user avatar
2 votes
2 answers
320 views

Is this circular linked list better than the fast & slow pointer method?

I have a faster way to find if a list is circular linked list, in contrast to the solution that Cracking the Coding Interview has offered: In the below algorithm, ...
David Prun's user avatar
11 votes
3 answers
9k views

Doubly-Linked Circular Linked List

I'm a C++ programmer learning Java in preparation for an OOP class this fall. That being said, Java is fairly new to me so I'd love to hear feedback on how to improve this code. A few notes: Code ...
user avatar
7 votes
2 answers
2k views

Counting number of nodes between two nodes

This code counts the number of nodes between any given two nodes in a circular linked list. Any feedback is appreciated: ...
Here to Learn.'s user avatar
5 votes
2 answers
614 views

Circular linked list of integers

I'm looking for a review paying special attention as to whether the code can be optimized in the form of number of variables used, especially for the delete() ...
happs's user avatar
  • 223
3 votes
1 answer
10k views

Insert in circular linked list

Please review my code. ...
JavaDeveloper's user avatar