Week 5 Flashcards
What are the two types of file systems?
Contiguous and Fragmented.
What is the difference between parallel and concurrent execution?
In parallel, one core handles one task.
In concurrent, the cores will switch between the tasks.
What are lists classified as?
A list is classfied as a linear data structure.
May be one dimenionsal or multidimensional.
Could be ordered or not.
What can an element of a list consist of?
A single data item or a record or object (compound data)
True for false, a list is an abstract data type.
This is true.
What are some ways that lists may be implemented?
It can be implemented in arrays or linked lists, or it can be done in RAM or secondary storage.
True or false, are arrays physically ordered lists?
Yes, arrays are also called physically ordered lists.
What is the definition of an array?
They are linear random access data structures whose elements are accessed by unique identifiers called an index or subscript.
Elements are stored contiguously in RAM or in secondary storage.
In languages like C, C++ and Java where does the index start at?
It starts at 0.
languages like Pascal and FORTRAN are more flexible.
In compiled languages, arrays have a fixed…
Set at compile time for compiled languages. Some languages enforce this, but some languages are more flexible.
Note that typically the compiler actually adds slightly more memory just in case small changes are needed to be made inplace.
What is the difference between size and capacity?
Size is the amount of elements in the array.
The capacity is slighty bigger than the size so changes can be easily made.
If capacity wasn’t slightly bigger it would need to move. We reduce the chances of this operation since this change can be costly.
What is a dynamic array?
In interpreted languages like python and javascript arrays are dynamic.
We can add elements beyond the end of the array. The interpreter resizes the array and reallocates if neeeded.
What do we need to keep in mind if we are inserting a value in the middle.
If you have enough space, you can simply shift everything.
If you don’t have enough space, you need to reallocate it to another space in memory.
Inserting an array in the middle can be quite expensive.
What is the worst case scenario for inserting in an array.
O(n) is the worst case (Inserting at position 0)
The best case is constant.
What is the worst case complexity for deletion.
The worst case for deletion is O(n).