Questions tagged [splay-tree]

A splay tree is a self-adjusting binary search tree with excellent amortized performance.

70 questions
0
votes
2 answers

Bug in Splay tree insertion implementation

I have been trying to implement splay tree but met with no success so far.Previously I successfully implemented binary search tree and avl tree and since splay tree is a variation of binary search tree so the insertion code and rotation code is…
Souvik Ray
  • 2,899
  • 5
  • 38
  • 70
0
votes
1 answer

Is this splay tree incorrect in this UC Berkeley lecture video?

https://youtu.be/G5QIXywcJlY?t=31m47s At 31:47, I believe he performs a double right rotation with 5 being the grandparent, and 4 being the parent, and 1 being the child. After the double right rotation, he has 4 as the right child of 5.
Tommy Saechao
  • 1,099
  • 4
  • 17
  • 28
0
votes
1 answer

How to create the bottom up splay tree from the following sequence

This is the sequence 20,10,5,30,40,57,3,2,4,35,25,18,22,27 I've tried it by making every new inserted node as the root but it's not working. Can anybody give me step by step explanation?
0
votes
1 answer

Priority queue with O(1) Get-Min, Delete-Min and Merge operations

I'm wondering if there is a way to construct a priority queue structure that supports constant-time get-min, delete-min, and merge operations. I don't care about the time complexity of insertions and it doesn't have to support the decrease-key…
hslaster
  • 45
  • 4
0
votes
0 answers

A variation of splay tree

I want to create a splay tree with these two additional rules: does these two rules change the access time of splay tree(access lemma) ? if no , how can I prove it?
abdolahS
  • 663
  • 12
  • 35
0
votes
0 answers

Java Splay Tree rotate

Im working on a right rotate method for when i splay. I have nodes that i use to hold the value of the left child and the left childs right. On the case that im testing the left childs right is null but when i compile i get a null pointer exception.…
user214577
  • 363
  • 1
  • 7
  • 15
0
votes
2 answers

Splay Tree Search Implementation

I have been trying to learn the ins and outs of some data structures and I am trying to get a binary splay tree to work properly. Every time I run the following code and the node I am looking for is more than one past the root it tells me it is…
clifgray
  • 4,313
  • 11
  • 67
  • 116
0
votes
1 answer

Can not figure out how splaying works

I can not understand how splaying works. The part that I can not follow is how we know if a: i) zig ii) zig-zag or iii) zig-zig must be done. If I understand correctly this has to do with the current node in the path. If it is the root's child then…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
-1
votes
1 answer

SplayTreeSet contains duplicate values

I have a SplayTreeSet of the objects ChatRoomListModel. I'd like to order my set based on the objects DateTime createTime value. I'm not sure where I'm going wrong because there's duplicate items being added item. I later down the line perform a…
DanMossa
  • 994
  • 2
  • 17
  • 48
-4
votes
1 answer

Segmentation Fault when trying to splay a node in Splay tree

I'm working on implementing a splay tree. The insertion works perfectly, but when I try to splay the inserted node in a zig-zig or zig-zag fashion, I always get a segmentation fault. The left-right rotation, used when the node to be splayed has no…
Severage
  • 33
  • 1
  • 7
1 2 3 4
5