Skip to content

Latest commit

 

History

History
38 lines (17 loc) · 932 Bytes

File metadata and controls

38 lines (17 loc) · 932 Bytes

CS3310 Final

This project contains solutions to these three coding problems:

  1. You are given an array of integers (both positive and negative values). Find the contiguous sequence with the largest sum.

EXAMPLE Input: 2, -8, 3, -2, 4, -10 Output: 5 which is the sequence [3, -2, 4]

This solution can be found in the file named "ContiguousLargestSum.java"

Time Complexity: O(n)

Space Complexity: O(1)

  1. Given 2 very large binary trees T1 and T2. Create an algorithm to deter-mine if T2 is a subtree of T1. Assume T1 is always much larger than T2

This solution can be found in the file named "SubTreeProblem.java"

Time Complexity: O(n * m)

Space Complexity: O(log(n) + log(m))

  1. Given an NxN matrix of positive and negative integers, find the submatrix with the largest possible sum

This solution can be found in the file named "SubmatrixProblem.java"

Time Complexity: O(n^3)

Space Complexity: O(n)