0% found this document useful (0 votes)
8 views3 pages

Asgn 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Asgn 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CS221- Data Structures & Algos, Fall 2024, Assignment # 1

Due Date: Sept 27, 2024 (10 am) Total Marks: 50

Question (50 Marks) TCP/IP stands for Transmission Control Protocol/Internet Protocol, and it is a suite of
communication protocols used to connect network devices on the internet. Currently, most of us use IPv4 for
addressing within the TCP/IP protocol stack. The stack is typically organized into five layers which are as follows:

1. Application Layer: This layer includes protocols for various applications, such as HTTP, FTP, and SMTP,
enabling user interaction and data transfer.
2. Transport Layer: Here, TCP and UDP operate. TCP (Transmission Control Protocol) ensures reliable
transmission, error checking, and packet sequencing, while UDP (User Datagram Protocol) provides
faster but less reliable communication.
3. Internet Layer: This layer is responsible for logical addressing and routing. The Internet Protocol (IP),
including both IPv4 and IPv6, functions here, breaking messages into packets, each with source and
destination IP addresses.
4. Link Layer: This layer handles the physical transmission of data over network hardware, including
protocols like Ethernet and Wi-Fi.
5. Physical Layer (sometimes included in the Link Layer): This involves the actual hardware connections,
signaling, and transmission mediums.
When a message is sent, TCP divides it into smaller packets. Each packet is assigned a packet number which
allows the receiver to reassemble the original message correctly. This segmentation improves network
efficiency and error management during transmission. You are hired by a leading software house to develop
a data-structures code using C++ for sending and receiving packets. Using the linked list knowledge, create a
link list called packet-list and perform the following operations (within the C++ class):
1. Decompose a new message into packets
2. Display the entire contents of link-list or packet-list
The main function is already written and displayed here. You can infer the function protoypes/signatures
from the main function. The structure of packet is given as follows:
struct Packet
{
int msg_number;
int packet_number;
char data;
Packet* next;
};
class PacketList
{ .......... (to be developed by you/students)
}

Page 1 out of 3
Remember: Each packet can only store 1 character in the data portion. Your code must produce the
following output for the main function given below

int main()
{
PacketList p;

string message1 = "Hello";


string message2 = "This";
string message3 = "is";
string message4 = "CS221";
string message5 = "Assignment";
p.decomposeMessage(message1);
p.decomposeMessage(message2);
p.decomposeMessage(message3);
p.decomposeMessage(message4);
p.decomposeMessage(message5);

// Display all packets


cout << "Displaying all packets" <<endl;
p.display_list();

return 0;
}

Page 2 out of 3
Figure 1 - Output of the C++ code that you develop

Page 3 out of 3

You might also like