answersLogoWhite

0

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

14y ago

What else can I help you with?

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.


What is the pseudocode for implementing the Kruskal algorithm to find the minimum spanning tree of a graph?

The pseudocode for implementing the Kruskal algorithm to find the minimum spanning tree of a graph involves sorting the edges by weight, then iterating through the sorted edges and adding them to the tree if they do not create a cycle. This process continues until all vertices are connected.


When was Splay - album - created?

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


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


Can you provide the pseudocode for Kruskal's algorithm?

Here is the pseudocode for Kruskal's algorithm: Sort all the edges in non-decreasing order of their weights. Initialize an empty minimum spanning tree. Iterate through all the edges in sorted order: a. If adding the current edge does not create a cycle in the minimum spanning tree, add it to the tree. Repeat step 3 until all vertices are included in the minimum spanning tree. This algorithm helps find the minimum spanning tree of a connected, undirected graph.


What is the pseudocode for converting Fahrenheit to Celsius?

Oh, converting Fahrenheit to Celsius is like painting a happy little tree. Here's a simple pseudocode for you: Input the temperature in Fahrenheit Subtract 32 from the Fahrenheit temperature Multiply the result by 5/9 to get the temperature in Celsius Just remember, there are no mistakes in pseudocode, only happy little accidents.


How to write pseudocode in Microsoft Word?

To write pseudocode in Microsoft Word, you can use the built-in Equation Editor or insert a text box and type your pseudocode inside it. You can also use a monospaced font like Courier New to format your pseudocode for better readability.


Types of algorithm?

pseudocode


What is imitation code?

pseudocode


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.


What is a pseudocode design tool?

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


What is splay sand how is it formed?

Splay sand refers to sand deposited by wave and tidal action in a beach environment, creating fan-shaped patterns. It is formed through the transport of sand by the water's energy, which causes the sand to spread out in a radiating pattern as the water recedes. Splay sands are typically found in intertidal zones where waves and currents are strong enough to shape and move the sand particles.