From 31a416f7bbcfd2272db0dc5e93fe24cd800d5d5f Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Tue, 29 Oct 2019 11:24:33 -0500 Subject: Finish things --- csci1913/Java/notes/sequence.java | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 csci1913/Java/notes/sequence.java (limited to 'csci1913/Java/notes') diff --git a/csci1913/Java/notes/sequence.java b/csci1913/Java/notes/sequence.java new file mode 100644 index 0000000..ac8f487 --- /dev/null +++ b/csci1913/Java/notes/sequence.java @@ -0,0 +1,41 @@ +class Sequence { + private Base[] bases; + private int count; + + public int find (Base base){ + if (base == null) { + for (int i=0; i 0) { + builder.append(bases[0].toString()) + //Add a helper fo the null pointer + for (int i = 1; i < count; i += 1) { + builder.append(" ,"); + //Add a helper to not dereference the null pointer + builder.append(bases[i].toString()); + } + } builder.append(']') + return builder.toString(); + } +//Arrays as sequences + //Add O(n) needed a copy loop + //Delete O(n) needed a copy loop - first element + //Find O(n) used linear search + //Can we go faster? (Yes, probably) \ No newline at end of file -- cgit v1.2.3