Monday, January 29, 2018

A periodic composite signal contains frequencies from 10 to 30 KHz, each with an amplitude of 10 V. Draw the frequency spectrum?

This signal is periodic and the frequency domain is made of discrete like as this diagram:

A periodic composite signal with a bandwidth of 2000 Hz is composed of two sine waves. The first one has a frequency of 100 Hz with a maximum amplitude of 20 V; the second one has a maximum amplitude of 5 V. Draw the bandwidth?

What is the bandwidth of a signal that can be decomposed into five sine waves with frequencies at 0, 20, 50, 100, and 200 Hz? All peak amplitudes are the same. Draw the bandwidth.

Given the following periods, calculate the corresponding frequencies:a)5 s    b)12 μs    c)220 ns

Given the following periods, calculate the corresponding frequencies:a)5 s b)12 μs c)220 ns

a)5 s
Solution:
         Given period=T=5s
         Frequency=f=1/Period(T)
                            f=1/5 Hz
                            f=0.2 Hz

b)12 μs
Solution:
     Given Period=T=12µs
      f=1/12 Hz
      f=83333 Hz
      f=83.333*103 Hz  
      f=83.333 KHz      

c)220 ns
Solution:
     Given Period=T=220ns
       f=1/220 Hz
       f=4550000 Hz
       f=4.55*106 Hz     
       f=4.55 MHz 
 Given the frequencies listed below, calculate the corresponding periods:  a) 24Hz, b) 8 MHz  c) 140 KHz

Given the frequencies listed below, calculate the corresponding periods: a) 24Hz, b) 8 MHz c) 140 KHz

a) 24Hz
Solution:
Given Freqency=f=24 Hz
Period(T)=1/frequency(f)
            T=1/24
            T=0.0417s
            T=41.7*10-3 s
                  T=41.7ms
            
b) 8 MHz
Solution:
Given Frequency=f=8 MHz
           T=1/f
          T=1/8
          T=0.000000125s
          T=0.125*10-6 s
          T=0.125µs

c) 140 KHz
Solution:
     Given Frequency=f=140 KHz
                   T=1/140
                   T=0.00000714s
                   T=7.14*10-6 s
                   T=7.14µs
Give some advantages and disadvantages of combining the session, presentation, and application layer in the OSI model into one single application layer in the Internet model?

Give some advantages and disadvantages of combining the session, presentation, and application layer in the OSI model into one single application layer in the Internet model?



Session layer in the OSI model
1.     Dialog Control : This layer allows two systems to start communication with each other in half-duplex or full-duplex.
2.     Synchronization : This layer allows a process to add checkpoints which are considered as synchronization points into stream of data. Example: If a system is sending a file of 800 pages, adding checkpoints after every 50 pages is recommended. This ensures that 50 page unit is successfully received and acknowledged. This is beneficial at the time of crash as if a crash happens at page number 110; there is no need to retransmit 1 to100 pages


Presentation layer in the OSI model
1.     Translation : Before being transmitted, information in the form of characters and numbers should be changed to bit streams. The presentation layer is responsible for interoperability between encoding methods as different computers use different encoding methods. It translates data between the formats the network requires and the format the computer.
2.     Encryption : It carries out encryption at the transmitter and decryption at the receiver.
3.     Compression : It carries out data compression to reduce the bandwidth of the data to be transmitted. The primary role of Data compression is to reduce the number of bits to be 0transmitted. It is important in transmitting multimedia such as audio, video, text etc.
Application layer in the OSI model
1.     Mail Services : This layer provides the basis for E-mail forwarding and storage.
2.     Network Virtual Terminal : It allows a user to log on to a remote host. The application creates software emulation of a terminal at the remote host. User’s computer talks to the software terminal which in turn talks to the host and vice versa. Then the remote host believes it is communicating with one of its own terminals and allows user to log on.
3.     Directory Services : This layer provides access for global information about various services.

4.     File Transfer, Access and Management (FTAM) : It is a standard mechanism to access files and manages it. Users can access files in a remote computer and manage it. They can also retrieve files from a remote computer.
Match the following to one or more layers of the OSI model

Match the following to one or more layers of the OSI model


a.     Route determination
                   Network

b.    Flow control
               Transport and Data Link

c.      Interface to transmission media
                         Physical

d. Provides access for the end user

                                 Application
How are OSI and ISO related to each other?

How are OSI and ISO related to each other?



 ISO is the organization (International Standards Organization), and OSI (Open Systems Interconnection) is its model.

        The international Standard Organization (IOS), is a multinational body dedicated worldwide agreement on international standard. An ISO standard that covers all aspects of network communications is the Open System Interconnection (ISO) model.
What are the advantages of a multipoint connection over a point-to-point connection?

What are the advantages of a multipoint connection over a point-to-point connection?

Point-to-point:
                 Point to point connection is limited to two devices, where else more than two devices share a single link in the multipoint connection.
Multipoint:
                The multipoint connection can be used for fail-over and reliability.



Point to point Connection / Protocol:
               Computer Networking includes a protocol called Point to Point. where direct connection established between two computer or two nodes.  It can provide connection authentication, transmission encryption (using ECP, RFC 1968), and compression.
                PPP is commonly used as a data link layer protocol for connection over synchronous and asynchronous circuits, where it has largely superseded the older Serial Line Internet Protocol (SLIP) and telephone company mandated standards (such as Link Access Protocol, Balanced (LAPB) in the X.25 protocol suite). The only requirement for PPP is that the circuit provided be duplex. PPP was designed to work with numerous network layer protocols, including Internet Protocol (IP), TRILL, Novell's Internetwork Packet.
What are the responsibilities of the data link layer in the Internet model?

What are the responsibilities of the data link layer in the Internet model?

           The data link layer is responsible fora. framing data bitsb. providing the physical addresses of the sender/receiverc. data rate controld. detection and correction of damaged and lost frames The data link layer is responsible for moving frames from one hop or node to the next. Other responsibilities of the data link layer include the foollowing….
1.     Framing
        The DLL dividdes the stream of bits received from the network layer into manageable data units called frames.
2.     Physical addressing
         If the frames are to be distributed to different systems on the network, the DLL adds a header to the frame to define sender or receiver of the frame.
3.     Flow control
        Flow control is one of the important design for DLL...Flow control, that controls the flow of data between sender and receiver.
4.     Error control
         DLL is responsible to detect and retransmit damaged or lost frames...It also user a mechanism to recognize duplicate frames.
5.     Access control
          When two or more devices are connected to the same link, DLL protocols are determine, which device has control over the link at any given time.
Relationship in tree in DSA

Relationship in tree in DSA

Node
          Nodes are often arranged in tree structures. These structures are binary trees. A node represents the information contained in a single structure. These nodes may contain a value or condition or possibly serve as another independent data structure.

Root
          The top node in a tree.

Parent node
          If node C is a child of node A, then A is the parent node of C.

Child node
          A node directly connected to another node when moving away from the Root.

Siblings
          A  group of nodes with the same parent.

Level of tree
         The level of a tree as the number of parent nodes a tree node has.

Degree of tree
         The number of sub trees of a node.


Difference between Graph and Tree in DSA

Graph
            A graph is a set of items that are connected by edges and each item is known as node or vertex. In other words, a graph can be defined as the set of vertices and there is a binary relation between these vertices.
             In an implementation of a graph, the nodes are implemented as objects or structures. The edges can be represented in different ways. One of the ways is that each node can be associated with an incident edges array. If the information is to be stored in nodes rather than edges then the arrays act as pointers to nodes and also represent edges. One of the advantages of this approach is that additional nodes can be added to the graph. Existing nodes can be connected by adding elements to arrays. But there is one disadvantage because time is required in order to determine whether there is an edge between the nodes.
           Another way to do this is to keep a two-dimensional array or matrix M that has Boolean values. The existence of edge from node I to j is specified by entry Mij. One of the advantages of this method is to find out if there is an edge between two nodes.
Tree
           The tree is also a data structure used in computer science. It is similar to the structure of the tree and has a set of nodes that are linked to each other.
          A node of a tree may contain a condition or value. It can also be a tree of its own or it can represent a separate data structure. Zero or more nodes are present in a tree data structure. If a node has a child then it is called parent node of that child. There can be at most one parent of a node. The longest downward path from the node to a leaf is the height of the node. The depth of the node is represented by the path to its root.

          In a tree, the topmost node is called root node. The root node has no parents as it is the topmost one. From this node, all tree operations begin. By using links or edges, other nodes can be reached from the root node. The bottom-most level nodes are called leaf nodes and they don’t have any children. The node that has a number of child nodes is called inner node or an internal node.



Graph in DSA

      A graph is an abstract data type that is meant to implement the undirected graph and directed graph concepts from mathematics.
    A graph data structure consists of a finite (and possibly mutable) set of vertices or nodes or points, together with a set of unordered pairs of these vertices for an undirected graph or a set of ordered pairs for a directed graph. These pairs are known as edges, arcs, or lines for an undirected graph and as arrows, directed edges directed arcs or directed lines for a directed graph. The vertices may be part of the graph structure or may be external entities represented by integer indices or references.

           A graph data structure may also associate to each edge some edge value, such as a symbolic label or a numeric attribute (cost, capacity, length, etc.).

Almost complete Binary Tree in DSA

        An almost complete binary tree is a tree in which each node that has a right child also has a left child. Having a left child does not require a node to have a right child. Stated alternatively, an almost complete binary tree is a tree where for a right child, there is always a left child, but for a left child, there may not be a right child. The number of nodes in a binary tree can be found using this formula: n = 2^h Where n is the number of nodes in the tree, and h is the height of the tree.

Complete binary in DSA

          A complete binary tree is a tree that is completely filled, with the possible exception of the bottom level. The bottom level is filled from left to right.

         A binary tree T with n levels is complete if all levels except possibly the last are completely full, and the last level has all its nodes to the left side. A perfectly complete binary tree has all the leaf nodes. In the complete binary tree, all the nodes have left and right child nodes except the bottom level. At the bottom level, you will find the nodes from left to right. The bottom level may not be completely filled, depicting that the tree is not a perfectly complete one.

Binary search Tree in DSA


        Binary search trees (BST), sometimes called ordered or sorted binary trees, are a particular type of containers: data structures that store "items" (such as numbers, names etc.) in memory. They allow fast lookup, addition, and removal of items, and can be used to implement either dynamic sets of items, or lookup tables that allow finding an item by its key (e.g., finding the phone number of a person by name).
       Binary search trees keep their keys in sorted order, so that lookup and other operations can use the principle of binary search: when looking for a key in a tree (or a place to insert a new key), they traverse the tree from root to leaf, making comparisons to keys stored in the nodes of the tree and deciding, based on the comparison, to continue searching in the left or right subtrees. On average, this means that each comparison allows the operations to skip about half of the tree, so that each lookup, insertion or deletion takes time proportional to the logarithm of the number of items stored in the tree. This is much better than the linear time required to find items by key in an (unsorted) array but slower than the corresponding operations on hash tables.

Binary Trees in DSA

      A binary tree is made of nodes, where each node contains a "left" reference, a "right" reference, and a data element. The topmost node in the tree is called the root.
         Every node (excluding a root) in a tree is connected by a directed edge from exactly one other node. This node is called a parent. On the other hand, each node can be connected to an arbitrary number of nodes, called children. Nodes with no children are called leaves, or external nodes. Nodes which are not leaves are called internal nodes. Nodes with the same parent are called siblings.






Define Trees in DSA

    A tree data structure can be defined recursively (locally) as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root.

         Alternatively, a tree can be defined abstractly as a whole (globally) as an ordered tree, with a value assigned to each node. Both these perspectives are useful: while a tree can be analyzed mathematically as a whole, when actually represented as a data structure it is usually represented and worked with separately by node (rather than as a list of nodes and an adjacency list of edges between nodes, as one may represent a digraph, for instance). For example, looking at a tree as a whole, one can talk about "the parent node" of a given node, but in general, as a data structure a given node only contains the list of its children but does not contain a reference to its parent.
What is queue?

What is queue?

        A queue is a linear data structure in which one end is always used to insert data (enqueue) and the other is used to remove data (dequeue). The element inserted first will also be removed first.              
Example:
1)    The queue of processes in OS.
2)    The queue of packets in data communication.
3)    The queue of airplanes waiting for landing instructions.  
Example:
1)    A  queue can be a single-lane one-way road, where the vehicle enters first, exits first.
2)    A queue is the ticket windows and bus-stops


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
            int numbers[5];
            int x; int a; int b; int sum; sum=0;
            cout<<"press 1 for addition"<<endl;
            cout<<"press 2 for show the value"<<endl;
            cout<<"press 3 for exit the program"<<endl;
            cout<<"Enter 1 to additional"<<endl;
            cin>>x;
            if(x==1)
            {
                        cout<<"valid"<<endl;      
            cout<<"Enter the five numbers:"<<endl;
                        for(int i=0; i<5; ++i)
                        {
                                    cin>>numbers[i];
                                    sum+=numbers[i];
                        }          
            }
                        else
                        cout<<"invalid"<<endl;
            {
            cout<<"Enter 2 to show:"<<endl;
            cin>>x;
            if(x==2)
            cout<<"valid"<<endl;
            cout<<"the sum of total value:"<<sum<<endl;
}

cout<<"invalid"<<endl;
{
            cout<<"Enter 3 to exit:"<<endl;
            cin>>x;
            if(x==3)
            cout<<"valid"<<endl;
            return 0;
}

}

Wednesday, January 3, 2018

What is tree in data structure?

A tree data structure can be defined recursively (locally) as a collection of nodes (starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root.
Alternatively, a tree can be defined abstractly as a whole (globally) as an ordered tree, with a value assigned to each node. Both these perspectives are useful: while a tree can be analyzed mathematically as a whole, when actually represented as a data structure it is usually represented and worked with separately by node (rather than as a list of nodes and an adjacency list of edges between nodes, as one may represent a digraph, for instance). For example, looking at a tree as a whole, one can talk about "the parent node" of a given node, but in general,as a data structure a given node only contains the list of its children but does not contain a reference to its parent