Thursday, 8 October 2015

B.tech | 5th sem notes | CS | NOTES OF RED BLACK TREE |




NOTES OF RED BLACK TREE
in advance data structure
Download Link

Notes on Red-Black Trees

The efficiency of binary search trees

  • Binary search trees provide the ability to maintain collections of ordered data in a potentially efficient fashion.
  • Search, insert, and remove are all O(h), where h is the height of the search tree.
  • If we are fortuitous, the tree is approximately balanced --- for any node, the number of nodes in its in left subtree is roughly the same as the number of nodes in its right subtree.
  • In the balanced, or nearly balanced case, the height of the tree is O(lg(n)) where n is the total number of nodes in the tree.
  • In the worst (least balanced) case, the height is O(n).

Improvements and alternatives

Rather than rely on luck, we'd like to be able to guarantee that we can perform the search tree operations in logarithmic time. There are several ways this can be accomplished:
As read in Main & Savitch, we can use B-trees to store the data in a way that is wide rather than deep, and still allows for efficient manipulations. B-trees are not binary search trees --- they aren't even binary trees. In order to implement them we need to start from the ground up with a fresh data structure.
We'd like instead to be able to reuse binary search trees, but in such a way that their height remains logarithmic. The are several ways to do this:
  • AVL trees --- see Programming Assignment Three
  • Red-black trees --- discussed below
  • Splay trees --- self-adjusting trees (possible final project material)
Since the same binary search tree can be represented by binary trees of varying height, there must be someway to transform trees that are imbalanced into ones that are balanced.
Our goal is to reuse the same algorithms for manipulating binary search trees, but in addition, when the tree is changed (i.e. with insert or remove) we apply an additional rebalancing phase. As in:
  Modified-insert:
    0. usual BST insert
    1. rebalance the tree
Of course, this will only be useful if the rebalancing is itself efficient (we'll get back to that).

Before proceeding into further details of how to keep binary search trees balanced, let's explore more thoroughly how we can build new, but similar data structures (for example, red-black trees) from existing ones (i.e. from binary search trees). This is our motivation for introducing inheritance.

Internal and external nodes

Thus far, we have considered only internal tree nodes --- nodes that contain data. We can also consider NULL pointers to be nodes without data (and without children) these are so called external leaf nodes:
       (2)    
      /   \   
   (1)     (5) 
   / \     / \
  x   x  (3)  x
         / \
        x   x

(the x's are external nodes)

Red-black trees

red-black tree is a binary search tree such that each node (internal and external) is assigned a color (either red or black). The coloring of the tree must satisfy the following red-black properties:
  1. Every external leaf (NULL node) is considered to be black.
  2. If a node is red, then both its children are black.
  3. For a given node, the number of black nodes between it and an external leaf is the same regardless of which path is taken.

Red-black trees are well balanced

It can be proven that the height of a red-black tree is never more than 2*lg(n+1) where n is the total number of internal nodes in the tree. Thus, the height is O(lg(n)).
The intuition: By property 2, no two red nodes can be parent and child. This means on any path from root to an external leaf, there are at least as many black nodes as there are red. Property three says that regardless of which path is taken, the same number of black nodes are encountered. So, in the worst-cast, there is a path that is twice as long as the shortest path. So the height of the tree is no worse than twice the height of the shortest path. That's fairly balanced.

Implementing red-black trees


template <class Item, class Key>
class BST {
public:
  // Constructors
  BST();
  BST(const BST<Item,Key>& source); // copy constructor

  // Destructor
  ~BST();
  
  // Constant member functions
  bool isEmpty() const;
  size_t size() const;
  size_t height() const;
  bool search(const Key& k, Item& returnVal) const;

  // Modification member functions
  void operator=(const BST& source);
  bool insert(const Item& v, const Key& k);
  bool remove(const Key& v);
  
protected:
  typedef BinaryTree<pair<Item,Key> > BT;
  BT *root;

  // protected member functions
  Item itemOf(const pair<Item,Key>& ikp) const {return ikp.first;}
  Key keyOf(const pair<Item,Key>& ikp) const {return ikp.second;}
  bool isRightChild(BT *node) const;
  BT *removeNode(BT *node);
  BT *successor(BT *node) const;
  BT *_search(BT *t, const Key& k) const;
  BT *_insert(const pair<Item,Key>& ikp);
  void _remove(BT *node);
};
enum color {RED, BLACK};

template < class Item, class Key >
class RBT : public BST<pair<Item, color>, Key> {
public:
  ...
  bool search(const Key& k, Item& returnVal) const;
  bool insert(const Item& v, const Key& k);
  bool remove(const Key& v);
  
private:
  typedef BinaryTree<pair<pair<Item, color>,Key> > BT;

protected:
  // Protected member functions
  Item itemOf(const pair<pair<Item,color>,Key>& ick) const;
  color colorOf(BT *node) const;
  void setColor(BT *node, color c);
  BT *rotateLeft(BT *node);
  BT *rotateRight(BT *node);
  void fixInsert(BT *node);
  void fixRemove(BT *x, BT *p);
};
template <class Item, class Key>
bool RBT<Item,Key>::insert(const Item& v, const Key& k)
{
  BT *node = _insert(pair<pair<Item,color>,Key>(pair<Item,color>(v, RED), k));
  if (node != NULL)
    fixInsert(node);
  return (node != NULL);
}

Binary search property preserving transformations

rotateLeft(x):

     (x)                   (y)     
     / \          / \     
   'a   (y)      ===>    (x) 'c
        / \            / \
      'b  'c          'a  'b
rotateRight(y):

       (y)                (x)     
       / \                / \         
     (x) 'c      ===>   'a  (y)   
     / \               / \   
   'a  'b                 'b  'c

Restoring red-black properties after insert

New node (other than root) always colored red.
  • If new node also has red parent than we make changes depending on the color of the new nodes' uncle.
  • After making the changes we move up the tree to until repeating the changes if necessary. In the worst-case we hit the root.
  • Otherwise the properties are maintained.

Restoring red-black properties after remove

  • If deleted node was black than property 3 is violated, so we make changes depending on the color of the former node's sibling.
  • After making the changes we move up the tree to until repeating the changes if necessary. In the worst-case we hit the root.
  • Otherwise the properties are maintained.

B.tech | 5th sem paper | CS | TELECOMMUNICATION FUNDAMENTALS (TEF) |


B.tech 3rd Year 5th sem
TELECOMMUNICATION FUNDAMENTALS (TEF) previous year question papers

Dwnload Link 



Fundamentals of Telecommunications



Module One:  The Fundamentals of Telecommunications
We start with the Public Switched Telephone Network, or PSTN for short.  Learn how Plain Old Telephone Service started, why Analog circuits were all the rage in the beginning, and how Digital circuits such as T-1 & T-3 came to dominate trunking between Central Office switches. We'll carefully introduce all the buzzwords and jargon so don't worry, you can master telephony.  We'll explore the structure of the PSTN, including the role of the Incumbent Local Exchange Carriers (ILECS) and their competitors. The role of Wireless Cellular carriers and their networks are explored and a basic "model" of the modern PSTN is developed.
  • Introduction to Telephony
  • The long, long history of telecommunications
  • The Public Switched Telephone Network (PSTN):  Where it came from, and where it's going
  • Who's in charge?  How is the PSTN standardized? We'll look at the groups such as the ITU that are responsible for ensuring telecommunications networks can work together all over the world.
  • Design requirements of the PSTN
  • PSTN equipment
  • What is a Central Office Switch?  What's the difference between a PBX and a Central Office Switch?
  • Connecting phone calls, real life examples
  • What's my number? The concept of "address space" in the PSTN and an introduction to the global dialing plan
Module Two: Signaling & Analog to Digital Conversion
  • Signaling.  We look at why signaling is an important part of the PSTN and explore signaling techniques including DTMF and Signaling System 7 (SS7)
  • ​Real Time, Full Duplex communications, why it was soooo hard to accomplish
  • The nature of sound waves, what we hear and what we speak.  Hint: Teenagers can hear up to 20,000Hz, if you are reading this course outline, you probably can't!(link is external)crying
  • Analog Circuits:  They were easy to build, but not so effective for long distance transmission.  We'll explain what an Analog circuit is and how they work with lots of real world examples.
  • POTS: Plain Old Telephone Service
  • Analog to digital Conversion
  • A quick primer on data terms related to binary information: bits, Bytes, and bits per second explained.
  • Digital Circuits: Why it was so important to develop computer technology to convert Analog voice to digital transmission.
  • How Analog to Digital conversion works and a brief introduction to the world's most famous "codec": G.711
  • Examples of other codecs that can be used to convert analog voice to digital, or binary, format such as G.729, G.722, and other newer codecs
  • Digital codecs that support Video, introduction to H.263/H.264 / MPEG-4 standards
Module Three: Transmission Systems in Telecommunications
  • Analog vs digital circuits revisited
  • Multiplexing: Optimizing the utilization of wires and radio waves
  • FDM: Frequency Division Multiplexing
  • TDM: Time Division Multiplexing
  • Channelized FDM & channelized TDM
  • ​Development of TDM transmission standards
  • Digital Signal Zero DS0​, why is it 64 kbs? (hint: G.711 codec produces 64 kbs as it digitizes a single voice)
  • DS1 & DS3
  • T-1 & T-3
  • Full Duplex transmission requirements
  • Why ISDN: Integrated Services Digital Network was developed
    • ISDN BRI: POTS replacement
    • ISDN PRI: T1 replacement
  • The development of Fiber Optic Cables in the 1990s
  • Optical wavelengths vs radio wavelengths, different frequencies, different medium
  • Wave Division Multiplexing & Dense Wave Division Multiplexing, WDM & DWDM
  • SONET Framing
  • OCx, OC12, OC48, OC192, OC768
  • Fiber to the Premise (FTTP, FTTH): PONs & OE
  • DSL & Cable Modems: Last Mile copper solutions
    • How modems operate
    • DSL: Digital Subscriber Line - utlizing the bandwith capabilites of POTs copper wire to accomplish FDM to the home.
    • How DSL works and its limitations.
    • The role of the DSLAM
    • VDSL2
    • Cable Modem standards, Data Over Cable Service Interface Specification, DOCSIS 3.1
Module Four: The Business of Telecom & Interconnect
We take a few moments to step back from learning the technology of telecommunications and data networking to understand what businesses are involved in the industry and how they interact with government regulators, their customers, and each other.  The purpose of this module is to give everyone a "big picture" view of how the telecom industry operates. This knowledge is extremely useful as it helps you understand how companies such as wireless carriers, local exchange carriers, and telecom equipment vendors all operate.
  • The two giants: AT&T & Verizon, From Divestiture to consolidation, the long strange journey of the regional carriers
  • Other regional and local carriers in the US
  • International carriers and national carriers overseas
  • Canadian Telecom landscape
  • How the PSTN Switching hierarchy was designed and why it was so important in its day
  • "Last Mile, copper vs fiber"  The competitive role of regional fiber optic cable "rings" another other topologies.  Understanding the CLEC vs ILEC
  • The wireless carriers, overview of the major cellular voice and data providers and a brief overview of the technologies deployed such as cellular voice services & LTE
Module Five: Wireless
Many people find wireless services extremely confusing.  We breakdown how wireless networks are deigned to operate and provide you with a clear understanding of the differences between the WiFi service offered at the local coffee shop and modern voice (cellular) and data networks that have come to dominate telecommunications in the 21st century.
  • Introduction to Wireless concepts
  • Radio transceivers, half duplex analog, and the limitation of distance
  • What are radio waves exactly?  The electromagnetic spectrum explained.
  • The important role of the FCC and how baby monitors changed the world!surprise
  • The first cellular networks and the technologies that made early Analog cell services possible
  • Why unencrypted analog cellular phones desperately needed an upgrade
  • The "second generation" digital cellular networks of the 1990s and an overview of their technology standards
  • The need for better digital data wireless services in the 1990s.  Digital Cellular for voice and digital cellular for (very slow!) data in the 90s & early 00's
  • FDMA, TDMA, CDMA, OFDM all explained and lots of examples to help you understand how second generation digital wireless networks oice were designed
  • 3rd Generation Wireless: The focus begins to shift from voice to digital wireless data, but this is only the beginning!wink
  • 3G technology standards explained: UMTS, HSPA, 1X & more
  • 4G:  The modern era in wireless has arrived.  Understanding LTE & the other standards that were deployed including HSPA+, WiMAX / WiMAX 2 IEEE 802.16m,  
  • LTE + Simultaneous voice 
  • VoLTE:  The future of VoIP and LTE
  • LTE-Advanced
  • Satellites: what are the options & why couldn't they be used instead of terrestrial radio towers?
  • Wireless LANs
  • ​WiFi & the IEEE 802.11 standards, building modern WiFi networks
  • The future of WiFi 
Module Six: Data Networking LANs & WANs
​We begin module five with a transition from the world of modern telephony, to the concepts at the core of enterprise and carrier data networks.  These Local Area Networks (LANs) and Wide Array Networks (WANs) form the foundation for all modern IT departments.  In module five and beyond we build an understanding of key networking concepts and real world technologies that you will find at the heart of every business or government network.
  • What is "Data"?
  • The concept of Bandwidth
  • Decimal, Binary, & Hex, why we use different numbering systems in data communications
    • Examples of Dec / bin / Hex conversions
  • bits and Bytes
  • Representing information in binary formats, ASCII, Unicode & more
  • Network infrastructure
    • Copper wires
    • Fiber Optic Cables
    • Wireless radio frequencies
  • Data transmission options
  • How can we share the data network infrastruture
    • First In First Out (FIFO)
    • Break it into circuits
    • Use Packets to allow for "reasonable" sharing of the infrastructure: Hint - we use packets!
    • Packets vs Frames
  • Example of Ethernet addressing using MAC and IP addressing
Module Seven: Local Area Networks
In this module we get down to practical, real world examples of the technologies and equipment you will encounter in a modern corporate LAN
  • What is a Local Area Network?
  • Connecting laptops, desktops, tablets & more to company file servers, printers, storage servers & other essential services
  • Introduction to LAN equipment such as servers, Ethernet switches, routers, and firewalls
  • Role of Ethernet and TCP/IP in all modern LANs
  • Examples of real world technologies for LANs
    • Introduction to Ethernet
    • Ethernet cables, Cat 5, Cat 6, T-568B
    • Ethernet hubs, why they were replaced with Ethernet Switches
Module Eight: Understanding Networking Theory & Concepts
In module eight we take a step back from looking at real world LANs and examine the core theory concepts of how data networks are designed.  This module gives us a chance to build a critical set of skills that will make it easier to figure out how modern LANs and WANs operate and give us the skills we need to integrate future technologies into our networks.  In this module we start with an exploration of the OSI model.  The Open Systems Interconnect model provides a valuable framework for people to understand data networking concepts, and to quickly compare different networking technologies.  We explore what is meant by "Layer" and the purpose of each of the seven layers in the model.  We then compare the OSI model to "real world" standards such as Ethernet, TCP/IP, VoIP, and IPsec, SSL, TLS VPNs.
  • The OSI Model: Why it is important and how to remember the names of the seven layers
  • The seven layers explained.
  • Physical Layer, example IEEE 802.3
  • Data Link Layer: example MAC
  • Network Layer: example IP Addresses
  • Transport Layer: examples TCP / UDP
  • Session Layer: examples HTTP, SIP
  • Presentation Layer: examples codecs, ASCII
  • Application Layer: example HTML
Module Nine: Ethernet IEEE 802.x
  • Ethernet IEEE 802 (bonus info: committee first met in Feb 1980, hence "80" "02"wink) standards
  • Ethernet over Fiber Optic Cables
  • Wireless Ethernet, otherwise known as "WiFi"
  • Ethernet hubs vs switches
  • NIC
  • Ethernet addressing: MAC
  • 48 bit vs 63 bit address space
  • The Ethernet header
    • MAC Address
    • Type 
    • VLAN/Prioritization
  • ​​Ethernet Prioritization
  • VLAN explained
Module Ten: TCP/IP Fundamentals & the role Routers play in all modern LANs & WANs
  • How TCP/IP fits into the LAN picture
  • What is TCP/IP
  • IP Addresses, the key to all LANs (and WANs, and of course the largest WAN of all, The Internet!)surprise
  • IPv4 vs IPv6
  • Subnets
  • Private RFC 1918 address
  • IP routers: They are not as complicated as you think!  Just remember one simple sentence: "Routers route IP packets between IP subnets!"
  • Network Address Translation: NAT
  • Basics of DNS, DHCP & ICMP
  • The importance of TCP
  • TCP vs UDP, why do we need UDP?
Module Eleven: Wide Area Networks & Multi-Protocol Label Switching: MPLS
  • LAN distance limitations
  • TCP/IP crosses the LAN/WAN divide
  • The Router: shifting IP packets from one underlying Layer 1/2 technology to another
  • WAN technologies
  • ATM & Frame Relay
  • MPLS Overview
  • Understanding the relationship between MPLS & IP / Ethernet
  • MPLS Quality of Service, integration with DiffServ
  • MPLS VPNs
  • MPLS for Service Integration
  • MPLS Traffic Aggregation
Module Twelve: Understanding The Internet
The Internet is the defining creation of our times.  It is built on the concepts we covered in this class.  The Internet is a collection of many individual WANs, built entirely on IP.  In this module we step back and explore the core concepts of The Internet and consider future developments.
  • The history of The Internet
  • The role of standards bodies such as the IETF and IANA
  • The creation of HTML and the World Wide Web
  • How the Domain Name System works
  • Overview of HTML & changes coming in HTML5
  • Introduction to Voice over IP
  • Virtual Private Networks: VPNs, IPsec & SSL VPN

Don't Forget to Follow us..

B.tech | 5th sem paper | CS | DATA LOGIC DESIGN (DLD) |


B.tech 3rd Year 5th sem
DATA LOGIC DESIGN (DLD) previous year question papers

Download Link 


Digital Logic Design 

Introduction
A digital computer  stores data  in terms of digits (numbers) and proceeds in discrete steps from one state  to the next. The states of a digital computer typically involve binary digits which may take the form of the presence or absence of magnetic markers in a storage medium , on-off switches or relays. In digital computers, even letters, words and whole texts are represented digitally.
Digital Logic is the basis of electronic systems, such as computers and cell phones. Digital Logic is rooted in binary code, a series of zeroes and ones each having an opposite value. This system facilitates the design of electronic circuits that convey information, including logic gates. Digital Logic gate functions include and, or and not. The value system translates input signals into specific output. Digital Logic facilitates computing, robotics and other electronic applications.

Digital Logic Design is foundational to the fields of electrical engineering and computer engineering. Digital Logic designers build complex electronic components that use both electrical and computational characteristics. These characteristics may involve power, current, logical function, protocol and user input. Digital Logic Design is used to develop hardware, such as circuit boards and microchip processors. This hardware processes user input, system protocol and other data in computers, navigational systems, cell phones or other high-tech systems.

Data Representation and Number system 

Numeric systems
The numeric system we use daily is the decimal system, but this system is not convenient for machines since the information is handled codified in the shape of on or off bits; this way of codifying takes us to the necessity of knowing the positional calculation which will allow us to express a number in any base where we need it. Radix number systems
The numeric system we use daily is the decimal system, but this system is not convenient for machines since the information is handled codified in the shape of on or off bits; this way of codifying takes us to the necessity of knowing the positional calculation which will allow us to express a number in any base where we need it.
A base of a number system or radix defines the range of values that a digit may have. 
In the binary system or base 2, there can be only two values for each digit of a number, either a "0" or a "1".
In the octal system or base 8, there can be eight choices for each digit of a number:
"0", "1", "2", "3", "4", "5", "6", "7".
In the decimal system or base 10, there are ten different values for each digit of a number:
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9".
In the hexadecimal system, we allow 16 values for each digit of a number:
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", and "F".
Where “A” stands for 10, “B” for 11 and so on.


B.tech | 5th sem notes | CS | OPERATING SYSTEM (OS) |


B.tech 3rd Year 5th sem
OPERATING SYSTEM (OS) previous year question papers

Download Link 


Operating System (OS)

An operating system (OS) is the program that, after being initially loaded into the computer by a boot program, manages all the other programs in a computer. The other programs are called applications or application programs. The application programs make use of the operating system by making requests for services through a defined application program interface (API). In addition, users can interact directly with the operating system through a user interface such as a command line or a graphical user interface (GUI).
An operating system performs these services for applications:
  • In a multitasking operating system where multiple programs can be running at the same time, the operating system determines which applications should run in what order and how much time should be allowed for each application before giving another application a turn.
  • It manages the sharing of internal memory among multiple applications.
  • It handles input and output to and from attached hardware devices, such as hard disks, printers, and dial-up ports.
  • It sends messages to each application or interactive user (or to a system operator) about the status of operation and any errors that may have occurred.
  • It can offload the management of what are called batch jobs (for example, printing) so that the initiating application is freed from this work.
  • On computers that can provide parallel processing, an operating system can manage how to divide the program so that it runs on more than one processor at a time.
All major computer platforms (hardware and software) require and sometimes include an operating system, and operating systems must be developed with different features to meet the specific needs of various form factors.
Common desktop operating systems:
Windows is Microsoft’s flagship operating system, the de facto standard for home and business computers. Introduced in 1985, the GUI-based OS has been released in many versions since then. The user-friendly Windows 95 was largely responsible for the rapid development of personal computing.
Mac OS is the operating system for Apple's Macintosh line of personal computers and workstations.
Linux is a Unix-like operating system that was designed to provide personal computer users a free or very low-cost alternative. Linux has a reputation as a very efficient and fast-performing system. 
Windows operating systems have long dominated the market and continue to do so. As of August 2016, Windows systems had a market share of over 85 percent. In contrast, Mac OS was at a little over 6 percent and Linux was just over 2 percent. Nevertheless, Windows is losing market share from a long-held 90 percent and higher.
A mobile OS allows smartphones, tablet PCs and other mobile devices to run applications and programs. Mobile operating systems include Apple iOS, Google Android, BlackBerry OS and Windows 10 Mobile. 
An embedded operating system is specialized for use in the computers built into larger systems, such as cars, traffic lights, digital televisions, ATMs, airplane controls, point of sale (POS) terminals, digital cameras, GPS navigation systems, elevators, digital media receivers and smart meters.