Daily note for IB Year 2 Standard Level Computer Science

Block 1, Room C152


Wednesday 25 November 2020

 

Daily Note

The plan for our class:

We will have a guest speaker on 1 December, an ASW alumn who is now a professional sofware engineer. Please think of questions. 

We are going to walk through each of these standards and using pseudocode, construct examples. 

  1. We are going to write four classic algorithms: 
    1. Sequential search
    2. Binary search
    3. Bubble sort
    4. Selection sort

# This program is used to generate ordered and unordered lists.
# The lists are then used for computer science students to 
# apply their understanding of standard searches and sorts. 


# the line below imports the random library, which enables us to use lots of functions with random.
import random
# the line below imports the time library, which enables us to use lots of functions with time
import time

# we need to time our program, so we are going to set the start time
start_time = time.time()

myList = []
numberToFind = 700

def unorderedList():
    # this function creates an unordered list
    for i in range(0,25):
        # the line line below simply appends a random number into our list
        myList.append(random.randrange(1,90000))
    return myList


def orderedList():
    # this function creates an ordered list
    for i in range(0,25):
        myList.append(i)
    return myList


# this is where we call the functions to make our lists
# uncomment out whichever list you want to make

unorderedList()
# orderedList()

# =========================================================
# Your different sorting algorithms will go under this line
# =========================================================


def linearSearch(list,target):

    # your code here

    return position_of_target


def bubbleSort(list):

    # your code here

    return sorted_list

 

def sequential_search(list, target):

    # your code here

    return position_of_target

def binarySearch(list,target):

    # your code here
    
    return position_of_target


 

 


# =========================================================
# Your different sorting algorithms will go above this line
# =========================================================


# =========================================================
# The lines below call a function. For sorting, we like to 
# print the unsorted list and sorted list
# =========================================================

print(myList)
print("")
print(bubbleSort(myList))


# the lines below are used only for debugging. 
# print(myList)    
# The line below should print true if our target exists in our list.     
# print(numberToFind in myList)


print("--- %s seconds ---" % (time.time() - start_time))


#
# references
#
# I am grateful to stackoverflow for this code for timing a python program: 
# https://stackoverflow.com/questions/1557571/how-do-i-get-time-of-a-python-programs-execution

Your homework for today: 

  1. All homework is on Google classroom

 

A little less comfortable

 

A little more comfortable

 

Our Big idea

The big idea for today is Abstract data structures.

The essential questions for this topic are:

Why do programmers organize data in specific ways? What advantages does one way of organizing data have over a different way of organizing data?

It takes time to explore and really understand a big idea. If you want to
learn more about abstract data structures (which is connected to today's daily note), please click here.



 

Links

Zoom Link for our class: https://zoom.us/j/7430326991

Google classroom: here
Syllabus: Click here
All daily notes: Click here

Covid-testing link: Click here
High school bulletin: Click here
Current event activity: Click here




 

Tags

 

Reminders & routines:

IF today ==  testing_day_for_me:
     remember to go get tested!

IF today == first_period_of_day:
    read_daily_notes

IF today == Friday:
    current_event_protocol()

 

Please read and follow these reminders:

  1. Always start every class by reading our daily note

  2. Please check now: is visual studio code working from my programming folder?