You are on page 1of 2

Homework - Week 14

Name:RAHMAN MD MATIUR
Student Id :2230130236
Please watch these videos first, and finish your homework after class. You can edit
WORD documents directly, or take photos after writing them down, and send them to my
email. My email: xupeng.01@163.com
If you can't do some problems in your homework, you can leave it blank.
请大家先认真学习视频,再完成下列作业。作业可以直接编辑 Word 文档,也可
以写下后拍照,将文档或照片发我的电子邮箱。我的邮箱:xupeng.01@163.com
如果作业中有些题目不会,可以空着不做。

Task 1: Please describe three implement methods of IP access list.(请描述 IP 访问列表


的三种实现方法。)
Answer:

IP access lists are a fundamental tool used in networking to control the flow of network
traffic based on specific criteria, such as source or destination IP addresses, protocols, or port
numbers. There are various methods to implement IP access lists, and here are three
commonly used approaches:

1. Standard Access Lists: Standard access lists are the simplest form of IP access lists. They
allow or deny traffic based solely on the source IP address. Standard access lists are identified
by their number range from 1 to 99 and 1300 to 1999. The configuration syntax varies
depending on the network device or operating system being used, but generally, the access
list is created with a statement like "access-list <number> permit <source IP>" or "access-list
<number> deny <source IP>". Once created, the access list is applied to an interface or
interface direction using the "ip access-group <number> {in | out}" command.

2. Extended Access Lists: Extended access lists offer more granular control compared to
standard access lists. They allow filtering based on source and destination IP addresses, as
well as protocols, port numbers, and other criteria. Extended access lists are identified by
their number range from 100 to 199 and 2000 to 2699. The configuration syntax for extended
access lists is more complex but flexible. It typically involves specifying source and
destination addresses, protocols, and ports along with permit or deny actions. Similar to
standard access lists, extended access lists are applied to interfaces using the "ip access-
group" command.

3. Named Access Lists: Named access lists are an alternative method of implementing IP
access lists that provides better manageability and readability compared to numbered access
lists. Instead of using numbers, named access lists are created with user-defined names,
making it easier to identify their purpose or function. The configuration syntax for named
access lists is similar to extended access lists, allowing for filtering based on various criteria.
Once created, named access lists are applied to interfaces using the "ip access-group <name>
{in | out}" command.

It's important to note that the actual configuration commands and syntax can vary depending
on the network device or operating system being used. The examples provided above are
general representations of the configuration process but may require adaptation based on
specific equipment or software.

Task 2:Please describe the definition of hash table. (请描述哈希表的定义。)


Answer:

A hash table, also known as a hash map, is a data structure that stores data in an associative
array format. It is widely used in computer science and programming for efficient data
retrieval and insertion operations. The primary goal of a hash table is to provide constant-
time average-case complexity for these operations, making it a powerful tool for handling
large amounts of data.

At its core, a hash table consists of an array (or a dynamic array) and a hash function. The
array is divided into multiple slots or buckets, and each slot can hold a key-value pair or a
pointer to a linked list of key-value pairs. The hash function takes the input key and converts
it into an index within the array, where the corresponding value can be stored or retrieved.

The hash function plays a crucial role in the efficiency of a hash table. It maps the keys to the
array indices, aiming to distribute the data uniformly across the available slots. A good hash
function minimizes collisions, which occur when two different keys produce the same hash
value. Collisions can be handled through various techniques, such as separate chaining or
open addressing.

When storing a value in a hash table, the key is first processed by the hash function to
determine the array index. The value is then inserted into the corresponding slot or handled
according to collision resolution techniques. Retrieving a value involves applying the hash
function to the key to find the correct array index and accessing the value stored at that
location.

The main advantage of hash tables is their efficiency in average-case scenarios. With a well-
designed hash function and a proper choice of array size, the operations of inserting,
retrieving, and deleting elements can be performed in constant time, often referred to as O(1)
complexity. However, in the worst-case scenario where many collisions occur, the time
complexity can degrade to O(n), where n is the number of elements in the hash table.

Hash tables are widely used for implementing various data structures and algorithms,
including dictionaries, caches, symbol tables, and sets. They provide a fast and reliable way
to store and access data, making them an essential tool in computer programming.

You might also like