Docsity

PPT for com sci component 1, Summaries of Computer Science

Toggle sidebar
bg1
1. An array and a linked list can both be used to implement a single hash table. Explain how the data structures
are used, including an advantage and disadvantage of each.
The following structures to store data:
โ— linked list โ— graph (directed and undirected) โ— stack โ— queue โ— tree โ— binary search tree โ— hash
table
Data structures
Array Linked List
Purpose in the implementation of a hash table
Advantage Disadvantage Advantage Disadvantage
pf3
pf4
pf5

Partial preview of the text

Download PPT for com sci component 1 and more Summaries Computer Science in PDF only on Docsity!

  1. An array and a linked list can both be used to implement a single hash table. Explain how the data structures

are used, including an advantage and disadvantage of each.

The following structures to store data:

โ— linked list โ— graph (directed and undirected) โ— stack โ— queue โ— tree โ— binary search tree โ— hash

table

Array Linked List

Purpose in the implementation of a hash table

Advantage Disadvantage Advantage Disadvantage

  1. The police NPR system uses a hash function on a car number plate to identify a vehicle. Each character is

converted to a denary number using ASCII. The result of the sum of the numbers modulo 5 delivers an index for

a hash table. PH02RNB is a Ford, SBG984 is a Honda, X15CDC is an Audi, MY02ZRO is a Vauxhall. Show how the

data is stored.

The following structures to store data:

โ— linked list โ— graph (directed and undirected) โ— stack โ— queue โ— tree โ— binary search tree โ— hash

table

PH02RNB

SBG

X15CDC

Key Calculated

Value

Mod 5

Inde

x

Data Car

MY02ZRO

Hash function

Hash table Overflow

Inde

x

Data Car

  1. Hashing algorithms, sometimes known as hashing functions have many uses including data storage, encryption

and cyclic redundancy checks. They are designed to be collision-resistant.

Research the following family of famous hashing algorithms: MD5 , SHA-1 and SHA-2. Briefly explain their

history and evolution.

How to create, traverse, add data to and remove data from data structures, either using arrays and

procedural programming or an object-oriented approach

1. Match the following data structures with their corresponding descriptions.

Graph

Tree

Queue

Stack

A data structure that creates a mapping between keys and values using a hashing

algorithm.

In best case elements are accessed directly rather than through a sequential search.

A first in, first out (FIFO) data structure.

A connected, undirected graph with no cycles. It does not have a root.

Used to store more complex relationships between data items.

Dictionary

Vector

A last in, first out (LIFO) data structure.

A list of numbers representing a geometric point in space.

A dictionary can be used to represent the data structure as a function.

A collection of key-value pairs in which the value is accessible via the associated key.

An implementation of a hash table.

Binary tree

A rooted tree data structure where each node has at most two children.

Array

Contiguous memory locations holding the same data type, with a single identifier

accessed by an index.

Useful for representing vectors.

Hash table

Comparing static and dynamic data structures

1. Place the boxes under the correct column heading.

Advantages of

static data structures

Advantages of

dynamic data structures

Disadvantages of

static data structures

Disadvantages of

dynamic data structures

Items can only be added if there

is space Makes the most efficient use of

memory Memory requirements known in

advance Any number of items can be

added

Fast element access speed

Memory is allocated even if it is

not used

Slower element access speed

Memory requirements not known