Skip to main content

Posts

Fundamental Concepts of Arrays

  An   array   is a collection of elements of the same data type stored in   contiguous memory cells . It has a   fixed size   and is by default   passed by reference   to a function.  Eg. int arr[6] = {4, -3, 8, 5, -1, 6}; It initializes an integer array 'arr' storing 6 elements.  Assuming the size of an integer to be 4 bytes and base cell address to be 2000. It can be represented as -  A  dynamic array  is similar to a static array but it has the ability to  automatically resize  itself when an element is inserted or deleted.  They are available as  vectors in C++  and likewise l ists in Java .  Eg. list<int> l;      vector<int> v; Vectors are slightly less efficient than static arrays due to the occasional resizing and copying of elements.   The amortized time complexity of insertion in a dynamic array is O(1).  [Amortized Time complexity = No. of operations / No. of pushbacks]
Recent posts

What is a router?

A router is a networking device that forwards data packets from one network to another network based on their IP addresses. It is essentially a gateway to another network. It operates at the network layer(Layer 3) of the OSI reference model.  When a data packet is received from the sending router, the receiving router inspects the packet's destination IP address and determines if the packet was made for its own network or another network. If the data packet is made for its own network then it receives it, if it is made for another network then it forwards the data packet to the destination network. The router makes use of the information present in the routing table.  While Hubs and switches are used to create a network , routers are used to connect networks .

What is Switch?

Switches are similar to hubs . They are used to exchange data within a local area network. Unlike hubs, they are intelligent  and smarter networking devices. A switch operates at the data link layer(Layer 2) of the OSI model. Switches connect devices together within one local area network (LAN) and learn physical addresses(mac addresses) of the devices that are connected to it and store these physical addresses in its table. It does not read IP addresses . When a data packet is sent to a switch it is only directed to the intended destination port. Some switches can also process data at the network layer(Layer 3) by additionally incorporating routing functionality. Advantages of Switch over Hubs:- Reduce unnecessary traffic It is a multi-port bridge that has 24/48 ports It detects specific devices that are connected to it as it keeps a record of the Mac addresses of those devices

What is a Network Hub?

Hub is the most simple networking device which is used to connect all network devices on an internal network. It detects whether a device is physically connected to it or not. It is a Layer 1 device in OSI reference model and is best for small and simple local area networks. It is not intelligent because it does not filter any data. When a packet is received by one port, the data is copied to all other ports and is seen by all connected devices. It has 4/12 ports . Drawbacks of Hubs are:- Rebroadcast- Forwards packets across all ports. Creates Security concerns- Traffic could not be safeguarded. Unnecessary traffic which reduces bandwidth.   

TCP and UDP protocols of Transport Layer

TCP and UDP are Transport Layer protocols which allow multiple applications to use one network connection simultaneously. TCP: It stands for Transmission Control Protocol. It is a reliable and connection-oriented transport protocol. A connection must be established between both ends of a transmission before either can transmit data.   It uses three-way handshaking to set up connection.                  At the sending end of each transmission, TCP divides a stream of data into smaller units called segments. Each segment includes a sequence number and an acknowledgment number for ordering at the receiver side. It has a bigger header of 20 bytes. It provides congestion control and the segments reach in-order. UDP: It stands for User Datagram Protocol. It is a process-to-process that adds only port addresses, checksum, error control and length information to the data from the upper layer. It is an unreliable connectionless protocol widely used for client-server applicat

TCP/IP Protocol Suite

The name TCP/IP refers to a suite of data communication protocols. The name comes from two of the more important protocols in the suite. The Transmission Control Protocol(TCP) and the Internet Protocol(IP). It consists of five layers: Physical, Data Link, Internet, Transport, and Application. The internet layer is equivalent to the Network layer and the Application layer is roughly doing the job of the Session, Presentation, and Application layer. TCP/IP is a hierarchical protocol made up of interactive modules, each of which provides a specific functionality. The layers of the TCP/IP suite contain relatively independent protocols that can be mixed and matched depending on the needs of the system. Application Layer: This layer is the top layer in the TCP/IP model. It includes processes which use Transport Layer Protocol to transmit the data to their destination. There are different Application Layer Protocols such as HTTP, FTP, SMTP, SNMP protocols etc. Transport Lay

Devices used in each layer of OSI Model

Pic: Wikipedia 1.Physical Layer- Bits: Hubs, Repeaters, Fibers, Cables, Microwave, Radio, etc. 2.Data Link Layer- Frames: Bridges, 2-Layer Switches, Ethernet, WiFi AP's 3.Network Layer- Packets: Routers, 3-Layer Switches. 4.Transport Layer- Segments: Load Balancers/Firewalls. 5.Session Layer- Data:  Load Balancers/Firewalls/Computers. 6.Presentation Layer- Data: Load Balancers/Firewalls/Computers. 7.Application Layer- Data:  Load Balancers/Firewalls/Computers.