Data structures Flashcards
what is an array?
an array is a variable that can contain more thane one data type. (arrays are static)
what is a stack?
- and what are the uses
A stack is a dynamic data type in the form LIFO , where items are removed from the top of the stack and added from the top
stacks are used for:
-backtracking algorithm
-track the flow of a program
-back buttons
what does static and dynamic mean ?
static= can’t be changed in size
dynamic= can be changed in size
what does
POP
PEEK
PUSH
SIZE
ISEmpty
IsFull
POP= returns the value at the front of the stack and removes it
PEEK= returns the value at the front of the stack but does not remove it
PUSH= this adds an item to the end of the stack
SIZE= returns the size of the stack
ISEmpty= this checks if the list is empty
IsFull= this checks if the list is full
What is a linked list?
- what are its uses ?
a linked list is a dynamic data structure , where each node consist of data and a pointer , where the pointer gives the next location
Uses for a linked list:
-operating system managing a processor
-image viewers to switch between the next images
-music players to store tracks in a playlist
-hash table collision resolution
what is a list?
- lists its properties
what is a tuple?
-list its properties
a list is an abstract data type that represents a sequence of values, where the same value can occur once
- mutable
-can be changed or replaces
-an ordered collection of items
-can consist of more than one data type
Tuples are used to store multiple items in a single variable
-immutable
-cannot be changed or replaced
-an unordered collection of items
how would you deal with a collision ?
what is a disadvantage to collision?
place the item in the next space available
- may lead to clustering of items in a table
what is a binary tree?
- what are its uses ?
a binary tree is a tree that consists of 0,1 or 2 pointers
Uses for a binary tree:
-database application
-operating system scheduling process
-cryptography
what are the uses for graphs ?
-resource allocation of o/s
-mapping road networks for navigation systems
what is
Enqueue?
Dequeue?
Peek?
enqueue- this adds an item to the back of the list
dequeue- this removes an item from the front
peek- peek at the front without removing
what is a priority queue ?
a priority queue is a queue where items can skip to the front
what is a hash table?
- uses for a hash table
a data structure that maps keys to value
uses of a hash table:
-file systems linking a name to the path
-identifying keywords in a programming language
what is a queue?
- and what are the uses
a queue is a dynamic data type in the structure, FIFO
Uses for a queue?
-processor scheduling
-transferring data
state an advantage of a queue that makes it more efficient in use of memory?
- reused space can make more use of memory space
list two items that may be put on a call stack?
return address
local variable
parameter