Monday, February 27, 2017

Day 1 PT Project

Minutes spent: 24

Things done: Found an idea for a project, basic design and schematic, being to create the foundation of the code in code.org, ran the project by Ms.Stark, began Pseudo Code,

Thursday, February 16, 2017

Algorithms

>Give an explanation of each  statement below  and relate it to something they experienced as part of this lesson

4.2.4D Different correct algorithms for the same problem can have different efficiencies. Both linear search and binary search solve the same problem, but they have different efficiencies.
One program writes out every function iteration while another uses a for loop to run until it reaches the end of a sequence or set in an array. They both work but the loop makes the program run more efficiently.

4.2.4E Sometimes more efficient algorithms are more complex. Binary search is more efficient than linear search, but even though it might be easy to understand at a high level, it is much more challenging to write code for.
Having nested conditional statements in other conditionals or in loops can be confusing to follow logically however they make your code more efficient.

4.2.4F Finding an efficient algorithm for a problem can help solve larger instances of the problem. The algorithms we wrote work for any size input.
Writing a for loop or a while loop to find the lowest value card in a set of cards.

4.2.4G Efficiency includes both execution time and memory usage. Execution “time” here means number of operations that need to be performed in the worst case.
Having a program iterate a command every time and typing it out can take dozens of lines of code slowing down the processing time while a conditional or a loop can make the code simply a few lines cutting down the time by a lot.

4.2.4H Linear search can be used when searching for an item in any list; binary search can be used only when the list is sorted. Emphasis should be placed on the fact that binary search only works when the list is sorted. It’s a fact often forgotten.

A list of names is in alphabetical order therefore the code can be made more efficient by going directly to the place where the letter starts. This makes the code more complex and harder to write than linear code where it is most efficient to go through every item in the list.

Wednesday, February 8, 2017

Refactoring Code

Why might you want to change or refactor old code?
To make the code more readable, efficient, and simplistic.
Is it necessarily a bad thing to refactor code?
No
What steps can we take to avoid refactoring code too frequently?
Making functions at the beginning of the code and having global variables that can be reassigned.

Monday, February 6, 2017

Array vs Variable


  • All the messages a user has sent
    • Array
  • The highest score a user has ever reached on the app
    • Variable
  • A username and password to unlock the app
    • Array

In general, when do you think you should you store information in an array, and when should you use a variable?

When it's only one or two values that are not related directly you should use a variable. Otherwise arrays work well.

Friday, February 3, 2017

Coin flips

How long does it take for the number of heads and tails flipped to be equal to 10?
20 flips
Longest streak where each roll is greater than or equal to the last

Longest streak made of only five (any five) of the six faces on the die (i.e., not equal to the other)
8 rolls.

Wednesday, February 1, 2017

Color Sleuth

1. Did you develop a program with a purpose? if yes what?
Yes, the program is a fun game that could also be modified to be a game version or a fun way to test for color blindness.
2. Did you apply algorithms and integrate math or logical concepts? What did you use?
Yes, I used booleans, if statements, conditionals, functions, and random integers.
3.  Did you apply abstraction ( integrate complexity to manage  math or logical concepts) ? How
Yes, I created if statements that were complex and had a structure to follow. I nested conditionals in functions and I used that to simplify the calling back of a score tally or a button color switch.