Consider the following list of numbers: 2,6,8,4, 66, 9, 7, 8, 3, 33, 44 Jack wants to categorize the above numbers in three groups. Group 1 will contain numbers less than 5 Group 2 will contain numbers between 5 and 10 Group 3 will contain numbers greater than 10 The final output that Jack wants is: 2,4,0,316, 8,9,71 66, 33, 44 What data structure should be used to carry out the above operation?
Answers
Input : 1 5 7 2 9 14
Input : 1 5 7 2 9 14Output : 13
Input : 1 5 7 2 9 14Output : 13The groups of two that can be
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)(1, 9, 14)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)(1, 9, 14)(7, 9, 14)
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)(1, 9, 14)(7, 9, 14)Input : 3 6 9 12
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)(1, 9, 14)(7, 9, 14)Input : 3 6 9 12Output : 10
Input : 1 5 7 2 9 14Output : 13The groups of two that can be formed are:(1, 5)(5, 7)(1, 2)(2, 7)(1, 14)(7, 14)The groups of three are:(1, 5, 9)(5, 7, 9)(1, 2, 9)(2, 7, 9)(2, 5, 14)(1, 9, 14)(7, 9, 14)Input : 3 6 9 12Output : 10All groups of 2 and 3 are valid.