why does a set of numbers appear to be sorted? [duplicate]

  • Last Update :
  • Techknowledgy :

I can even change the order of the elements based on how I put them into the set:

>>> print({
   1,
   9
})
set([9, 1]) >>>
   print({
      9,
      1
   })
set([1, 9]) >>>
   set([9, 1])
set([9, 1]) >>>
   set([1, 9])
set([1, 9])

Suggestion : 2

Last Updated : 06 Jul, 2022

Example: 

Input: n = 7 and array[] = {
   1,
   2,
   3,
   6,
   3,
   6,
   1
}
Output: 1, 3, 6

Explanation: The numbers 1, 3 and 6 appears more
than once in the array.

Input: n = 5 and array[] = {
   1,
   2,
   3,
   4,
   3
}
Output: 3

Explanation: The number 3 appears more than once in the array.

The repeating elements are:
   2
3

The repeating elements are:
   2
3

2
3

Suggestion : 3

This section will discuss the removing or deletion of the duplicate elements from an array in the C programming language. When the same number of elements occurs in sorted or unsorted array, then the elements of the array is called the duplicate elements. And we need to delete these duplicate elements or same number from an array to make the resultant array consists of unique elements.,Let's consider an example to delete the same number or duplicate elements from sorted array in the C programming language.,Following is the algorithm to delete the duplicate array's elements from the sorted array in the C programming language.,For example, there is an integer type array arr[10] that contains { 5, 8, 3, 3, 5, 9} elements. In this array, 3 and 5 occurs two times. Hence, these elements are duplicate elements. So, after deleting the duplicate elements from an array arr[], we get 5, 8, 3,9 elements.

Define the number of elements in an array: 10

Enter 10 elements of an array:
   57
12
89
32
62
12
89
35
67
75

Array elements after deletion of the duplicate elements: 57 12 89 32 62 35 67 75
Define the no.of elements of the array: 10
Enter the elements: 5
6
6
7
8
8
9
10
11
11

Elements before removing duplicates: 5 6 6 7 8 8 9 10 11 11
Display array 's elements after removing duplicates:  5 6 7 8 9 10 11
Define the size of the array element: 10

Enter the elements of the array:
   5
5
6
7
7
8
8
9
10
11
After removing the duplicate elements: 5 11 6 7 10 8 9
Display the unique elements from the sorted array:
   5 10 15 20 25 30