Skip to main content

UFDS.move

Move an item from its original set to a new set

Usage

move(item_number:int, destination_number:int)

Parameters:
      item_number : int
            Item number to be moved
      destination_number : int
            Set to be moved under

Example

from jellybeans.structures import UFDSufds = UFDS(10)ufds.union(1, 3)ufds.union(5, 3)ufds.union(7, 3)ufds.union(2, 4)ufds.move(1, 4)print(ufds.is_same_set(1, 7)) # Falseprint(ufds.is_same_set(2, 1)) # True