Family Tree using Generalized Linked List
Hello and Welcome. In the previous blog post, we saw how we can store polynomials using a linked list. We also saw various types of Linked Lists and studied in detail about the Generalized Linked Lists(GLLs).
This is the final blog of this blog series. In this blog, we will go a step further and learn how to use GLLs to implement a family tree. This will enable us to store hierarchical data. Let's start with the basics of a family tree.
What is Family Tree?
A family tree, or pedigree chart, is a chart representing family relationships in a conventional tree structure.
Apart from implementing a family tree, there are a lot of other applications of linked lists in the real world like:
After implementing the project, we realized that the comprehensive database of a group of people can be stored by increasing the number of nodes in the linked list. This method enables the programmer to easily access data.
This is the final blog of this blog series. In this blog, we will go a step further and learn how to use GLLs to implement a family tree. This will enable us to store hierarchical data. Let's start with the basics of a family tree.
What is Family Tree?
A family tree, or pedigree chart, is a chart representing family relationships in a conventional tree structure.
A simple family tree.
The algorithm for implementing the family tree is as follows:
-
Create
a struct node with: -
·
name
pointer
·
spouse
pointer
·
pointer
to sibling node,
·
pointer
to the child node,
-
In
this node we add our data for each family member
-
Then
to display the data stored in GLL Family Tree:
-
Function:
traversal(base node)
·
if
base==NULL exit() //base case
handling
·
create
a queue
·
enqueue
base node
·
while
q is not empty
a = dequeue
Print name and spouse of a
Enqueue all siblings of a
Print name of siblings
Enqueue children of a
Print
names of children
The results which were obtained after successful implementation have been shown in the figure below.
Results
Apart from implementing a family tree, there are a lot of other applications of linked lists in the real world like:
- Image viewer – Previous and next images are linked, hence it can be accessed by next and previous button.
- Previous and next page in the web browser – We can access previous and next URLs searched in a web browser by pressing back and next button since, they are linked as a linked list.
- Music Player – Songs in music players are linked to the previous and next song. you can play songs either from the starting or end of the list.
After implementing the project, we realized that the comprehensive database of a group of people can be stored by increasing the number of nodes in the linked list. This method enables the programmer to easily access data.
A family tree was implemented using the concepts of Generalised Linked List. The major features such as a parent, child, spouse, and siblings were conserved. This project is done in the C++ programming language with the object-oriented nature of programming.
Thus, we successfully completed the project on Family Tree using the Generalized Linked List in Object-oriented Programming.
References-
[1]Tutorials Point -https://www.tutorialspoint.com/index.htm
[2] GeeksforGeeks - https://www.geeksforgeeks.org/
The links for the presentation, project report and project video have been attached. Do visit them:
CP ppt - https://docs.google.com/presentation/d/1ha2nEE8rYtkyTg0WBMJwbuShAuBMbRM4gf2XtWDpMAY/edit?usp=sharing
Topic 2: What is GLL?
Saransh Kulkarni, K, 43, 1710532
Video Link - https://youtu.be/bgAtNHkN1j8
Topic 3: Algorithm and Results
Aadhiraj More, K, 51, 1710501
Topic 4: Application of Linked Lists
Sarvesh Patki, K, 72, 1710269
Video Link - https://youtu.be/QFXnrx0hYoQ
Blogger Handles of Teammates -
Saransh Kulkarni - https://oopblog1002.blogspot.com/
Aadhiraj More - https://oopsoperatoroverloading.blogspot.com/
Chinmay Pathak - https://chinmaysbgoodlog.blogspot.com/
I hope you had a great time learning about various programming concepts. It has been a great journey so far. Finally, on behalf of my team members, I would like to thank our teacher, Prof. Dr. Swati Shilaskar ma'am for guiding us throughout the process of writing blogs and implementing the course project. Looking forward to working on similar and more interesting projects. Thank you.
Sarvesh Patki
K - 72
Very well written!
ReplyDeleteThanks for the appreciation
DeleteAnushka Bhave : Very informative! Great blog!
ReplyDeleteThank you very much
DeleteGreat!!
ReplyDeleteThanks a lot
DeleteNice Work dude!
ReplyDeleteThanks
DeleteGreat work..! Short and simple
ReplyDeleteVery informative blog!
ReplyDeleteHas enlightened me!
ReplyDeleteYasdeque-to Jared Ellenberg https://wakelet.com/wake/ViPVsOG0s_EQGd9yL-9_c
ReplyDeletecoabestlugoo
wolfplacmeo Jordan Shamoon programs
ReplyDeleteprograms
nalematme