Book Image

Learning F# Functional Data Structures and Algorithms

By : Adnan Masood
Book Image

Learning F# Functional Data Structures and Algorithms

By: Adnan Masood

Overview of this book

Table of Contents (21 chapters)
Learning F# Functional Data Structures and Algorithms
Credits
Foreword
Foreword
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Tree as a data structure


Trees are everywhere! As a data structure, trees are highly prolific in computer science literature. Due to their ubiquity and powerful intuitive design, in computer science algorithms you would see trees being used in diverse domains. Whether it be file systems, sentence parsing, compiler construction algorithms, or human ancestry solutions, trees can represent hierarchical structures quite effectively.

In computer science, graphs are one of the fundamental data structures used for representing information from web links to metabolic pathways in cells. A graph consists of nodes (also known as vertices) and edges (which is a quite confusing name since they are links and not literally edges). Graphs can also contain cycles. We will discuss graphs in greater detail in Chapter 8, Quick Boost with Graph.

A tree, on the other hand, is a special case of a graph in which any two nodes can be connected by exactly one pathway. This restriction distinguishes trees from the graphs...