Fundamentals
Recursion
Stacks and Queues
ADT's and Complexity
Application
100
What is the fundamental way of managing complexity. This allows us to focus on essential details while hiding implementation specifics
Abstraction 
100

The fundamental technique in recursion that involves identifying the simplest version of a problem that can be solved directly

base case

100

What acronym describes the last in first out access pattern. what ADT uses this?

LIFO - Stack
100

This ADT provides storage for information with an order imposed on it's elements, but without strict access limitations

List

100

Given some Bounded Array Based Queue, describe ALL the requirements for removing an element from the queue

is there an element to remove

remove the element, decrement position counter

200

These two fundamental language constructs are used to implement ADT's in Java

Arrays and linked lists

200

Recursive problem solving requires us to answer three main questions when trying to problem solve - what are they?


Base case

general case - does the recursive step correctly solve the general problem

smaller caller - do recursive cals operate on smaller and smaller problems leading to the base case

200

This queue implementation technique involves using a circular pattern to efficiently manage a fixed size array

Floating point technique 

200

This time complexity characterizes the worst-case scenario for inserting an element in the middle of a list.

What is O(n)?

200

Given some linked list queue, describe ALL the requirements for removing an element from the queue

is there an element to remove

remove the element by changing head reference as needed

300

A set of possible values for an encapsulated data type, plus the specification of operations that can be performed on it

ADT

300

The recursive processing technique that involves searching a sorted array by dividing the search interval in half 

Binary Search

300

In a linked list implementation of a queue, these two references are crucial for efficient enqueue and dequeue operations.


Head and rear

300

When searching an unsorted list for a specific element, this time complexity represents a sequential search.

O(N)

300

Given a LinkedList walk through the steps required to sum every third element 

Traverse LL, keep counter, if counter %3, increment sum

400

What are the three levels of detail used to describe how we view ADT's, what does each concern. 

What are the specification (abstract), application (client), and implementation levels

400

What are the main pro's and cons to recursion

pro - code clarity

con- stack overhead

400
  • You're designing a text editor's undo/redo functionality with a maximum of 100 recent actions.
  • Answer Analysis: Explain which implementation would be more efficient - array-based or linked list-based stack. For arrays, what type?

Why?

Array based - not unbounded

400

If I have a O(N2) algorithm, what are the cases above this that I want to work towards?

What is O(N2) called?

  • 0(1) – Bounded time

  • The amount of work is bounded by a constant and is not dependent on the size of the problem

  • 0(log2N) – Logarithmic time

  • The amount of work depends on the logarithm in base 2, of the size of the problem

  • These algorithms successively cut the amount of data to be processed in half at each step

  • 0(N) – Linear time

  • The amount of work is some constant times the size of the problem

  • Algorithms that work through all the data to arrive at a conclusion

  • (N log2N) - Log-Linear Complexity

  • The amount of work is some constant times the size of the problem

  • Algorithms that apply logarithmic algorithms N times
    O(N2) - quadratic 

400

You're given a function that searches an  unsorted array with O(n) time complexity. Describe the specific algorithmic transformation that would reduce the time complexity to O(log n), explaining the key principles that enable this optimization.

Include the tradeoffs of this, when is this trade off worth it?

Sort the array, use binary search to conver to logN


The trade off is the added complexity in the add case


this trade off is worth it if we are searching far more than adding/removing

500

Explain why O(N) + O(N) resolves to O(N) but O(N) * O(N) is treated differently?

What is sequential operation dominance

500

Write a recursive Java method that calculates the sum of all even numbers from N down to 0.
The function should decrement N by 1 with each recursive call until it reaches 0.

public static int sumEvenNumbers(int n) {

       

        if (n <= 0) {

            return 0;

        }


        if (n % 2 == 0) {

            return n + sumEvenNumbers(n - 1);

        } 

       

        else {

            return sumEvenNumbers(n - 1);

        }

500

You're the lead architect designing a massive text editor with an unlimited undo/redo stack capable of handling millions of actions.

Explain which data structure you would use to build out this application

Array :)


Linked lists suffer from
Excessive memory overhead (each node requires additional reference pointers)

500

What are the three complexity cases we consider, which one is the driving force behind BigO and why?

Best case

Average case

Worst case

500

Walk through the roles of each main phase of our ADT building structure. Outline the requirements each phase is required to implement and their purpose. 

Walk through how this works when building the list ADT

Abstract, implementation, application

build interface, build class, apply program



M
e
n
u