SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

MockP2


🇬🇧
In English
Created:


Public
Created by:
Sozen


0 / 5  (0 ratings)



» To start learning, click login

1 / 25

[Front]


Quick sort doesn't use additional memory like merge sort does
[Back]


What are 4 examples of abstract data types?

Practice Known Questions

Stay up to date with your due questions

Complete 5 questions to enable practice

Exams

Exam: Test your skills

Test your skills in exam mode

Learn New Questions

Dynamic Modes

SmartIntelligent mix of all modes
CustomUse settings to weight dynamic modes

Manual Mode [BETA]

The course owner has not enabled manual mode
Specific modes

Learn with flashcards
multiple choiceMultiple choice mode
SpeakingAnswer with voice
TypingTyping only mode

MockP2 - Leaderboard

0 users have completed this course. Be the first!

No users have played this course yet, be the first


MockP2 - Details

Levels:

Questions:

80 questions
🇬🇧🇬🇧
Quick sort doesn't use additional memory like merge sort does
What are 4 examples of abstract data types?
- Keys pressed on a keyboard - Printer Queue
What are 2 real world examples of queues?
EnQueue(item)
How do you add an item to the end of a queue? (code)
IsEmpty()
How do you check if a queue is empty?
IsFull()
How do you check if a queue is full?
- Dynamic data structures are ones which can grow or shrink in size - They require a heap in order to work
What is a dynamic data structure and what do they require in order to work?
A list
What's an example of a dynamic data structure in python?
May grow too large and cause overflow, crashing the program
What's a downside of using a dynamic data structure
Trying to pop from a stack which is already empty
In the context of stacks, what is underflow?
MyList.isEmpty()
In python, how do you test if a list "myList" is empty?
- A pointer to the top of the stack - A var holding the size of the array (the maximum size of the stack)
A stack can be implemented with either a dynamic or a static data structure, what two additional variables are needed if a static data structure is used?
Push(item)
How do you add a new item to a stack? (code)
Pop()
How do you remove and return an item from a stack? (code)
Returns the top item from the stack without removing it
In the context of stacks, what does peek() do?
Initialises the queue
What does this pseudocode do? (queues) front = 0 rear = -1 size = 0 maxSize = size of array
Checks if the queue is empty
What does this pseudocode do? (queues) if size == 0 then return True else return False endif
Checks if the queue is full
What does this pseudocode do? (queues) if size == maxSize then return True else return False endif
Adds an element to the queue
What does this pseudocode do? (queues) if isFull then print("Queue full") else rear = (rear + 1) MOD maxSize q[rear] = newItem size = size + 1
Removes an item from the queue
What does this pseudocode do? (queues) if isEmpty then print("Queue empty") item = Null else item = q[front] front = (front + 1) MOD maxSize size = size - 1
Functions produce information, procedures perform a task
What's the difference between functions and procedures?
Function - input("bruh") Procedure - print("bruh")
Give one python example of a function and one of a procedure
Recursion is calling itself within itself, iteration is just looping
What is the difference between recursion and iteration?
Round down
(binary search) how do determine the middle item in a list with an even number of items?
(first + last) / 2
When coding a binary search algorithm, how do you find the middle item?
- binary search - merge sort
What is one search and one sort algorithm that use divide and conquer?
Quicker - good time complexity Takes more space - bad space complexity
What are the advantages and disadvantages of merge sorts in terms of time and space complexity?
Quick sort doesn't use additional memory like merge sort does
What is the advantage of quick sort over merge sort?
Left subtree -> root node -> right subtree
What order is the tree traversed in an in-order traversal?
Left subtree -> right subtree -> root node
What order is the tree traversed in a post-order traversal?
Root node -> left subtree -> right subtree
What order is the tree traversed in a pre-order traversal?
A binary search tree
What is a typical use of a rooted tree?
- An array of records - left, data, right
When implementing a binary search tree, what would be the appropriate data type and what would be the 3 pieces of data which would need to be stored?
In-order traversal
Which tree traversal order is ideal for searching efficiently?
The pointer will hold the value "null"
In a linked list, how do you know a node is the last one?
Integrated Development Environment
What does IDE stand for?
Normal: 1 and 99 Boundary: 0 and 100 Erroneous: -1 and 101
If something required an input between 1 and 100, what would be an example or normal data, boundary data, and erroneous data?
Switch or Case statement
What is an alternative to a nested if statement?
The underground map
What is an example of abstraction that I'd be familiar with living in London?
Grouping by common characteristics - "is a type of"
What is abstraction by generalisation?
- An algorithm which halves the data set in each pass (good for large data sets) - O(log n)
What is a logarithmic complexity and what is the notation? (Big O)
Constant - O(1)
What is the Big O notation for an algorithm with no loop?
Linear - O(n)
What is the Big O notation for an algorithm with a for/while loop?
Polynomial - O(n^num of loops)
What is the Big O notation for an algorithm with a Nested loop?
Exponential - O(2^n)
What is the Big O notation for a recursive algorithm?
A repeat until loop checks the condition at the END of each loop so it will always run at least once
What is the difference between a while loop and a repeat until loop? An the effect of the difference.
Ensures that each subroutine is completely self-contained
What is the advantage of local variables for subroutines?