Data Structures- S7 Flashcards
Array
A finite, ordered set of elements of the same type.
In a 1-dimensional array how would you write the pseudocode, when you want the fourth item in the array called Family
Family[4]
Tuples
a dynamic data structure where the elements do not have to be the same type, and the number of elements in tuple can increase or decrease.
What is a Record
A data type that allow you to store data permanently so you can read and update it at future dates. Often a database.
What does a file consist of?
A file consists of records and a record holds a number of fields.
What is Abstract data types?
data type created by the programmer rather than defined in a programming language. E.g queues, stacks
What is Static Data Structure?
a collection of data in memory that is fixed in size and cannot increase or decrease in size while the program is running.
What is a Dynamic Data Structure?
a collection of data in memory that has the ability to increase or decrease in size while a program is running.
What is a Queue?
An ordered collection of items where new elements are added at the end of a queue and removed from the front of the queue.
What are queues used for in Computing?
Queues are used for waiting to print (queue on disk), characters typed at a keyboard (keyboard buffer).
How do you push an item in a queue?
Check if full. If not then add one to the rear pointer, add item to rear and increase size of array
How do you pop an item?
Check if empty. If not return item at front pointer. Add one to the front pointer and decrease size of array by one.
How can you over come limitations on data size ?
Have a dynamic data structure, or do circular queue
What’s a list?
An abstract data type consisting of a number of items which may occur more than once.
What does array.index(3) do?
returns what position 3 is in
What does array.append(33) do?
will insert 33 at the end of the list
What does array.insert(2,7) do?
inserts 7 in the second position and the rest shift
What does array.pop() do?
remove and return the last item in the list
What does array.remove(2) do?
will remove the first 2 to come up
What is a Stacks?
Items are added to the top of the stack and removed from the front.
When are stacks used?
Used to hold return addresses when subroutines are called, when you press back in browser and undo in word processing.
What would you do to pop in a stack?
top=top-1
What would you do to push in a stack?
top=top+1
What is overflow?
What you try to push an item but it has already reached its maximum size
What is underflow?
When you try to pop but there are not items
2-dimensional array
A collection of data items of the same data type Under one identifier but uses two index numbers. The array has a name and a table that has co-ordinate points.