0% found this document useful (0 votes)
11 views5 pages

Set of Programming

Uploaded by

Ranled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Set of Programming

Uploaded by

Ranled
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

SET OF PROGRAMMING

Group 3

Aron Saron
Andrew M. Tayco
Jhona Mae R. Tayco
Paulyn T. Zapata
Rhea Mae G. Ascaño
SETS in programming refers to date structures
that represent a collection of distinct element
they are typically used when you need to store
and manipulate a group of items with the
following characteristics:

UNIQUENESS: Set do not allow duplicate element.


Each element in a set unique.

NO SPECIFIC ORDER: Set do not have a specific order


for their elements. The elements are not indexed and
their arrangements is not guaranteed.
Creating sets in python:

• You can create a set python by using curly braces or


the set () constructor:
Sets basicbasic operation (python)

• Use the add ( ) method to add element to a set


• Remove element by using the remove ( ) method. (Note:
it raises a key error when element to be removed is not
found. Use discard ( ) to minimize this error.
• Combine set by using the union ( ) method
• The method difference ( ) can be used to perform
difference method
• The issubset ( ) and issuperset ( ) method returns . True if
one set is a subset and superset respecting.
• The pop ( ) method returns the arbitrary element from the
set.
Significance of sets in computer science

Set are a significant and fundamental structure in programming with a


wide range of application. Their importance lies in their ability to
efficiently store and range collections of data with certain key
characteristics:

1. UNIQUENESS: Set do not allow duplicate element. Each element is


unique with in the set.

2. FAST MEMBERSHIP TESTING: Set provide fast membership testing.


Checking whether an element is present in a set typically has a
constant (0(1)) complexity, making sets an efficient choice for this
operation.

3. EFFICIENT SET OPERATION: Set support set operations such as


union, interaction, and difference.

You might also like