O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example – spin the wheel

This example simulates a game in which the user spins a wheel with random speed. The wheel rotates slower and slower until it stops. Then the user can spin it again, from the previous stop position, as shown in the following diagram:

Let's proceed to the first part of code of the Main method in the Program class:

CircularLinkedList<string> categories = new CircularLinkedList<string>(); categories.AddLast("Sport"); categories.AddLast("Culture"); categories.AddLast("History"); categories.AddLast("Geography"); categories.AddLast("People"); categories.AddLast("Technology"); categories.AddLast("Nature"); categories.AddLast("Science"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required