Finished the Logical Steps for Partition.java

This commit is contained in:
Jonathan Turner 2024-02-17 13:26:46 -05:00
parent ddfa72731f
commit cec04a4544

View File

@ -0,0 +1,41 @@
// Name: Jonathan Turner
// Class: CS 4306/01
// Term: Spring 2024
// Instructor: Dr. Haddad
// Assignment: 2
// IDE Name: IntelliJ
/*
Algorithm Design Block
Algorithm title: Finding Equal Disjoint Sets
Logical steps:
Step 1: Get the number of items in the set as user input.
Step 2: Get the elements in the set as user input.
Step 3: Add all the elements to the list and save it to a variable.
Step 4: If the sum is odd, there is no disjoint sets and it is not possible.
Step 5: Set a variable that will hold the first set and second set representing the disjoint and initialize it to null.
Step 6: Create a List that holds a list of elements which represent each subset.
Step 7: Generate the subsets using a subset generation method. (Ex. Bit Shift Counting)
Step 8: Iterate through all the subsets that were generate.
Step 9: If the current iteration's sum is equal to half of the total sum, move to step 11. Otherwise, continue iterating.
Step 10: If the value is not found, then there is no disjoint equal subsets. End algorithm.
Step 11: Assign the first set's variable to the current iteration's values.
Step 12: Assign the second set's variable to the values of the original set that are not in the first set.
Step 13: Return the results of the two equal disjoint sets that were found.
Pseudocode Syntax:
Big-O Analysis: (Based on Implementation)
Best-Case Scenario:
Worse-Case Scenario:
Average-Case:
Big O =>
*/
package Assignments.A2;
public class Partition {
}