Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Set Represntation, please help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Set Represntation, please help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Scheduled Pinned Locked Moved Java
helpjavatutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sudany_zool
    wrote on last edited by
    #1

    I have this problem, I need to represent set in the following form [L,R] where L is the left hand-bound of the set , and R is the right hand-bound each of L and R are a collection of sets for example L= [{1},{2},{2,3}] R=[{1,2,3},{2,3,4}] [L,R]= [{ {1},{2},{2,3} } , { {1,2,3},{2,3,4} }] how can i do this in java

    D 1 Reply Last reply
    0
    • S sudany_zool

      I have this problem, I need to represent set in the following form [L,R] where L is the left hand-bound of the set , and R is the right hand-bound each of L and R are a collection of sets for example L= [{1},{2},{2,3}] R=[{1,2,3},{2,3,4}] [L,R]= [{ {1},{2},{2,3} } , { {1,2,3},{2,3,4} }] how can i do this in java

      D Offline
      D Offline
      daniel_at_work
      wrote on last edited by
      #2

      There are many ways that you could represent this depending on what you are trying to do. My initial thought is a 2 element array of sets of sets e.g. Set s1 = new Set(); s1.add(1) Set s2 = new Set(); s2.add(2) Set s23 = new Set(); s23.add(3) s23.add(2) Set left = new Set{} left.add(s1} left.add(s2} left.add(s23} /* * Prepare Right Side now */ Set[] allSets = new Set[2]() allSets[0] = left; allSets[1] = right; Do the Sets in L and R have to be unique. Also why are you modelling the sets what do you expect to do with them. If it is a bit more rigid and you want to perform operations on the sets you may want to use a class to model them e.g. public Class LeftRightSet() { private Set left; private Set> right; // Further manipulation classes } Hope this helps

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups