top of page

Forum Posts

cloudiiiday
Nov 03, 2022
In ACSL Contest Prep
In this week's class, you learned about prefix, infix, and postfix notation. In infix notation (what we normally use), the operation is between the operands (Ex: 1+1) In prefix notation, the operation is before the operands (1+1 would become + 1 1) In postfix notation, the operation is after the operands (1+1 would become 1 1 +) Homework:
11/2/22 Prefix, Infix, Postfix content media
0
1
16
cloudiiiday
Oct 15, 2022
In ACSL Contest Prep
For this week, we continued WDTPD and completed problems involving looping, arrays, and strings. Remember to review for the practice test next week which will include the following topics: - Computer number systems > Convert, add, subtract, multiply, and divide binary, octal, and hexadecimal numbers - Recursive functions > Know how to work forwards then backwards - What does this problem do? > Strings, arrays, branching, looping
0
0
8
cloudiiiday
Aug 02, 2022
In ACSL Contest Prep
Homework What does the program output in terms of q? Class Notes Assembly Language Programming is code that tells the computer directly what to do It is written in simple terms Code → Assembly Language → Machine Language Saves time when running programs ACSL has their own version of Assembly Language Program Simpler to read, conceptual understanding, basic unanimous topics amongst code Code is executed starting from the first time and moves down sequentially (branch instructions are an exception) END instruction terminates the program Accumulator (ACC) stores all data from operations/functions starting at 0 Format
8/1/22 Assembly Language Programming content media
0
1
6
cloudiiiday
Aug 01, 2022
In ACSL Contest Prep
Class Notes A Graph is a diagram of relationships between properties with variables representing different values It can be used to represent patterns/data Examples of graphs: Trees Line plots Axis Circle graph Vertices: dots on graphs Edges: direct connection between 2 nodes Paths are lists of vertices, starting from vertex x → vertex y Simple paths do not have duplicate vertices Connected graphs have a possible path for any 2 vertices Cycle is a path but the 1st and last vertices are the same A tree is a graph that does not have any possible cycles Directed paths do specify direction while undirected paths lack direction Adjacency matrices: A matrix is similar to a table It can be used to represent edges from points The rows and columns are sorted in alphabetical order Here’s a video on multiplying adjacency matrices: https://www.youtube.com/watch?v=3c2rzaO1h28&t=92s
0
0
13
cloudiiiday
Jul 19, 2022
In ACSL Contest Prep
Homework: Class Notes: FSA = Finite State Automaton Unique model of mathematics Uses shapes and lines to create a diagram 4 main conceptual points: 1 initial state finite # of states transitions will change the active state at least one final state If final state is reached, then the FSA accepts the data Diagram of FSA Circles → states of the FSA Initial state → arrow facing towards it vertically Final state → double circle Transitions → lines between the circles Rules of Regular Expressions An empty/null string is considered a regular expression If ‘a’ is within the given input, then it is considered a regular expression If ‘a’ and ‘b’ are both regular expressions: Concatenation: ab Union a|b Closure: a* Parentheses can be used to create sub groups Order of operations: * > Concatenation > Union
7/18/22 FSA's and Regular Expressions content media
0
1
10
cloudiiiday
Jul 03, 2022
In ACSL Contest Prep
Homework Class Notes LISP = LISt Processing language It is a simple but powerful coding language used for applications that need a powerful computing system User-defined functions We can create our own functions in LISP using DEF or DEFUN (DEF [function name] (args) (function statement))
6/27/22 LISP content media
0
0
7
cloudiiiday
Jun 21, 2022
In ACSL Contest Prep
Today, we went over infix, prefix, postfix notation, and how to convert them. Homework Class Notes Regular math equations include operations and operands operands are numbers and variables operations are the actions performed on operands +, -, *, / Infix notation is what we normally use to do math the operation is written between the operands order of operations (PEMDAS): parenthesis, exponents, multiplication, division, addition, subtraction Prefix notation and postfix notation are better for computers In prefix notation, the operation is written before the operands ex: 2+2 would be +2 2 In postfix notation, the operation is written after the operands ex: 2+2 would be 2 2+ Why use prefix and postfix notation? With prefix and postfix, order of operation does not matter and you’ll get the same result no matter what This is much easier for computers to work with To convert from infix to prefix/postfix: Follow the order of operations and fully parenthesize the expression Convert the sections into prefix/postfix based on the order you would evaluate them
6/20 Prefix/Infix/Postfix notation content media
0
0
19
cloudiiiday
Jun 15, 2022
In ACSL Contest Prep
Homework: Class Notes: Pseudocode: Pseudocode is an easier way to show code through writing (not real code). It is understandable no matter what language you use to code. ACSL pseudocode use operators, functions, sequential statements, decision statements, indefinite lop statements, definite loop statements, arrays, and strings. WDTPD: You can solve these problems using a data table when there is a repeating process or multiple variables that are difficult to track
6/13 What Does This Program Do? content media
0
1
17
cloudiiiday
Jun 15, 2022
In ACSL Contest Prep
In today’s class, we went over computer number systems, basic operations, and converting between different bases. Homework: Class Notes: Computer Number Systems: The decimal system (base 10) is the number system we commonly use. It uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The binary system (base 2) is commonly used by computers. It uses the digits 0 and 1 Octal System (base 8) uses the digits 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal System (base 16) uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. (Since there is not enough digits, A refers to decimal 10, B refers to decimal 11, etc.) Operations: When adding or subtracting decimal numbers, you would carry/borrow 10. This means you would carry/borrow 2 for binary, 8 for octal, 16 for hexadecimal Binary multiplication: Binary Multiplication - Exploring Binary Binary division: Binary Division - Exploring Binary Converting Between Different Bases: Converting a number to base 10 from another base: Expand the number by place values and compute the value in decimal Ex: 345 (base 8) (38^2)+(48^1)+(5*8^0) = 229 (base 10) Converting a number from base 10 to another base: Write out the powers of the other base starting from the power of 0 to the highest power that does not exceed the given number Divide the given number by the highest power and the quotient will be the leftmost digit of the final answer Keep repeating the steps using the remainder of the division and add on the quotients to the right of your final answer
6/6 Computer Number Systems content media
0
1
13
cloudiiiday
Feb 17, 2022
In Introduction to Java
Today, we learned about functions/methods. When you have a long program, it can help to break it down into smaller groups of functionality. A function/method groups a sequence of statements and provides a well defined, easy to understand functionality which can be reused. A method takes input, performs an action or a series of actions, and produces an output. In Java, each method is defined within a class. An example of a standard method is System.out.println(). To define your own method, you must declare it with a header. class MyClass { static int methodName (int parameter1, int parameter2){ //This is the header //The method body goes here } } You close the body of a method with a return statement. The return type of a method indicates the type of value that the method sends back to the calling location. A method that does not return a value has a void return type in the heading. The return statement specifies the value that will be returned. At a given point, the variables that a statement can access are determined by the scoping rule. The scope of a variable is the section of a program in which the variable can be accessed (also called visible or in scope). There are 2 types of scopes in Java, class scope - a variable defined in a class but not in any method, and block scope (also called a local variable) - a variable defined in a block of a method. Method overloading is when a class defines multiple methods with the same name. It is usually used to perform the same task on different data types. However, the complier must be able to determine which version of the method is being invoked. This is done by analyzing the parameters, which form the signature of a method which includes the type and order of the parameters. In object oriented design, methods are grouped together according to objects on which they operate. An object has state, or descriptive characteristics, and behaviors, what it can do (or be done to it). A class contains data declarations and method declarations. Homework: https://docs.google.com/forms/d/e/1FAIpQLScni2F2ENq4glTeg7PGb-ZFSqRyp5lA-Ajz-6raeK18Dkyotg/viewform?usp=sf_link
0
0
6
cloudiiiday
Feb 03, 2022
In Introduction to Java
A 2D array is an array of arrays, It can be thought of as having rows and columns such as a matrix with both row and column starting from 0. To declare a 2D array, you need 2 sets of brackets and 2 size declarators. double[][] heights = new double[4][300]; //This 2D array would contain 4 rows and 300 columns. To initialize a 2D array using a list of values, you need to enclose each row's initialization list in its own set of braces. int[][] numbers = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; Nested loops are used in programs involving 2D arrays. The outer loop is used to traverse through rows while the inner loop is used to traverse through columns. double[][] heights = new double[4][300]; Scanner in = new Scanner(new FileReader("inputData.txt")); for (int row = 0; row < 4; row++){ for (int col = 0; col < 300; col++){ heights[row][col] = in.nextDouble(); } } Because 2D arrays are arrays of 1D arrays, the length of a 2D array is the number of rows. Because each row is a 1D array, the length of each row tells how many columns there are. Each row can also have a different number of columns which is called a ragged array.
0
2
11
cloudiiiday
Jan 06, 2022
In Introduction to Java
Homework: https://docs.google.com/forms/d/e/1FAIpQLScH8YbvVv1uYnJsa4XtecECADk0RZFmA4tWWxLQ67R_nrB9pw/viewform?usp=sf_link Do loop: do loop example: int count = 0; do { count++; System.out.println(count); } while (count <5); Nested loops: Similar to nested for statements, while loops and do loops can be nested as well "Nested" means the inner loop must complete reside in the outer loops - no overlapping For each iteration of the outer loop, the inner loop iterates completely How to hand trace a program for debugging: Your code will go wrong so debugging and testing are always needed You can debug (troubleshoot) by: Hand tracing Adding print statements to your code Adding testing methods to the class Hand tracing (tracing by hand) is a simulation of code execution in which you step through statements and tack the values of certain variables. It is effective with a short program or part of a method. When you hand trace code or pseudocode, you write the names of the variables on a sheet of paper, mentally execute each step of the code, and update the variable values accordingly. When you use print statements for debugging, you insert print statements at key locations to show values of significant variables and how far your code got before there was a problem. In the print statement, it is a good idea to specify the location of the trace (what method) and the variable name and its value. All Integrated Development Environments (IDE) such as Eclipse have an interactive debugger feature. You can single-step step through your code (one statement at a time), see what is stored in variables, set breakpoints, and watch a variable or expression during execution. Phases of Programming A typical programming task can be divided into multiple phases Analyzing and solution design phase: Analyze the problem to understand data and constraints, produce an ordered sequence of steps that describe the solution of a problem This sequence of steps is called an algorithm Implementation phase: implement the program in some programming language Debugging and testing phase: test the program thoroughly, debug and resolve defects Steps in Solution design phase Produce a general algorithm You can use pseudocode (pseudocode is an artificial and informal language that helps programmers develop algorithms, it is very similar to everyday English) Refine the algorithm successively to get a step by step detailed algorithm that is very close to a computer language Turn pseudocode into flowchart to verify the designed solution works correctly in all cases Flowchart A schematic representation of the algorithm or problem-solving process A graphical representation of the sequence of operations in a program (it can have different levels of granularity) Shows logic of an algorithm Emphasizes individual steps and their interconnections Different symbols are used to draw each type of flowchart
0
1
6
cloudiiiday
Dec 09, 2021
In Introduction to Java
In today's class, we learned about for loops. Iteration Statements: Allows us to execute a statement multiple times Often referred to as loops Like conditional statements (if-else statements), they are controlled by boolean expressions Java has 3 kinds of repetition statements for loop while loop do loop Programmers should choose the right kind for the situation The for statement for(initialization; condition; increment){ statement; } The initiation is executed once before the loop begins The statement is executed until the condition becomes false The increment portion is executed at the end of each iteration Best for executing statements a specific number of times that can be determined in advance Example: for(int count = 1; count <= 5; count++){ System.out.println(count); } Homework: https://docs.google.com/forms/d/e/1FAIpQLScHJ_8ym3qeoHIhRtyHRN35yJIJIxKJ3uEkgS6ThiEmD8GahA/viewform?usp=sf_link
0
1
13
cloudiiiday
Nov 18, 2021
In Introduction to Java
Often we have to compare different expressions or variables. Boolean variables only have 2 values, true and false or 1 and 0 (1 corresponds to true, 0 corresponds to false). Bitwise operations: AND, * (logic product) 0 * 0 = 0 1 * 0 = 0 0 * 1 = 0 1 * 1 = 1 OR, + (logic sum) 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 1 + 1 = 1 NOT, ! (logic negation) !0 = 1 !1 = 0 XOR, ⊕ or ^ 0 ^ 0 = 0 1 ^ 0 = 1 0 ^ 1 = 1 1 ^ 1 = 0 XNOR, ⊙ (opposite of ⊕) 0 ⊙ 0 = 1 1 ⊙ 0 = 0 0 ⊙ 1 = 0 1 ⊙ 1 = 1 Order of Precedence: () > ! > * > ⊕ = ⊙ > + Boolean Expressions: == equal to != not equal to < less than > greater than <= less than or equal to >= greater than or equal to Logical Operators: ! Logical NOT && Logical AND a&&b is true only if both a and b are true || Logical OR a||b is true if a or b or both are true Comparison: char types are compared by ACSII values Strings are compared by ACSII values of each character from left to right When paring two double or float values, we often compare the difference with a small enough value because of round off errors A boolean variable x == true is the same as x Selected Operators and their Precedence: [] Array element access ++, --, ! Increment, decrement, Boolean not *, /, % Multiplication, division, remainder +, - Addition, subtraction <, <=, >, >= Comparisons ==, != Equal, not equal && Boolean and || Boolean or = Assignment
0
2
7
cloudiiiday
Nov 04, 2021
In Introduction to Java
Today in class, we started off by talking about the difference between strings and characters. Characters just store one character at a time but strings are made up of multiple characters. Each character has an integer it corresponds to. You can see which character corresponds to what integer here: https://www.asciitable.com/ Concatenation means combining different things into one string. The operation we use for this is a plus sign (+). For example, String a = "Hello"; char b = 'a'; int c = 1; System.out.println(a + b + c); would print out "Helloa1". We also learned about other string operations. String length and index: length() A character of a string: charAt(): Substrings: substring() Search for a substring: indexOf(), lastIndexOf(), contains() Comparing strings: compareTo() For example, String a = "Hello World"; System.out.println(a.length()); //This will print out "11" System.out.println(a.charAt(2)); //This will print out "l" System.out.println(a.substring(1, 4); //This will print out "ell" System.out.println(a.indexOf("Hello")); //This will print out "0" System.out.println(a.lastIndexOf("l")); //This will print out "9" System.out.println(a.contains("World")): //This will print out "true" Here are some methods to compare strings: boolean equals() boolean equalsIgnoreCase() int compareTo() int compareToIgnoreCase() trim() toUpperCase() toLowerCase() Here's the homework for this week: https://docs.google.com/forms/d/e/1FAIpQLSf6_GW5MSvlQv6rjZsBrOsT2P7xHRcDE_V6Z69J7jWWqmEYiw/viewform?usp=sf_link
0
1
7
cloudiiiday
Oct 14, 2021
In Introduction to Java
Today in class, we started by learning how to get user input: First, we need to import java.util.Scanner; Then, we name the Scanner: Scanner in = new Scanner(System.in); System.out.println(in.next()); This will print the next string you input. Ex: If you input "Hello World", only "Hello" will be printed. System.out.println(in.nextLine()); This will print the next line you input. Ex: If you input "Hello World", it would print out "Hello World". You can also do in.nextInt(), in.nextDouble(), etc. We can also learned how to get input from a data file: A data file is a plain text file (a common suffix is .txt or .data). These files don't have any font or size formatting information. Data files often have multiple data columns, separated by commas, white spaces, or other characters. These separators are called "delimiters". Reading data files: import java.util.*; import java.io.*; class Main{ public static void main(String[] args) throws Exception { File theInput = new File("input.txt"); BufferedReader br = new BufferedReader(new FileReader(theInput)); String a = br.readLine(); //this will read the first line in input.txt System.out.println(a); } } Homework for this week: https://docs.google.com/forms/d/e/1FAIpQLSe1hdcr7ZYGrf7N7bEJD17EXkpqo5ckWecXsY-QhmDl1CcIPQ/viewform?usp=sf_link
0
0
11
cloudiiiday
Sep 30, 2021
In Introduction to Java
Here is a recap of what we learned in class today: -Literals and data types Literals are numeric values that are used to compute. Arithmetic equations include variables, literals, and operators. If you mix different types of data, all "lower" types will be automatically promoted to the "higher" type in the operations. For example, if you divide an integer by a double, the result would be a double. -Casting If you want to specify the types of a variable or expression, you can use explicit type casting. For example, (double)1729/10 = 172.0, but ((double)1729)/10 = 172.9. -Assignment In coding, the equal sign "=" has a different meaning. Instead of meaning "equals", it means assigning the right side of the equation to the left or "assignment." For example, x=x+1 would mean adding 1 to x then assigning the value back to x. There are also shortcut operators for this purpose like "++" and "--."
2
2
18

cloudiiiday

More actions
bottom of page