[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Abstract data type constructed from combinations of the four fundamental data types

Posted on 2006-05-24
Medium Priority
Last Modified: 2010-03-31

Another quick question. Does anyone know of any abstract data types constructed from the following types of data types,

- a set with components which are sets
- a set with components which are lists
- a list with components which are sets
- a tree with components which are lists

and so on. Any help really appreciated.

Question by:nhay59
  • 2
LVL 14

Expert Comment

ID: 16752436
a set with components which are sets
new Set<Set>();

a set with components which are lists
new Set<List>();

and so on

Author Comment

ID: 16752552

Thanks for the reply. I'm sorry, I should have been more specific. I'm trying to find examples of complex data types that are constructed from the combinations of other data types, eg: a set of sets

I'm not currently trying to code this, buit think of theoretical aspect of the ADTs.

Thanks for any help.

Accepted Solution

fffej78 earned 2000 total points
ID: 16752760
A set of sets could be used to model an unordered n-ary tree.

A leaf would be represented as {} and a branch { Left, Right }

Therefore a simple tree with 1 as the root and 2 and 3 as leaves would be { 1, {2,3} }

You can extend this to binary trees if it is a list of lists (lists are ordered, important for binary trees).

A set with components that are lists could be used to model a map.  

The list < {A,1}, {B,2}, {C,3} > could represent a Map, A->1, B->2, C->3

Not that these are particularly good ways of implementing this sort of idea :)

Author Comment

ID: 16753710

Thanks for the help.

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question