60 Views

trees in data structures and algorithms


Grag 7th Sep, 2021
Answer (1)
shikha jindal 7th Sep, 2021

In computer science, a tree is a widely used abstract data type that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes. A tree data structure can be defined recursively as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root. Alternatively, a tree can be defined abstractly as a whole (globally) as an ordered tree, with a value assigned to each node. Both these perspectives are useful: while a tree can be analyzed mathematically as a whole, when actually represented as a data structure it is usually represented and worked with separately by node (rather than as a set of nodes and an adjacency list of edges between nodes, as one may represent a digraph, for instance). For example, looking at a tree as a whole, one can talk about "the parent node" of a given node, but in general, as a data structure, a given node only contains the list of its children but does not contain a reference to its parent (if any).

Related Questions

Chandigarh University Admissi...
Apply
Ranked #1 Among all Private Indian Universities in QS Asia Rankings 2025 | Scholarships worth 210 CR
Amity University Noida MBA Ad...
Apply
Amongst top 3% universities globally (QS Rankings)
Amity University Noida B.Tech...
Apply
Among Top 30 National Universities for Engineering (NIRF 2024) | 30+ Specializations | AI Powered Learning & State-of-the-Art Facilities
Amity University, Noida Law A...
Apply
700+ Campus placements at top national and global law firms, corporates, and judiciaries
Jindal Global Law School Admi...
Apply
Ranked #1 Law School in India & South Asia by QS- World University Rankings | Merit cum means scholarships | Regular Admissions Deadline: 30th Apr'25
UPES B.Tech Admissions 2025
Apply
Ranked #42 among Engineering colleges in India by NIRF | Highest CTC 50 LPA , 100% Placements | Last Date to Apply: 28th April
View All Application Forms

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books