Section 7 - Data structures Flashcards

1
Q

what is a queue

A
  • FIFO
  • new elements added to the end
  • elements only retrieved from the start
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what are the queue operations

A
  • enqueue: add an item
  • dequeue: remove an item
  • isempty: checks if queue is empty
  • isfull: checks if queue is full
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is a linear queue

A

as items leave the queue, all the other items move up one space (requires significant processing time)
or
pointers to the front and rear and an integer holding the size of the array and the current size of the queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is a circular queue

A

when the array fills up, the rear pointer moves to the first element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what is a dynamic data structure

A

collection of data in memory that can grow or shrink
the heap is a portion of memory from which space is allocated or unallocated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is a static data structure

A

fixed in size, and cannot increase in size or free up space while the program is running

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

advantage of dynamic data strcutres compared to static

A
  • no wasted memory
  • can grow as more data is added to the data strucure
  • resources only allocated as theyre needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

advantages of static structures compared to dynamic

A
  • no pointers or data about the structure need to be stored
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what is a stack

A
  • LIFO
  • items are added and removed from the top
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are stack operations

A
  • push: add to stack
  • pop: removes top item
  • peek: returns top item
  • isempty
  • isfull
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what is stack overflow and underflow

A
  • overflow is an error when an item is pushed onto a full stack
  • underflow is an error when an item us pushed from an empty stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is hashing

A

a hashing algorithm is applied to the value in the key field to transform it into an address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is a collision

A

when two record keys hash to the same address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is a binary tree

A

a tree where each parent node has a maximum of two child nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is pre-order traversal

A

read the node as you pass the left of it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is in-order traversal

A

read the node as you pass under it

17
Q

what is post-order traversal

A

read the node as you pass to the right of it