IB Year 2 Standard Level Computer Science
Wednesday 25 November 2020 - Block 5
← previous note | most current note | next note →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.
- We are going to write four classic algorithms:
- Sequential search
- Binary search
- Bubble sort
- 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:
- All homework is on Google classroom
A little less comfortable
Process
You should be revising our content for 20 minutes each day. As you learning about abstract data structures you should be asking yourself how you can apply your understanding (how do I go from theoretical to practical). I would love to hear from you, "How can we use this information practically?".
Product
As you are learning you should be taking notes, and developing a cookbook or spellbook. Most system administrators have a book of hints and tips they keep with them. You should have a digital text file or written notebook with helpful reminders to understand the deeper parts of your system.
Content
At the end of the day, you should be able to apply your understanding of abstract data structures to issues to solve problems. You must understand the methods of an ADT and how an ADT uses memory.
A little more comfortable
Process
You should be revising our content for 20 minutes each day. As you learning about abstract data structures you should be asking yourself how you can apply your understanding (how do I go from theoretical to practical). I would love to hear from you, "How can we use this information practically?". It would be helpful if you implemented ADT in multiple programming languages. I would especially recommend trying to implement ADT in Rust or C.
Product
As you are learning you should be taking notes, and developing a cookbook or spellbook. Most system administrators have a book of hints and tips they keep with them. You should have a digital text file or written notebook with helpful reminders to understand the deeper parts of your system. You should know enough about ADT's to teach your classmates, and help them understand how ADT's function. In addition, you should learn a few ADT's that are not on our curriculum; specifically, binary search trees, sets, and graphs.
Content
At the end of the day, you should be able to apply your understanding of abstract data structures to issues to solve problems. You must understand the methods of an ADT and how an ADT uses memory. You should be able to look at a situation or problem and really understand which ADT would be appropriate and why.
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
.
We are learning this because as a designers must understand scientific and technical innovation. Designers use systems, models, methods, and processes to solve problems.
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:
-
Always start every class by reading our daily note
-
Please check now: is visual studio code working from my programming folder?
Our learning
This is a beta feature. Please let me know if you have any feedback.
Please click here to reflect on our learning for today's class.