O'Reilly logo

Learning Functional Data Structures and Algorithms by Raju Kumar Mishra, Atul Khot

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

Chapter 6.  Graph Algorithms

How does immutability affect algorithm design? How are typical algorithms implemented without resorting to in-place mutation?

This chapter will give you a taste of functional algorithms. List prepending will be one dominating theme here. We will start by looking at list reversal and how prepending helps in dealing with algorithms.. We will then look at an efficient algorithm for list reversal using list prepending.

Graphs are a very important data structure; they are used to model related entities. We will be looking at directed graphs, also known as digraphs. We will implement functional versions of common digraph algorithms, for example, traversing a graph and visiting each node to do something useful.

Topological ...

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