Data Structures Part 2 Flashcards

1
Q

Array

A

An ordered group of items, each of the same data type. The number of items is fixed in size. Each item is identified by a subscript.

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

Use Record When

A

The data is all about one object e.g. a person, a holiday.

The data is of different data types

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

Use array when

A

The data is about a number of different items.

The data is all of the same data type.

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

Record

A

A data structure that holds a number of related data values (possibly of different data types) , normally about the object.

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

Linear (sequential) search

A

A search where each record is examined in turn until required records is found or the end of the list is reached.

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

Binary search

A

A search on an ordered list where the middle item is inspected, if it is not the correct item, decide which half of the list contains the required value. Search that half of the list. Repeat the process.

half the list is discarded. This process is repeated.

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

Swapping

A

The process of exchanging the contents of two storage locations.

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

Bubble Sort

A

Work through the list examining pairs of records.
If a pair is in the wrong order then swap them.
keep passing through the list until no swaps are made.

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

Insertion Sort

A

Loop for each element in the unsorted part of the list.

Search through the list finding the position of the highest element.

Swap the highest element with the element at the top of the unsorted part of the list.

The top element is in the correct position so is now part of the sorted list.

Repeat until each item has been put in place.

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

Quick sort

A

Select the first element.

Partition the list so that those items less than the first item come after it and those items greater than the first item come before it.

The first item is then in it’s correct position.

Sort the two separate lists.

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

Quick Sort - Advantage

A

It is fastest/most efficient type of sort algorithm. It uses recursion

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

Sort choice depends on

A
The number of elements in the list.
The amount of disorder in the list.
If the data structure is sorted.
The amount of temporary storage available
Computer /processor speed
Data type.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Pointer

A

A reference to a storage location, an address.

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

Class

A

A class consists of a description of all of the data in a record together with the operations that can be applied to it.

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

Data structure

A

It’s an organised group of related data items.

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

Static Data Structure

A

A data structure that is fixed in size, such as an array.

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

A dynamic data structure

A

It’s one that can grow as data is added and shrink when data is removed.

18
Q

Stack

A

The stack is a dynamic data structure operating on the principle of Last In First Out. When an item is removed it is always the most recently added item. E.g. Undo function

19
Q

Pull

A

Removing an item from a stack.

20
Q

Pushing

A

Adding an item to a stack

21
Q

Stack Errors

A

Trying to remove (pull) from an empty stack.

22
Q

Stack Usages

A
  • Implement an undo function.

- Implement a back function.

23
Q

Quueue

A

A queue is a dynamic data structure operating on the principle of First In First Out. When an item is removed it is always the item which has been in the queue the longest.

24
Q

Queue Errors

A

Trying to remove an item from an empty queue.

25
Q

Queue Usages

A
  • Print queue (spooling)
  • Keyboard buffer
  • Audio/video streaming buffering.
26
Q

Linked List

A

A Linked List is a dynamic data structure operating on the principle of each item being linked to the next by a pointer. It is more versatile than a stack or a queue since data may be added or removed in any order.

27
Q

Linked List Errors

A

Searching for an item that is not present.

28
Q

Linked List Usage

A

List joining blocks of a file on a disc.

29
Q

Double linked List

A

It has a link going to previous record as well as the next record. The list may then be searched in either direction.

30
Q

Circular linked list

A

It has the last element linked back to the first.

31
Q

Binary Tree

A

A tree is a dynamic data structure organised as a series of layers. Each data item (node) is linked to exactly one element in the layer above and any layers below.

32
Q

Root

A

A very top of a tree.

33
Q

Branch

A

A path joining parts of a tree.

34
Q

Terminal Node

A

A final node which has no branches beneath it.

35
Q

Subtree

A

From any node the branches beneath it form trees.

36
Q

Parent

A

A node immediately above a given node.

37
Q

Child

A

Nodes connected to and immediately below a given node.

38
Q

Level

A

All nodes, the same number of branches away from the root node, have the same level.

39
Q

Tree errors

A

Deleting or searching something that doesn’t exist. - Node not found.

40
Q

Tree Usage

A
  • Hierarchical file structure.

- Domain name structure.

41
Q

Binary Sort Tree

A

A binary tree where all the values in the left subtree of any node are smaller than the values in the node AND all the values in the right subtree of any node are larger than the value in the node.

42
Q

Traverse

A

The process of visiting in turn each element in a data structure.