From b935c1f10ef9cc950fae7d05935c0dae94f04686 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 15 Feb 2024 12:56:34 -0500 Subject: [PATCH] Created Alg Design Block (Besides Big O) --- src/Assignments/A2/Substrings.java | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/Assignments/A2/Substrings.java diff --git a/src/Assignments/A2/Substrings.java b/src/Assignments/A2/Substrings.java new file mode 100644 index 0000000..16c4489 --- /dev/null +++ b/src/Assignments/A2/Substrings.java @@ -0,0 +1,52 @@ +// Name: Jonathan Turner +// Class: CS 4306/01 +// Term: Spring 2024 +// Instructor: Dr. Haddad +// Assignment: 2 +// IDE Name: IntelliJ +/* +Algorithm Design Block + Algorithm title: Finding Substrings + + Logical steps: + Step 1: Gather input for the text and store them in a string. + Step 2: Create a counter that tracks how many substrings are in the text. + Step 3: Iterate through a for loop (i) that goes from 1->n. + Step 4: If the ith letter in the text is equal to A, then move to Step 5. Otherwise, continue loop. + Step 5: Iterate through a for loop (j) which is inside loop (i) and goes from i+1->n. + Step 6: If the jth letter in the text is equal to B, increment counter. + Step 7: At the end of the loop (i), return the counter to show the number of substrings. + + Pseudocode Syntax: + text <- input + counter <- 0 + comps <- 0 + + for i <- 1 to n + if text[i] = A + for j <- i+1 to n + if text[j] = B + counter + 1 + comps + 1 + comps + 1 + + return counter, comps + + Big-O Analysis: (Based on Implementation) + + + +*/ + +package Assignments.A2; + +/** + * Performs a brute force/exhaustive search for + * how many substrings start with A and end with B. + * + * @author Jonathan Turner + */ +public class Substrings { + + +}