answersLogoWhite

0


Best Answer

Splay(T,x)

while p[x] <> NIL

do y = p[x]

z = p[y]

if x = left[root[T]]

then Right-Rotate(T,root[T])

else if x = right[root[T]]

then Left-Rotate(T,root[T])

else if x = left[y] and y = left[z]

then Right-Rotate(T,z)

Right-Rotate(T,y)

else if x = right[y] and y = right[z]

then Left-Rotate(T,z)

Left-Rotate(T,y)

else if x = right[y] and y = left[z]

then Left-Rotate(T,y)

Right-Rotate(T,z)

else if x = left[y] and y = right[z]

then Right-Rotate(T,y)

Left-Rotate(T,z)

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the pseudocode for splay tree?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is splay tree?

A splay tree is a Binary search tree with the property of self modification. The node that is searched for will be brought to the root using rotations similar to AVL tree if it is existing or it is created and placed as the root. Hence, recently accessed nodes will always be nearer to the root.


When was Splay - album - created?

Splay - album - was created on 1996-01-01.


What is splay sand how is it formed?

Splay sand is a floodplain that consists of course sand particles. Splay sand is formed during flooding and the sand is deposited away from the main channel.


Types of algorithm?

pseudocode


What is imitation code?

pseudocode


What is a pseudocode design tool?

SPOK (Structured Prose Organizer for KEDIT) is a pseudocode design tool. (SPOK4 at Verizon.Net)


What is a splay?

A splay is a slanted or outward extension or projection, often referring to architectural elements such as windows or walls. It can help maximize sunlight exposure or provide a better view.


Difference between pseudocode and structured English?

structured English resembles spoken Englishwhere as pseudocode resembles programming languageWhat_are_the_differences_between_structured_English_and_pseudo_code


Develop an algorithm to display all prime numbers from 2 to 100 Give both the pseudocode version and the flowchart version Convert your pseudocode into a Java program?

Develop an algorithm to display all prime numbers from 2 to 100. Give both the pseudocode version and the flowchart version. Convert your pseudocode into a Java program.


What is a 5 letter word for expand?

splay, widen, swell


When do you perform rotations in a splay tree?

when the specific node searched by many times we place the node become root of the tree by using different Rotations 1)Zig Zig Rotation 2)Zag Zag Rotation 3)Zig Zag Rotation 4)Zag Zig Rotation Seraching is Efficent then AVl Tree


What is the opposite to pigeon-toed?

The opposite of pigeon toed is splay foot. The foot is turned out in this case, while pigeon foot means turned in. The person often is flat-footed as well. Infants until age 2 often are pigeon toed.