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

x
?
Solved

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

Posted on 2006-05-24
4
Medium Priority
?
191 Views
Last Modified: 2010-03-31
Hi,

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.

Thanks
0
Comment
Question by:nhay59
  • 2
4 Comments
 
LVL 14

Expert Comment

by:hoomanv
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
0
 

Author Comment

by:nhay59
ID: 16752552
Hi,

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.
0
 
LVL 4

Accepted Solution

by:
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 :)
0
 

Author Comment

by:nhay59
ID: 16753710
Hi,

Thanks for the help.
0

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