Set 8 Flashcards
Checked by Tim. (44 cards)
Why is space complexity important to consider when analysing binary tree search?
Because the algorithm is recursive, it places a demand on the call stack
What is the Merge sort algorithm’s complexity
O(n log n)
Give two reasons why smaller time complexity is better
- A quicker program could solve more of the same problem or run more programs in the same time period
- Computers consume electricity to run so a program taking less time to run will cost less money
Give two reasons why a smaller space complexity is better
- A program that uses less memory could be run on cheaper hardware (as less RAM is needed)
- Or a greater number of different algorithms can run on the same hardware simultaneously
What is the purpose of Dijkstras algorithm?
Can the graph be directed/weighted?
- Calculates the shortest path between a node and all other nodes in a graph
- Graph may be directed or undirected
- Graph must be weighted
What approach does merge sort take to sort a list?
Divide and conquer
What is bubble sort’s time complexity? Why?
O(n^2). Since it involves a for loop within a for loop. You need to do n passes of the list/array, and each pass involves up to n comparisons.
Hierarchy of complexities (polynomial, logarithmic, constant, exponential, linear)
constant < logarithmic < linear < polynomial < exponential
What is a first class object?
First class objects are objects which may:
- R - be returned in function calls
- A - be assigned as arguments
- V - be assigned to a variable
- E - appear in expressions
Functions are first-class objects in functional programming languages
What does function application mean?
Applying a function to its arguments
What does partial function application mean?
Partial function application means only applying a function to some of its arguments. The result is a function.
What is a URL?
- A Uniform Resource Locator (URL) is the address of a webpage or other internet resource
- It indicates the location of a resource as well as the protocol used to access it.
What is a domain name server?
A server that contains databases which map FQDNs to their corresponding IP addresses.
‘www.w3schools.com’ is an example of a…
Fully qualified domain name
‘www’ is an example of a…
Host name or subdomain
‘w3schools.com’ is an example of a…
Domain name
‘/cs/cs_operators.asp’ is an example of a…
Path
Describe how domain names are organised
- Hierarchical organisation
- Top level domains are com/org/uk etc
- Second level domains are ac/co etc
- Domains can have subdomains created for them
What is the purpose of a domain name?
- A domain name identifies an organisation or individual on the internet.
- They use alphanumeric characters which make them easier for humans to remember than IP addresses
What is the purpose of a domain name server?
To translate a fully qualified domain name into its corresponding IP address
What is the domain name system?
- The domain name system is a distributed database of mappings from FQDNs to their corresponding IP addresses
- DNS servers are organised into a hierarchy
What happens if a domain name server cannot resolve a lookup?
The query will be passed to another DNS server
Who manages top level domains?
- An (internet) registry
- Each TLD may have restrictions as to who can use it
What are the main responsibilities of an internet registry?
To maintain a definitive register of who owns a specific domain.
To enter domain names to IP address mappings into the DNS system
The ensure domain names are unique, and only used by one organisation