Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CodePath SE102 - Week 1b

Caren
June 06, 2020

CodePath SE102 - Week 1b

Caren

June 06, 2020
Tweet

More Decks by Caren

Other Decks in Education

Transcript

  1. Prepend your name with your group number!

    Example: 24 - Caren
    Check our Slack channel for detailed instructions including
    your group number
    Also add a profile picture for Slack if you haven’t already

    View Slide

  2. Intermediate Software Engineering
    Week 1

    View Slide

  3. Common interview mistakes:
    • not communicating with interviewer
    • doesn’t catch or can’t fix bugs
    • speed - interviewer wasn’t able to get a good
    signal


    View Slide

  4. U
    M
    P
    I
    R
    E

    View Slide

  5. Understand
    Match
    Plan
    Implement
    Review
    Evaluate

    View Slide

  6. Understand - Clarify what the interviewer is asking for
    Match
    Plan
    Implement
    Review
    Evaluate

    View Slide

  7. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan
    Implement
    Review
    Evaluate

    View Slide

  8. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan - Come up with algorithm, proof it works
    Implement
    Review
    Evaluate

    View Slide

  9. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan - Come up with algorithm, proof it works
    Implement - Code
    Review
    Evaluate

    View Slide

  10. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan - Come up with algorithm, proof it works
    Implement - Code
    Review - Test solution works as expected
    Evaluate

    View Slide

  11. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan - Come up with algorithm, proof it works
    Implement - Code
    Review - Test solution works as expected
    Evaluate - Analyze run time and space complexity

    View Slide

  12. Understand - Clarify what the interviewer is asking for
    Match - Identify similar patterns
    Plan - Come up with algorithm, proof it works
    Implement - Code
    Review - Test solution works as expected
    Evaluate - Analyze run time and space complexity

    View Slide

  13. In Class Exercise - UMPIRE Warmup

    View Slide

  14. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}

    View Slide

  15. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 



    View Slide

  16. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?


    View Slide

  17. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return …? 


    View Slide

  18. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}


    View Slide

  19. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}

    - Given {1, 2, 3} ; Return …? 


    View Slide

  20. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}

    - Given {1, 2, 3} ; Return {1, 2, 3}


    View Slide

  21. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}

    - Given {1, 2, 3} ; Return {1, 2, 3}

    - Given {15, 6, 10, 5, 12, 6} ; Return … ? 


    View Slide

  22. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}

    - Given {1, 2, 3} ; Return {1, 2, 3}

    - Given {15, 6, 10, 5, 12, 6} ; Return {15, 6, 10, 5, 12}


    View Slide

  23. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Understand: 

    - is the input always sorted for us?

    - are inputs always only integers?
    - Given {1, 1, 1} ; Return {1}

    - Given {1, 2, 3} ; Return {1, 2, 3}

    - Given {15, 6, 10, 5, 12, 6} ; Return {15, 6, 10, 5, 12}
    Follow up question: does it matter what order our return list is?


    View Slide

  24. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Match: 




    View Slide

  25. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Match: 

    - are there any common patterns we can apply here?




    View Slide

  26. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Match: 

    - are there any common patterns we can apply here?

    - coming in future sessions..

    - hash table

    - sort input first?



    View Slide

  27. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Plan



    View Slide

  28. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Plan: 

    - possible solutions:

    (1) iterate through array, put values in hash table, if value already
    exists, don't add to numsToReturn




    View Slide

  29. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Plan: 

    - possible solutions:

    (1) iterate through array, put values in hash table, if value already
    exists, don't add to numsToReturn

    (2) sort array, add integer to numsToReturn if previous integer is not
    the same



    View Slide

  30. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Implement:
    code up solution in repl.it ! 



    View Slide

  31. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Review:
    run one or two inputs through our solution



    View Slide

  32. Return distinct values from a list including duplicates
    Given {1, 2, 6, 6, 6, 10, 14, 14} ; Return -> {1, 2, 6, 10, 14}
    Evaluate:
    what’s the space / run time complexity of our solution?
    what tradeoffs did we have to make?

    View Slide

  33. In Class Exercise - UMPIRE Warmup

    View Slide

  34. In Class Exercise - UMPIRE Warmup
    Work in groups to get more comfortable with UMPIRE

    View Slide

  35. In Class Exercise - UMPIRE Warmup
    Work in groups to get more comfortable with UMPIRE
    Review UMPIRE together, make sure everybody has a good
    understanding of what should be done at each step

    View Slide

  36. In Class Exercise - UMPIRE Warmup
    Work in groups to get more comfortable with UMPIRE
    Review UMPIRE together, make sure everybody has a good
    understanding of what should be done at each step
    Review a sample problem solved with the UMPIRE method

    View Slide

  37. In Class Exercise - UMPIRE Warmup
    Work in groups to get more comfortable with UMPIRE
    Review UMPIRE together, make sure everybody has a good
    understanding of what should be done at each step
    Review a sample problem solved with the UMPIRE method
    Create a shared document in repl.it to solve the problem together
    with the UMPIRE steps. Round robin status!


    View Slide

  38. In Class Exercise - UMPIRE Warmup
    Work in groups to get more comfortable with UMPIRE
    Review UMPIRE together, make sure everybody has a good
    understanding of what should be done at each step
    Review a sample problem solved with the UMPIRE method
    Create a shared document in repl.it to solve the problem together
    with the UMPIRE steps. Round robin status!


    After 45 minutes, we’ll regroup and review the problem

    View Slide

  39. Questions?
    Did you add your group number to
    your name?? (Example: 24 - Caren )

    View Slide

  40. How’d it go?

    View Slide

  41. Before Monday midnight..

    View Slide

  42. Before Monday midnight..
    Review UMPIRE 

    guide linked in course portal

    lecture slides also linked in course portal

    View Slide

  43. Before Monday midnight..
    Review UMPIRE 

    guide linked in course portal

    lecture slides also linked in course portal
    Review solutions to our in class exercises

    View Slide

  44. Before Monday midnight..
    Review UMPIRE 

    guide linked in course portal

    lecture slides also linked in course portal
    Review solutions to our in class exercises
    Work on optional practice problems provided in course portal

    View Slide

  45. Before Monday midnight..
    Review UMPIRE 

    guide linked in course portal

    lecture slides also linked in course portal
    Review solutions to our in class exercises
    Work on optional practice problems provided in course portal
    Complete HackerRank assessment!

    View Slide

  46. HackerRank
    Don’t stress out about it too much!
    Prep by doing optional practice problems
    Things you need to know for this week:

    UMPIRE

    Code tracing


    View Slide

  47. Next week
    Big O


    Hash Tables
    Panel!

    View Slide