Data structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

what is an array?

A

an array is a variable that can contain more thane one data type. (arrays are static)

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

what is a stack?
- and what are the uses

A

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

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

what does static and dynamic mean ?

A

static= can’t be changed in size
dynamic= can be changed in size

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

what does
POP
PEEK
PUSH
SIZE
ISEmpty
IsFull

A

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

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

What is a linked list?
- what are its uses ?

A

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

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

what is a list?
- lists its properties
what is a tuple?
-list its properties

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how would you deal with a collision ?
what is a disadvantage to collision?

A

place the item in the next space available
- may lead to clustering of items in a table

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

what is a binary tree?
- what are its uses ?

A

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

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

what are the uses for graphs ?

A

-resource allocation of o/s
-mapping road networks for navigation systems

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

what is
Enqueue?
Dequeue?
Peek?

A

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

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

what is a priority queue ?

A

a priority queue is a queue where items can skip to the front

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

what is a hash table?
- uses for a hash table

A

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

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

what is a queue?
- and what are the uses

A

a queue is a dynamic data type in the structure, FIFO

Uses for a queue?
-processor scheduling
-transferring data

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

state an advantage of a queue that makes it more efficient in use of memory?

A
  • reused space can make more use of memory space
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

list two items that may be put on a call stack?

A

return address
local variable
parameter

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

explain how hashing algorithim works?

A
  • an algorithm is applied to a primary key, to generate an address where data is stored.
17
Q

explain possible ways of improving a hash table?

A

increasing the size of the hash table

18
Q

what criteria is nesecarry for an effective hashing algorithm?

A
  • must minimize collision
    -Must generate a good spread over the problem space
    -Must always generate the same hash key from the same hash value
19
Q

in the scenario of a collision, what would be a suitable approach to this?

A
  • by placing the hash into the next free available space
20
Q

what are the uses of a tree traversal algorithm?

A

binary search trees
expression trees

21
Q

what does the term hash mean?

A

A result generated by applying an algorithmic process to value.

22
Q

explain how a data item is removed from a linked list ?

A

-first, you traverse the list to the item
- find the value of the item to be removed and the next pointer
-set the next pointer to the other item

23
Q

name a list of data stuctures

A

-Graph
-Tree
Linked list
-queue
stack
array
list
hash table