Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

andantemoss/ALevel_Computing_Material

Repository files navigation

Pancakes - Food for Computing Revision

Algorithms

  • binary search
  • linear search

time

Sorting Type Best Worse Stable?
bubble sort O(n) O(n^2) Yes
insertion sort O(n) O(n^2) Yes
merge sort O(n log(n)) O(n log(n)) Yes
quick sort O(n log(n)) O (n^2) No, but possible stability modifications
that are array-based use extra O(n) time
  • linkedlist
  • queue with array implementation
  • queue with linkedlist implementation
  • stack with array implementation
  • stack with linked list implementation
  • BST (array/linkedlist)
  • Inheritance and encapsulation

Web Apps (Flask)

Socket Programming

Client and socket

socket.send can send less bytes than requested

socket.sendall sends the entire data or throws an error

#server code
import socket

server_socket = socket.bind(('127.0.0.1',12345))
server_socket.listen()
conn, addr = server_socket.accept()

while some_condition:
    #receive input from client
    msg = conn.recv(1024).decode()
    
    #sendall sends every byte or throws an exception
    conn.sendall(b' Some stuff ')
    conn.sendall(Somestuff.encode()) #alternative encoding
    
conn.close()
server_socket.close()
#client code
import socket

client_socket = socket.connect(('127.0.0.1',12345))
client_socket.sendall(b' Some stuff ')
msg = client_socket.recv(1024)
client_socket.close()

Misc Data Conversion

Python Dates

import datetime
x = datetime.datetime(2018, 6, 1) #convert to datetime object

#format time into certain string
print(x.strftime("%a"), x.strftime("%B")) 

%a --> Wed

%A --> Wednesday

%b --> Dec

%B --> December

%y --> [Year] 18

%Y --> 2018

%x --> 12/31/18

%X --> 17:41:00

About

Revision for A'Level Computing Syllabus 2020 (9569)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors