M7L1A2: Amelia Faison and Luke Eubank

Storyboard: In this lab, we will use a block called “position of number in unsorted list” in order to report the earliest location of a number in an unsorted list. In the second lab, the blocks we make will generate all 2 digit, 3 digit 100 – 999 or 4 digit 1000 – 9999, etc. We will then decide if the algorithm takes a reasonable or unreasonable time to function. If an algorithm is unreasonable, we will add 1 to the input size.

Logic: In this Snap! lab, we created blocks that returned the position of a number in a list sorted from lowest to highest or zero when the number was not in the list. We did this by creating several blocks and variables that each worked together in order to search through the list by each item until the input was equal to an item in the list.

Steps:

1.) We created a list of random numbers to include in our program.

2.) We built a position of number in sorted list block that returns the position of a number in a list sorted from lowest to highest or zero if the number is not in the list.

3.) We used the set block and the change block in order to alter the counter variable to change and correctly reflect the position of the item in the list.

4.) We implicated several true or false operators in order to detect whether the variable matched any item in the list

5.) We added two say blocks that used join operators to say either it was found in the list or was not found and then the variable of the counter which reflects the position in the list.

6.) For the second lab, we downloaded the lists and the blocks that Snap offered us

7.) In the ‘list from through’ block, we included a report block that resulted in the report of all numbers in the list after the number inserted

8.) In the ‘all 2 digits numbers’ we struggled as the list was equivalent to the list acquired above.

9.) For the ‘make your own block’, we decided to make a block that would report only odd numbers within the list

10.) We did this by using mathematical operators to decide whether a number would be odd or not

Problems:

Once we had formed our function, the sprite would report that the number was not found in the list even if it was in the list. Only our last value worked and made the computer report the position of the number in the list. Also, we experienced issues when the variables in our original block were not allowing number inputs. In the second lab, we struggled with the program which reported all numbers with a certain number of digits because the last number reported was one digit larger than the number inputted. When we were creating our own block to sort through the list, we had the problem of the reporter not reporting any list of numbers.

Link: https://snap.berkeley.edu/snapsource/snap.html#present:Username=luke_eubank_apcsp&ProjectName=Search%20Algorithms

 

https://snap.berkeley.edu/snapsource/snap.html#present:Username=luke_eubank_apcsp&ProjectName=M7L3-listfrom

 

 

Leave a comment