Problem-Solving Strategies and Metacognition in CSE Lesson 8

cse 121 lesson 8 n.w
1 / 11
Embed
Share

Explore common problem-solving strategies like analogy, brainstorming, debugging, iterative development, and metacognition in Computer Science and Engineering Lesson 8. Enhance your coding skills by understanding how to think about problem-solving processes and optimize your approach. Delve into the importance of metacognition in thinking about your coding solutions and study methods.

  • Problem Solving
  • Metacognition
  • CSE Lesson
  • Coding Skills
  • Computer Science

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. CSE 121 Lesson 8 Miya Natsuhara Spring 2023 Music: 121 23sp Lecture Vibes TAs: Jasmine Shananda Vidhi Larry Jacqueline Afifah Atharva Julia Anju Lydia Jonus Hugh Mia Archit Grace Kailye Joshua James Justin Aishah Claire Lydia Kai sli.do #cse121

  2. Announcements, Reminders Programming Assignment 1 is due tonight, Wed April 26 Creative Project 2 will be released later today Retakes First round yesterday went smoothly! Quiz 0 also eligible for retake on 5/2 and 5/9 Quiz 1 scheduled for Thursday next week, May 2 Wednesday May 3: Mid-term Formative Feedback Lesson 8 - Spring 2023 2

  3. Common Problem-Solving Strategies Analogy Is this similar to another problem you've seen? Brainstorming Consider steps to solve problem before jumping into code Try to do an example "by hand" outline steps Solve sub-problems Is there a smaller part of the problem to solve? Debugging Does your solution behave correctly? What is it doing? What do you expect it to do? What area of your code controls that part of the output? Iterative Development Can we start by solving a different problem that is easier? Lesson 8 - Spring 2023 3

  4. Metacognition Metacognition: thinking about how you think Asking questions about your solution process Examples While debugging: explain to yourself why you're making this change to your program Before running your program: make an explicit prediction of what you expect to see When coding: be aware of when you're not making progress, so you can take a break or try a different strategy When studying: What is the relationship of this topic to other ideas in the course? Lesson 8 - Spring 2023 4

  5. (PCM) Returns Returns allow us to send values out of a method public static <type> myMethod(int num) { System.out.print(num + " is the best!"); ... return <value of correct type> } Evaluates the expression Returns this value to where the method is called from Method immediately exits Calling a method that returns a value <type> result = myMethod(42); Lesson 8 - Spring 2023 5

  6. (Recall) String Methods Usage: <string variable>.<method>( ) Method Description Returns the length of the string. length() Returns the character at index i of the string charAt(i) Returns the index of the first occurrence of s in the string; returns - 1 if s doesn't appear in the string indexOf(s) Returns the characters in this string from i (inclusive) to j (exclusive); if j is omitted, goes until the end of the string substring(i, j) or substring(i) Returns whether or not the string contains s contains(s) Returns whether or not the string is equal to s (case-sensitive) equals(s) Returns whether or not the string is equal to s ignoring case equalsIgnoreCase(s) Returns an uppercase version of the string toUpperCase() Returns a lowercase version of the string toLowerCase() Lesson 3 - Winter 2023 6

  7. String example String s = "gumball"; s = s.substring(7, 8).toUpperCase() + s.substring(8) + "ball"; Lesson 8 - Spring 2023 7

  8. Example of returns: Math class Methods Returns Absolute value of value Math.abs(value) value rounded up Math.ceil(value) value rounded down Math.floor(value) Larger of the two given values Math.max(value1, value2) Smaller of the two given values Math.min(value1, value2) value rounded to the nearest whole number Math.round(value) Square root of value Math.sqrt(value) base to the exp power Math.pow(base, exp) Lesson 8 - Spring 2023 8

  9. Math example double value = 823.577564893; double roundedValue = (double) Math.round(value * 100) / 100; Lesson 8 - Spring 2023 9

  10. Poll in with your answer! What is the correct implementation of a maxDatingAge method? A. B. D. C. Lesson 8 - Spring 2023 10

  11. Poll in with your answer! What is the output of this program? A. 0 B. 4 C. 5 D. -1 Lesson 8 - Spring 2023 11

Related


More Related Content