individualgit

View on GitHub

Menu

Home Tech Talk Team Github Replit Review Tickets About Me

Tech Talk Notes

** Notes and Plans for Tech Talks and AP Exam Here **
Go to tutorial for any help and also make sure to ask scrum team and other coders as well
Take good notes to make sure to understand topics
Make sure to rewatch any AP videos for practice or to re-learn different topics
Look back at AP CSA Notes for more practice

AP Computer Science Notes: Notes

__________________________________________________________

Table of Contents

TT0 TT1 TT2 TT3 TT4 TT5 TT6 TT7 TT8 TT9 TT10

__________________________________________________________

TT0

Imperative vs. Object Oriented Paradigms

Imperative Paradigms are more step-by-step than Object Oriented Paradigms. OOP relies on classes and objects, although the methods have Imperative Paradigms.

Java Arrays

public static Animal[] animalData() {
	return new Animal[]{
	        new Animal("Lion", 8, "Gold"),
	        new Animal("Pig", 3, "Pink"),
		new Animal("Robin", 7, "Red"),
		new Animal("Cat", 10, "Black"),
		new Animal("Kitty", 1, "Calico"),
		new Animal("Dog", 14, "Brown")
	};
}

Java Dictionaries

private final Map<String, Integer> OPERATORS = new HashMap<>();
    {
        // Map<"token", precedence>
        OPERATORS.put("*", 3);
        OPERATORS.put("/", 3);
        OPERATORS.put("%", 3);
        OPERATORS.put("+", 4);
        OPERATORS.put("-", 4);
    }

__________________________________________________________

TT1

Linked Lists

__________________________________________________________

TT2

Calculator Theory

__________________________________________________________

TT3

Selection Sort

As it progresses from index [0] to [n-1], selection sort is a linear sort algorithm. In an inner loop, it runs a second linear loop that compares two items (as shown in the diagram below) and records which is the smallest, then swaps the smallest number to the lowest in the round after cycling to the finish. image

Insertion Sort

Another linear technique is insertion sort, which sorts elements from index [0] to index [n-1]. This algorithm’s inner loop finds the gap, or insertion point, for the next item and inserts it. The list is partially sorted according to the index of the outer loops after each inner loop. image

Merge Sort

Rather than using a linear insertion or selection sort technique, this algorithm employs a divide and conquer strategy. It may appear complicated at first glance, but it is actually rather simple. It recursively separates the array into two groups until there are only two to compare, swapping if required. Then it pops out of the recursion; notice the cascading and then the inverted assembly in the figure; following that, it uses a sorted comparison to put each separated group back together.

image

__________________________________________________________

TT4

__________________________________________________________

TT5

__________________________________________________________

TT6

__________________________________________________________

TT7

__________________________________________________________

TT8

__________________________________________________________

TT9

__________________________________________________________

TT10