• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

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

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
nhay59
Asked:
nhay59
  • 2
1 Solution
 
hoomanvCommented:
a set with components which are sets
new Set<Set>();

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

and so on
0
 
nhay59Author Commented:
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
 
fffej78Commented:
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
 
nhay59Author Commented:
Hi,

Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now