<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1103220104600298126</id><updated>2022-04-30T15:38:17.422+05:30</updated><category term="Travel"/><category term="Technology"/><category term="automata theory-theory of computation"/><category term="binary search"/><category term="dynamic programming"/><category term="algorithm"/><category term="8085 programming"/><category term="c programming"/><category term="Education"/><category term="data structure"/><category term="SQL"/><category term="digital electronics"/><category term="computer networking"/><category term="discrete mathematics"/><category term="heap"/><category term="basic electrical engineering"/><category term="competitive programming"/><category term="engineering mechanics"/><category term="operating system"/><category term="stack"/><category term="OOP"/><category term="coding"/><category term="graph theory"/><category term="microprocessor"/><category term="programming"/><category term="sorting"/><category term="BYTES AND EXPLANATION OF ALL MNEMONICS/INSTRUCTIONS OF 8085 PROGRAMMING"/><category term="C++"/><category term="DBMS"/><category term="Debug"/><category term="ER diagram"/><category term="Forouzan"/><category term="GDB"/><category term="GNU Debugger"/><category term="How to use React Redux Connect"/><category term="Linux"/><category term="MERN"/><category term="OPCODE"/><category term="Peterson&#39;s solution"/><category term="Ramesh gaonkar solution"/><category term="React"/><category term="React Redux Connect"/><category term="SOLUTION OF CHAPTER 6 RAMESH GAONKAR"/><category term="What is react"/><category term="What is react redux"/><category term="What is react redux connect"/><category term="XOR"/><category term="boolean algebra solution of morris mano"/><category term="bubble sort"/><category term="ceil and floor function"/><category term="chapter 3 morris mano solution"/><category term="chapter19"/><category term="characteristic table of different flip flop"/><category term="circuits and switching"/><category term="compasrison of sorting algorithms"/><category term="computer science"/><category term="cpp"/><category term="data structure and algorithm"/><category term="decimal to roman in c upto 1000000000"/><category term="delete an element in queue"/><category term="deletion from middle of a queue in c"/><category term="design of up down counter to count from 0 to 9 and 9 to 0"/><category term="even array"/><category term="excitation table of different flip flop"/><category term="fibonacci numbers"/><category term="first year btech"/><category term="fourier transform"/><category term="frequency sorting"/><category term="friction"/><category term="functions"/><category term="how to convert decimal to roman in cpp upto 10000000000"/><category term="how to sort a set of number in terms of frequency"/><category term="how todesign a traffic light system using d flip flop"/><category term="implementation of queue in c"/><category term="implementation of stack using queue in c"/><category term="insert an element in queue"/><category term="insert and delete middle of stack"/><category term="insertion in middle of queue"/><category term="insertion sort"/><category term="introduction to 8085 instructions"/><category term="java"/><category term="k closest number"/><category term="k most frequent numbers"/><category term="k th smallest element"/><category term="kinematics of particles"/><category term="kth largest element"/><category term="logic and proofs"/><category term="logic and proofs important points"/><category term="logic gates"/><category term="map"/><category term="matrices"/><category term="maxheap"/><category term="microprocessor viva questions"/><category term="minheap"/><category term="moore machine design"/><category term="morris mano"/><category term="morris mano boolean algebra solution"/><category term="morris mano chapter 3 solution"/><category term="morris mano chapter 4 solution"/><category term="network topology"/><category term="notes"/><category term="notes of number theory and cryptography"/><category term="numbers power of two in cpp"/><category term="occurance of a number in array"/><category term="palindrome"/><category term="palindromic substring"/><category term="priority queue"/><category term="process synchronization"/><category term="queue"/><category term="queue in c"/><category term="random number generator"/><category term="react connect"/><category term="redux"/><category term="redux connect"/><category term="rosen&#39;s discrete mathematics"/><category term="rotating a matrix by 90 degree"/><category term="selection sort"/><category term="sequence"/><category term="sets"/><category term="short notes on stack and subroutine"/><category term="shortest path in binary maze"/><category term="signals and data communication"/><category term="solution"/><category term="solution of chapter 9 of Ramesh Gaonkar"/><category term="solution of combinational circuit"/><category term="solution of stacks and subroutine."/><category term="stack implementation"/><category term="sums"/><category term="time complexity"/><category term="truth of different flip flop"/><category term="virtual work"/><category term="web development"/><category term="what is bubble sort"/><category term="what is dehing patkai?"/><category term="what is insertion sort"/><category term="what is mern stack"/><category term="what is quick sort"/><category term="what is selection sort"/><category term="what is stack?"/><category term="what is subroutine"/><category term="what is the fourier transform of 1/√x"/><category term="why dehing patkai is famous for? where dehing patkai is situated"/><title type='text'>CUPLEX2B</title><subtitle type='html'>A blog about Engineering, Technology, Notes. This blog covers solution of important questions, notes and some other technology related articles.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>148</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8767437488344949255</id><published>2022-02-25T12:17:00.009+05:30</published><updated>2022-02-26T13:24:00.202+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer networking"/><title type='text'>Write a Client-Server socket program to implement “TCP client server” architecture. </title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;Write a Client-Server socket program to implement “TCP client server” architecture.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;b&gt;CODE for server side in c++:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt; bits/stdc++.h &amp;gt;&lt;br /&gt;#include &amp;lt; sys/socket.h &amp;gt;&lt;br /&gt;#include &amp;lt; netinet/in.h &amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;#define PORT 8000&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;    int server_fd;&lt;br /&gt;    int nRet=0;&lt;br /&gt;    struct sockaddr_in address;&lt;br /&gt;    int opt = 1;&lt;br /&gt;    int addrlen = sizeof(address);&lt;br /&gt;    char buffer[1024] = {0};&lt;br /&gt;    // Socket creation&lt;br /&gt;    server_fd=socket(AF_INET, SOCK_STREAM,0);&lt;br /&gt;    if (server_fd == 0)&lt;br /&gt;    {&lt;br /&gt;        cout &amp;lt;&amp;lt; &quot;Socket creation failed&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        exit(EXIT_FAILURE);&lt;br /&gt;    }&lt;br /&gt;    /*Initialize environment for sockaddr structure*/&lt;br /&gt;    address.sin_family = AF_INET;&lt;br /&gt;    address.sin_addr.s_addr = INADDR_ANY;&lt;br /&gt;    address.sin_port = htons( PORT );&lt;br /&gt;    // Forcefully attaching socket to the port 8080&lt;br /&gt;    nRet=setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT,&amp;amp;opt, sizeof(opt));&lt;br /&gt;    if (nRet)&lt;br /&gt;    {&lt;br /&gt;        cout &amp;lt;&amp;lt; &quot;setsockopt Failed&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        exit(EXIT_FAILURE);&lt;br /&gt;    }&lt;br /&gt;    /*Bind the socket to local port*/&lt;br /&gt;    nRet=bind(server_fd,(struct sockaddr *)&amp;amp;address,sizeof(address));&lt;br /&gt;    if (nRet &amp;lt; 0)&lt;br /&gt;    {&lt;br /&gt;        cout &amp;lt;&amp;lt; &quot;Failed to bind&quot;  &amp;lt;&amp;lt; endl;&lt;br /&gt;        exit(EXIT_FAILURE);&lt;br /&gt;    }&lt;br /&gt;    //listen request from client&lt;br /&gt;    nRet=listen(server_fd,5);&lt;br /&gt;    if (nRet &amp;lt; 0)&lt;br /&gt;    {&lt;br /&gt;        cout &amp;lt;&amp;lt; &quot;Failed to listen&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        exit(EXIT_FAILURE);&lt;br /&gt;    }&lt;br /&gt;    //accept and process request&lt;br /&gt;    int new_socket=accept(server_fd,(struct sockaddr *)&amp;amp;address,(socklen_t*)&amp;amp;addrlen);&lt;br /&gt;    if (new_socket &amp;lt; 0)&lt;br /&gt;    {&lt;br /&gt;        cout &amp;lt;&amp;lt; &quot;Failed to accept request&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        exit(EXIT_FAILURE);&lt;br /&gt;    }&lt;br /&gt;    //int nread = read( new_socket , buffer, 1024);&lt;br /&gt;    send(new_socket ,&quot;Connection accepted !! Hello from server&quot; , 41 , 0 );&lt;br /&gt;    cout &amp;lt;&amp;lt; &quot;Connection successfull&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;b&gt;CODE for client side in c++:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt;bits/stdc++.h &amp;gt;&lt;br /&gt;#include &amp;lt;sys/socket.h &amp;gt;&lt;br /&gt;#include &amp;lt; arpa/inet.h &amp;gt;&lt;br /&gt;#include &amp;lt; unistd.h &amp;gt;&lt;br /&gt;#define PORT 8080&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;    int sock = 0, valread;&lt;br /&gt;    struct sockaddr_in serv_addr;&lt;br /&gt;    char buffer[1024] = {0};&lt;br /&gt;    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) &amp;lt; 0)&lt;br /&gt;    {&lt;br /&gt;        printf(&quot;\n Socket creation error \n&quot;);&lt;br /&gt;        return -1;&lt;br /&gt;    }&lt;br /&gt;    serv_addr.sin_family = AF_INET;&lt;br /&gt;    serv_addr.sin_port = htons(PORT);&lt;br /&gt;    // Convert IPv4 and IPv6 addresses from text to binary form&lt;br /&gt;    if(inet_pton(AF_INET, &quot;127.0.0.1&quot;, &amp;amp;serv_addr.sin_addr) &amp;lt; =0) &lt;br /&gt;    {&lt;br /&gt;        printf(&quot;\nInvalid address/ Address not supported \n&quot;);&lt;br /&gt;        return -1;&lt;br /&gt;    }&lt;br /&gt;    if (connect(sock, (struct sockaddr *)&amp;amp;serv_addr, sizeof(serv_addr)) &amp;lt; 0)&lt;br /&gt;    {&lt;br /&gt;        printf(&quot;\nConnection Failed \n&quot;);&lt;br /&gt;        return -1;&lt;br /&gt;    }&lt;br /&gt;    valread = read( sock , buffer, 1024);&lt;br /&gt;    printf(&quot;%s\n&quot;,buffer );&lt;br /&gt;    return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjJ-xs9DoTjkMnyvnOyzlZHw9-wHzVy1ptVnlZEbzvTL8JdLFssjCm-HgBpciZco03H-00JWjg6i_6ccmZNB2fnzQOxPO-23Pvtf-Xao1FCNID29nYXj1LYLAL4G4fInB6DeQOeZboW_eOMJQABKta37ziWa1-0ogmDDGa9VJsD-66IHspgmxuTgS1I=s1097&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;327&quot; data-original-width=&quot;1097&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjJ-xs9DoTjkMnyvnOyzlZHw9-wHzVy1ptVnlZEbzvTL8JdLFssjCm-HgBpciZco03H-00JWjg6i_6ccmZNB2fnzQOxPO-23Pvtf-Xao1FCNID29nYXj1LYLAL4G4fInB6DeQOeZboW_eOMJQABKta37ziWa1-0ogmDDGa9VJsD-66IHspgmxuTgS1I=s16000&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjfYuaaGbuEdqwLchfoRon9D-iXVOJNTcxXY7k8ivcNjPK2WwsUI64lWcLfnom57W1xLitQELOlK8mWYsc0ilh7BcAWxRcvtDY0S-4o8u1e53B1GtAKqQ8-x4r8EVag2-EqSUM5JNlraAXRiP006qjuDIa1m7f_9el5AbvtkgwzIx2s7CGR0XHIeDQX=s1103&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;245&quot; data-original-width=&quot;1103&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjfYuaaGbuEdqwLchfoRon9D-iXVOJNTcxXY7k8ivcNjPK2WwsUI64lWcLfnom57W1xLitQELOlK8mWYsc0ilh7BcAWxRcvtDY0S-4o8u1e53B1GtAKqQ8-x4r8EVag2-EqSUM5JNlraAXRiP006qjuDIa1m7f_9el5AbvtkgwzIx2s7CGR0XHIeDQX=s16000&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8767437488344949255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/02/write-client-server-socket-program-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8767437488344949255'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8767437488344949255'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/02/write-client-server-socket-program-to.html' title='Write a Client-Server socket program to implement “TCP client server” architecture. '/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjJ-xs9DoTjkMnyvnOyzlZHw9-wHzVy1ptVnlZEbzvTL8JdLFssjCm-HgBpciZco03H-00JWjg6i_6ccmZNB2fnzQOxPO-23Pvtf-Xao1FCNID29nYXj1LYLAL4G4fInB6DeQOeZboW_eOMJQABKta37ziWa1-0ogmDDGa9VJsD-66IHspgmxuTgS1I=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8053019295401091538</id><published>2022-01-01T18:28:00.005+05:30</published><updated>2022-02-25T16:01:01.824+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Use the following customer table and write the SQL query to:</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;i&gt;Please feel free to suggest any edits....&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;Use the following customer table and write the SQL query to:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;i) Find any values that start with &quot;a&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;ii) Find any values that end with &quot;a&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;iii) Find any values that have &quot;or&quot; in any position.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;iv) Find any values that have &quot;r&quot; in the second position.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;&quot;&gt;v) Find any values that start with &quot;a&quot; and are at least 2 characters in Length.&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;vi) Find any values that start with &quot;a&quot; and end with &quot;e&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-s-teab_7uPs/YdBOfFtpYYI/AAAAAAAAACY/qi3j2hKSnbgbgK81Yb-H9xLw5Gd6Vq_4wCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;860&quot; data-original-width=&quot;975&quot; height=&quot;565&quot; src=&quot;https://lh3.googleusercontent.com/-s-teab_7uPs/YdBOfFtpYYI/AAAAAAAAACY/qi3j2hKSnbgbgK81Yb-H9xLw5Gd6Vq_4wCNcBGAsYHQ/w640-h565/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;create table customers(&lt;br /&gt;  customerId int,&lt;br /&gt;  customerName varchar(255),&lt;br /&gt;  contactName varchar(255),&lt;br /&gt;  address varchar(255),&lt;br /&gt;  city varchar(255),&lt;br /&gt;  postalCode varchar(255),&lt;br /&gt;  country varchar(255)&lt;br /&gt;  );&lt;br /&gt;insert into customers values (1,&quot;alfreds futterkiste&quot;,&quot;maria anders&quot;,&quot;obere str. 57&quot;,&quot;berlin&quot;,&quot;12209&quot;,&quot;germany&quot;),&lt;br /&gt;  (2,&quot;ana trujillo emparedadosy helados&quot;,&quot;ana trujillo&quot;,&quot;avda. de la constitucion 2222&quot;,&quot;mexico d.f.&quot;,&quot;5021&quot;,&quot;mexico&quot;),&lt;br /&gt;  (3,&quot;antonio moreno taqueria&quot;,&quot;antonio moreno&quot;,&quot;mataderos 2312&quot;,&quot;mexico d.f.&quot;,&quot;5023&quot;,&quot;mexico&quot;),&lt;br /&gt;  (4,&quot;around the horn&quot;,&quot;thomas hardy&quot;,&quot;120 hanover sq.&quot;,&quot;london&quot;,&quot;wa11dp&quot;,&quot;uk&quot;),&lt;br /&gt;  (5,&quot;berglunds snabbkop&quot;,&quot;christina berglund&quot;,&quot;berguvsvagen 8&quot;,&quot;lulea&quot;,&quot;s-95822&quot;,&quot;sweden&quot;),&lt;br /&gt;  (6,&quot;blauer see delikatessen&quot;,&quot;hanna moos&quot;,&quot;forsterstr. 57&quot;,&quot;mannheim&quot;,&quot;68306&quot;,&quot;germany&quot;),&lt;br /&gt;  (7,&quot;blondel pere et fils&quot;,&quot;frederique citeaux&quot;,&quot;24, place kleber&quot;,&quot;strasbourg&quot;,&quot;67000&quot;,&quot;france&quot;),&lt;br /&gt;  (8,&quot;bolido comidas preparadas&quot;,&quot;martin sommer&quot;,&quot;c/araquil,67&quot;,&quot;madrid&quot;,&quot;28023&quot;,&quot;spain&quot;),&lt;br /&gt;  (9,&quot;bon app&#39;&quot;,&quot;laurence lebihans&quot;,&quot;12,rue des bouchers&quot;,&quot;marseille&quot;,&quot;13008&quot;,&quot;france&quot;),&lt;br /&gt;  (10,&quot;bottom-dollar marketse&quot;,&quot;elizabeth lincoln&quot;,&quot;23 tsawassen blyd&quot;,&quot;tsawssen&quot;,&quot;t2f8m4&quot;,&quot;canada&quot;),&lt;br /&gt;  (11,&quot;b&#39;s beverages&quot;,&quot;victoria ashworth&quot;,&quot;fauntleroy circus&quot;,&quot;london&quot;,&quot;ec25nt&quot;,&quot;uk&quot;),&lt;br /&gt;  (12,&quot;cactus comidas parallevar&quot;,&quot;patricio simpson&quot;,&quot;cerrito 333&quot;,&quot;buenos aires&quot;,&quot;1010&quot;,&quot;argentina&quot;),&lt;br /&gt;  (13, &quot;centro comercial moctezuma&quot;,&quot;francisco chang&quot;,&quot;sierras de granada 9993&quot;,&quot;mexico d.f.&quot;,&quot;5022&quot;,&quot;mexico&quot;),&lt;br /&gt;  (14,&quot;chop-suey chinese&quot;,&quot;yang wang&quot;,&quot;haupstr. 29&quot;,&quot;bern&quot;,&quot;3012&quot;,&quot;switzerland&quot;),&lt;br /&gt;  (15,&quot;comercio mineiro&quot;,&quot;pedro afonso&quot;,&quot;av. dos lusiadas,23&quot;,&quot;sao paulo&quot;,&quot;05432043&quot;,&quot;brazil&quot;),&lt;br /&gt;  (16,&quot;consolidated holdings&quot;,&quot;elizabeth brown&quot;,&quot;berkeley gardens 12 brewery&quot;,&quot;london&quot;,&quot;wx16lt&quot;,&quot;uk&quot;),&lt;br /&gt;  (17,&quot;drachenblut delikatessend&quot;,&quot;sven ottlieb&quot;,&quot;waiserweg 21&quot;,&quot;aachen&quot;,&quot;52066&quot;,&quot;germany&quot;),&lt;br /&gt;  (18,&quot;du monde entier&quot;,&quot;janine labrune&quot;,&quot;67, rue des cinquante otages&quot;,&quot;nantes&quot;,&quot;44000&quot;,&quot;france&quot;),&lt;br /&gt;  (19,&quot;eastern connection&quot;,&quot;ann devon&quot;,&quot;35 king george&quot;,&quot;london&quot;,&quot;wx36fw&quot;,&quot;uk&quot;),&lt;br /&gt;  (20,&quot;ernst handel&quot;,&quot;roland mendel&quot;,&quot;kirchgasse 6&quot;,&quot;graz&quot;,&quot;8010&quot;,&quot;austria&quot;);&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;i) Find any values that start with &quot;a&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;a%&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-eEbbleGFI-I/YdBOxc877XI/AAAAAAAAACg/RWfrVf37YmgEV2spvRvqV2oCoUQs-MKkgCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;314&quot; data-original-width=&quot;975&quot; height=&quot;206&quot; src=&quot;https://lh3.googleusercontent.com/-eEbbleGFI-I/YdBOxc877XI/AAAAAAAAACg/RWfrVf37YmgEV2spvRvqV2oCoUQs-MKkgCNcBGAsYHQ/w640-h206/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;ii) Find any values that end with &quot;a&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;%a&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-FpEa5liAgQU/YdBO5MOqgfI/AAAAAAAAACk/ET9jyQg0tgQ3oJJulJ6-g2gqaCBFErDKACNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;300&quot; data-original-width=&quot;975&quot; height=&quot;196&quot; src=&quot;https://lh3.googleusercontent.com/-FpEa5liAgQU/YdBO5MOqgfI/AAAAAAAAACk/ET9jyQg0tgQ3oJJulJ6-g2gqaCBFErDKACNcBGAsYHQ/w640-h196/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;iii) Find any values that have &quot;or&quot; in any position.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;%or%&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-Kv-_d6nGbCQ/YdBPAGTbdjI/AAAAAAAAACo/KIt1ER_nmTkp-jbAr2paZTdgr4OeO4aaQCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;326&quot; data-original-width=&quot;975&quot; height=&quot;214&quot; src=&quot;https://lh3.googleusercontent.com/-Kv-_d6nGbCQ/YdBPAGTbdjI/AAAAAAAAACo/KIt1ER_nmTkp-jbAr2paZTdgr4OeO4aaQCNcBGAsYHQ/w640-h214/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;iv) Find any values that have &quot;r&quot; in the second position.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;_r%&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-ZSC88q_xcl0/YdBPJY9fa5I/AAAAAAAAAC0/aCyBp3fIIZQg-j69pEhLDz1t4vX01JkEgCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;407&quot; data-original-width=&quot;975&quot; height=&quot;268&quot; src=&quot;https://lh3.googleusercontent.com/-ZSC88q_xcl0/YdBPJY9fa5I/AAAAAAAAAC0/aCyBp3fIIZQg-j69pEhLDz1t4vX01JkEgCNcBGAsYHQ/w640-h268/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;v) Find any values that start with &quot;a&quot; and are at least 2 characters in Length.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;a_%&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-pQ3zbY61QwY/YdBPRR1U-TI/AAAAAAAAAC8/r1i_Acuk_tQN6Clg_vommAxK2LQbzynowCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;323&quot; data-original-width=&quot;975&quot; height=&quot;212&quot; src=&quot;https://lh3.googleusercontent.com/-pQ3zbY61QwY/YdBPRR1U-TI/AAAAAAAAAC8/r1i_Acuk_tQN6Clg_vommAxK2LQbzynowCNcBGAsYHQ/w640-h212/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;&quot;&gt;vi) Find any values that start with &quot;a&quot; and end with &quot;e&quot;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;select * from customers where customerName like &#39;a%e&#39;;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-LeWzkzk1xiA/YdBPaEzW1vI/AAAAAAAAADE/t2ZHY5GFrowpVXrOsuF4SOaUMSpFCLqywCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;331&quot; data-original-width=&quot;915&quot; height=&quot;232&quot; src=&quot;https://lh3.googleusercontent.com/-LeWzkzk1xiA/YdBPaEzW1vI/AAAAAAAAADE/t2ZHY5GFrowpVXrOsuF4SOaUMSpFCLqywCNcBGAsYHQ/w640-h232/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8053019295401091538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write_14.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8053019295401091538'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8053019295401091538'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write_14.html' title='Use the following customer table and write the SQL query to:'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-s-teab_7uPs/YdBOfFtpYYI/AAAAAAAAACY/qi3j2hKSnbgbgK81Yb-H9xLw5Gd6Vq_4wCNcBGAsYHQ/s72-w640-h565-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8496961897450913771</id><published>2022-01-01T18:19:00.003+05:30</published><updated>2022-02-25T15:18:35.506+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'> Use the following Product table and write the SQL query to find the count , sum and average price.</title><content type='html'>&lt;p&gt;&lt;i&gt;Please feel free to suggest any edits....&lt;/i&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;Use the following Product table and write the SQL query to find the count , sum and average price.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-KW0pw07MoWw/YdBNdG0HpbI/AAAAAAAAACE/DOVfsWtX0kUnTWS1Y7XlXSXMMM3dcSnwQCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;419&quot; data-original-width=&quot;973&quot; height=&quot;276&quot; src=&quot;https://lh3.googleusercontent.com/-KW0pw07MoWw/YdBNdG0HpbI/AAAAAAAAACE/DOVfsWtX0kUnTWS1Y7XlXSXMMM3dcSnwQCNcBGAsYHQ/w640-h276/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;create table product(&lt;br /&gt;  productId int,&lt;br /&gt;  productName varchar(255),&lt;br /&gt;  supplierId int,&lt;br /&gt;  categoryId int,&lt;br /&gt;  unit varchar(255),&lt;br /&gt;  price double&lt;br /&gt;  );&lt;br /&gt;insert into product values&lt;br /&gt;  (1,&quot;chais&quot;,1,1,&quot;10boxes*20bags&quot;,18),&lt;br /&gt;  (2,&quot;chang&quot;,1,1,&quot;24-12 oz bottles&quot;,19),&lt;br /&gt;  (3,&quot;aniseed syrap&quot;,1,2,&quot;12-550ml bottles&quot;,10),&lt;br /&gt;  (4,&quot;chef anton&#39;s cajon seasoning&quot;,2,2,&quot;48-6 oz jars&quot;,22),&lt;br /&gt;  (5,&quot;chef anton&#39;s gumbo mix&quot;,2,2,&quot;36 boxes&quot;,21.35);&lt;br /&gt;select COUNT(price), SUM(price), AVG(price) from product;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-2N9Ydt7cnZM/YdBNjkR55yI/AAAAAAAAACI/XV_LZUJ8I2E7VA4mBGXMwK0D4MV5-N85wCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;327&quot; data-original-width=&quot;975&quot; height=&quot;214&quot; src=&quot;https://lh3.googleusercontent.com/-2N9Ydt7cnZM/YdBNjkR55yI/AAAAAAAAACI/XV_LZUJ8I2E7VA4mBGXMwK0D4MV5-N85wCNcBGAsYHQ/w640-h214/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;                       &lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8496961897450913771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-product-table-and-write.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8496961897450913771'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8496961897450913771'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-product-table-and-write.html' title=' Use the following Product table and write the SQL query to find the count , sum and average price.'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-KW0pw07MoWw/YdBNdG0HpbI/AAAAAAAAACE/DOVfsWtX0kUnTWS1Y7XlXSXMMM3dcSnwQCNcBGAsYHQ/s72-w640-h276-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-4475307221286051296</id><published>2022-01-01T18:12:00.007+05:30</published><updated>2022-02-25T15:19:48.928+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Use the following customer table and write the SQL query to select the first three records from the &quot;Customers&quot; table.</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;Use the following customer table and write the SQL query to select the first three records from the &quot;Customers&quot; table.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-mY9IDILhcrM/YdBMDwgZpeI/AAAAAAAAABQ/UF8wV_9w_BMGxAPfPjx3MuZIw0IXoRYZQCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;860&quot; data-original-width=&quot;975&quot; height=&quot;565&quot; src=&quot;https://lh3.googleusercontent.com/-mY9IDILhcrM/YdBMDwgZpeI/AAAAAAAAABQ/UF8wV_9w_BMGxAPfPjx3MuZIw0IXoRYZQCNcBGAsYHQ/w640-h565/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;create table customers(&lt;br /&gt;customerId int,&lt;br /&gt;customerName varchar(255),&lt;br /&gt;contactName varchar(255),&lt;br /&gt;address varchar(255),&lt;br /&gt;city varchar(255),&lt;br /&gt;postalCode varchar(255),&lt;br /&gt;country varchar(255));&lt;br /&gt;&lt;br /&gt;insert into customers values (1,&quot;alfreds futterkiste&quot;,&quot;maria anders&quot;,&quot;obere str. 57&quot;,&quot;berlin&quot;,&quot;12209&quot;,&quot;germany&quot;),&lt;br /&gt;(2,&quot;ana trujillo emparedadosy helados&quot;,&quot;ana trujillo&quot;,&quot;avda. de la constitucion 2222&quot;,&quot;mexico d.f.&quot;,&quot;5021&quot;,&quot;mexico&quot;),&lt;br /&gt;(3,&quot;antonio moreno taqueria&quot;,&quot;antonio moreno&quot;,&quot;mataderos 2312&quot;,&quot;mexico d.f.&quot;,&quot;5023&quot;,&quot;mexico&quot;),&lt;br /&gt;(4,&quot;around the horn&quot;,&quot;thomas hardy&quot;,&quot;120 hanover sq.&quot;,&quot;london&quot;,&quot;wa11dp&quot;,&quot;uk&quot;),&lt;br /&gt;(5,&quot;berglunds snabbkop&quot;,&quot;christina berglund&quot;,&quot;berguvsvagen 8&quot;,&quot;lulea&quot;,&quot;s-95822&quot;,&quot;sweden&quot;),&lt;br /&gt;(6,&quot;blauer see delikatessen&quot;,&quot;hanna moos&quot;,&quot;forsterstr. 57&quot;,&quot;mannheim&quot;,&quot;68306&quot;,&quot;germany&quot;),&lt;br /&gt;(7,&quot;blondel pere et fils&quot;,&quot;frederique citeaux&quot;,&quot;24, place kleber&quot;,&quot;strasbourg&quot;,&quot;67000&quot;,&quot;france&quot;),&lt;br /&gt;(8,&quot;bolido comidas preparadas&quot;,&quot;martin sommer&quot;,&quot;c/araquil,67&quot;,&quot;madrid&quot;,&quot;28023&quot;,&quot;spain&quot;),&lt;br /&gt;(9,&quot;bon app&#39;&quot;,&quot;laurence lebihans&quot;,&quot;12,rue des bouchers&quot;,&quot;marseille&quot;,&quot;13008&quot;,&quot;france&quot;),&lt;br /&gt;(10,&quot;bottom-dollar marketse&quot;,&quot;elizabeth lincoln&quot;,&quot;23 tsawassen blyd&quot;,&quot;tsawssen&quot;,&quot;t2f8m4&quot;,&quot;canada&quot;),&lt;br /&gt;(11,&quot;b&#39;s beverages&quot;,&quot;victoria ashworth&quot;,&quot;fauntleroy circus&quot;,&quot;london&quot;,&quot;ec25nt&quot;,&quot;uk&quot;),&lt;br /&gt;(12,&quot;cactus comidas parallevar&quot;,&quot;patricio simpson&quot;,&quot;cerrito 333&quot;,&quot;buenos aires&quot;,&quot;1010&quot;,&quot;argentina&quot;),&lt;br /&gt;(13, &quot;centro comercial moctezuma&quot;,&quot;francisco chang&quot;,&quot;sierras de granada 9993&quot;,&quot;mexico d.f.&quot;,&quot;5022&quot;,&quot;mexico&quot;),&lt;br /&gt;(14,&quot;chop-suey chinese&quot;,&quot;yang wang&quot;,&quot;haupstr. 29&quot;,&quot;bern&quot;,&quot;3012&quot;,&quot;switzerland&quot;),&lt;br /&gt;(15,&quot;comercio mineiro&quot;,&quot;pedro afonso&quot;,&quot;av. dos lusiadas,23&quot;,&quot;sao paulo&quot;,&quot;05432043&quot;,&quot;brazil&quot;),&lt;br /&gt;(16,&quot;consolidated holdings&quot;,&quot;elizabeth brown&quot;,&quot;berkeley gardens 12 brewery&quot;,&quot;london&quot;,&quot;wx16lt&quot;,&quot;uk&quot;),&lt;br /&gt;(17,&quot;drachenblut delikatessend&quot;,&quot;sven ottlieb&quot;,&quot;waiserweg 21&quot;,&quot;aachen&quot;,&quot;52066&quot;,&quot;germany&quot;),&lt;br /&gt;(18,&quot;du monde entier&quot;,&quot;janine labrune&quot;,&quot;67, rue des cinquante otages&quot;,&quot;nantes&quot;,&quot;44000&quot;,&quot;france&quot;),&lt;br /&gt;(19,&quot;eastern connection&quot;,&quot;ann devon&quot;,&quot;35 king george&quot;,&quot;london&quot;,&quot;wx36fw&quot;,&quot;uk&quot;),&lt;br /&gt;(20,&quot;ernst handel&quot;,&quot;roland mendel&quot;,&quot;kirchgasse 6&quot;,&quot;graz&quot;,&quot;8010&quot;,&quot;austria&quot;);&lt;br /&gt;&lt;br /&gt;select* from customers order by customerId asc limit 3;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-Se1IiJiZOdI/YdBMMESWVBI/AAAAAAAAABU/HF3u3jAuK3Auplan0hvmr2BuFuoSPe-nACNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;318&quot; data-original-width=&quot;975&quot; height=&quot;208&quot; src=&quot;https://lh3.googleusercontent.com/-Se1IiJiZOdI/YdBMMESWVBI/AAAAAAAAABU/HF3u3jAuK3Auplan0hvmr2BuFuoSPe-nACNcBGAsYHQ/w640-h208/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/4475307221286051296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write_1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4475307221286051296'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4475307221286051296'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write_1.html' title='Use the following customer table and write the SQL query to select the first three records from the &quot;Customers&quot; table.'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-mY9IDILhcrM/YdBMDwgZpeI/AAAAAAAAABQ/UF8wV_9w_BMGxAPfPjx3MuZIw0IXoRYZQCNcBGAsYHQ/s72-w640-h565-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-5348235940722567749</id><published>2022-01-01T18:04:00.004+05:30</published><updated>2022-02-25T15:21:16.849+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'>Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is NOT &quot;Germany&quot; and NOT &quot;USA&quot;.</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is NOT &quot;Germany&quot; and NOT &quot;USA&quot;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-DNgtleCR3K4/YdBJjXLF0vI/AAAAAAAAAAc/WHMSDierigIADE4ufgz7ygstQ9jP-NYhgCNcBGAsYHQ/image.png&quot; style=&quot;font-family: &amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;; margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;860&quot; data-original-width=&quot;975&quot; height=&quot;565&quot; src=&quot;https://lh3.googleusercontent.com/-DNgtleCR3K4/YdBJjXLF0vI/AAAAAAAAAAc/WHMSDierigIADE4ufgz7ygstQ9jP-NYhgCNcBGAsYHQ/w640-h565/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot;&gt;&lt;br /&gt;create table customers(&lt;br /&gt;  customerId int,&lt;br /&gt;  customerName varchar(255),&lt;br /&gt;  contactName varchar(255),&lt;br /&gt;  address varchar(255),&lt;br /&gt;  city varchar(255),&lt;br /&gt;  postalCode varchar(255),&lt;br /&gt;  country varchar(255)&lt;br /&gt;  );&lt;br /&gt;insert into customers values (1,&quot;alfreds futterkiste&quot;,&quot;maria anders&quot;,&quot;obere str. 57&quot;,&quot;berlin&quot;,&quot;12209&quot;,&quot;germany&quot;),&lt;br /&gt;  (2,&quot;ana trujillo emparedadosy helados&quot;,&quot;ana trujillo&quot;,&quot;avda. de la constitucion 2222&quot;,&quot;mexico d.f.&quot;,&quot;5021&quot;,&quot;mexico&quot;),&lt;br /&gt;  (3,&quot;antonio moreno taqueria&quot;,&quot;antonio moreno&quot;,&quot;mataderos 2312&quot;,&quot;mexico d.f.&quot;,&quot;5023&quot;,&quot;mexico&quot;),&lt;br /&gt;  (4,&quot;around the horn&quot;,&quot;thomas hardy&quot;,&quot;120 hanover sq.&quot;,&quot;london&quot;,&quot;wa11dp&quot;,&quot;uk&quot;),&lt;br /&gt;  (5,&quot;berglunds snabbkop&quot;,&quot;christina berglund&quot;,&quot;berguvsvagen 8&quot;,&quot;lulea&quot;,&quot;s-95822&quot;,&quot;sweden&quot;),&lt;br /&gt;  (6,&quot;blauer see delikatessen&quot;,&quot;hanna moos&quot;,&quot;forsterstr. 57&quot;,&quot;mannheim&quot;,&quot;68306&quot;,&quot;germany&quot;),&lt;br /&gt;  (7,&quot;blondel pere et fils&quot;,&quot;frederique citeaux&quot;,&quot;24, place kleber&quot;,&quot;strasbourg&quot;,&quot;67000&quot;,&quot;france&quot;),&lt;br /&gt;  (8,&quot;bolido comidas preparadas&quot;,&quot;martin sommer&quot;,&quot;c/araquil,67&quot;,&quot;madrid&quot;,&quot;28023&quot;,&quot;spain&quot;),&lt;br /&gt;  (9,&quot;bon app&#39;&quot;,&quot;laurence lebihans&quot;,&quot;12,rue des bouchers&quot;,&quot;marseille&quot;,&quot;13008&quot;,&quot;france&quot;),&lt;br /&gt;  (10,&quot;bottom-dollar marketse&quot;,&quot;elizabeth lincoln&quot;,&quot;23 tsawassen blyd&quot;,&quot;tsawssen&quot;,&quot;t2f8m4&quot;,&quot;canada&quot;),&lt;br /&gt;  (11,&quot;b&#39;s beverages&quot;,&quot;victoria ashworth&quot;,&quot;fauntleroy circus&quot;,&quot;london&quot;,&quot;ec25nt&quot;,&quot;uk&quot;),&lt;br /&gt;  (12,&quot;cactus comidas parallevar&quot;,&quot;patricio simpson&quot;,&quot;cerrito 333&quot;,&quot;buenos aires&quot;,&quot;1010&quot;,&quot;argentina&quot;),&lt;br /&gt;  (13, &quot;centro comercial moctezuma&quot;,&quot;francisco chang&quot;,&quot;sierras de granada 9993&quot;,&quot;mexico d.f.&quot;,&quot;5022&quot;,&quot;mexico&quot;),&lt;br /&gt;  (14,&quot;chop-suey chinese&quot;,&quot;yang wang&quot;,&quot;haupstr. 29&quot;,&quot;bern&quot;,&quot;3012&quot;,&quot;switzerland&quot;),&lt;br /&gt;  (15,&quot;comercio mineiro&quot;,&quot;pedro afonso&quot;,&quot;av. dos lusiadas,23&quot;,&quot;sao paulo&quot;,&quot;05432043&quot;,&quot;brazil&quot;),&lt;br /&gt;  (16,&quot;consolidated holdings&quot;,&quot;elizabeth brown&quot;,&quot;berkeley gardens 12 brewery&quot;,&quot;london&quot;,&quot;wx16lt&quot;,&quot;uk&quot;),&lt;br /&gt;  (17,&quot;drachenblut delikatessend&quot;,&quot;sven ottlieb&quot;,&quot;waiserweg 21&quot;,&quot;aachen&quot;,&quot;52066&quot;,&quot;germany&quot;),&lt;br /&gt;  (18,&quot;du monde entier&quot;,&quot;janine labrune&quot;,&quot;67, rue des cinquante otages&quot;,&quot;nantes&quot;,&quot;44000&quot;,&quot;france&quot;),&lt;br /&gt;  (19,&quot;eastern connection&quot;,&quot;ann devon&quot;,&quot;35 king george&quot;,&quot;london&quot;,&quot;wx36fw&quot;,&quot;uk&quot;),&lt;br /&gt;  (20,&quot;ernst handel&quot;,&quot;roland mendel&quot;,&quot;kirchgasse 6&quot;,&quot;graz&quot;,&quot;8010&quot;,&quot;austria&quot;);&lt;br /&gt;&lt;br /&gt;select * from customers where not country=&quot;germany&quot; and not country=&quot;usa&quot;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-mL8IGIqPbaI/YdBJ6GW46aI/AAAAAAAAAAk/W02yIb5cCbsks5qsebCVp9EIwhsCu1LOQCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;596&quot; data-original-width=&quot;975&quot; height=&quot;392&quot; src=&quot;https://lh3.googleusercontent.com/-mL8IGIqPbaI/YdBJ6GW46aI/AAAAAAAAAAk/W02yIb5cCbsks5qsebCVp9EIwhsCu1LOQCNcBGAsYHQ/w640-h392/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/5348235940722567749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/5348235940722567749'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/5348235940722567749'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/01/use-following-customer-table-and-write.html' title='Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is NOT &quot;Germany&quot; and NOT &quot;USA&quot;.'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-DNgtleCR3K4/YdBJjXLF0vI/AAAAAAAAAAc/WHMSDierigIADE4ufgz7ygstQ9jP-NYhgCNcBGAsYHQ/s72-w640-h565-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-507978314543642624</id><published>2022-01-01T17:59:00.007+05:30</published><updated>2022-02-25T15:22:50.059+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL"/><title type='text'> Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is &quot;Germany&quot; AND the city must be &quot;Berlin&quot; OR &quot;München&quot;.</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt;&quot;&gt;1. Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is &quot;Germany&quot; AND the city must be &quot;Berlin&quot; OR &quot;München&quot;.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Segoe UI&amp;quot;, &amp;quot;sans-serif&amp;quot;&quot; style=&quot;font-size: 11pt;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-eyazKw8nnmk/YdBIUh6pJRI/AAAAAAAAAAM/Y0Hva24Vye0-Jdpo0nNPSOsrfVUqmphNwCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;860&quot; data-original-width=&quot;975&quot; height=&quot;1&quot; src=&quot;https://lh3.googleusercontent.com/-eyazKw8nnmk/YdBIUh6pJRI/AAAAAAAAAAM/Y0Hva24Vye0-Jdpo0nNPSOsrfVUqmphNwCNcBGAsYHQ/image.png&quot; width=&quot;1&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-3hh3E9yvBVY/YdBIYNGR6hI/AAAAAAAAAAQ/XTXjqC0ihesczkgyUjgHB6rnX5h7lo6igCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;860&quot; data-original-width=&quot;975&quot; height=&quot;565&quot; src=&quot;https://lh3.googleusercontent.com/-3hh3E9yvBVY/YdBIYNGR6hI/AAAAAAAAAAQ/XTXjqC0ihesczkgyUjgHB6rnX5h7lo6igCNcBGAsYHQ/w640-h565/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-srCwWdBUaKw/YdBMyGQy1MI/AAAAAAAAABs/99MLbU5F5TUENH_833jxkzyLL_pqpdZjQCNcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;381&quot; data-original-width=&quot;975&quot; height=&quot;250&quot; src=&quot;https://lh3.googleusercontent.com/-srCwWdBUaKw/YdBMyGQy1MI/AAAAAAAAABs/99MLbU5F5TUENH_833jxkzyLL_pqpdZjQCNcBGAsYHQ/w640-h250/image.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;code language=&quot;sql&quot;&gt;&lt;br /&gt;  customerId int,&lt;br /&gt;  customerName varchar(255),&lt;br /&gt;  contactName varchar(255),&lt;br /&gt;  address varchar(255),&lt;br /&gt;  city varchar(255),&lt;br /&gt;  postalCode varchar(255),&lt;br /&gt;  country varchar(255)&lt;br /&gt;  );&lt;br /&gt;insert into customers values (1,&quot;alfreds futterkiste&quot;,&quot;maria anders&quot;,&quot;obere str. 57&quot;,&quot;berlin&quot;,&quot;12209&quot;,&quot;germany&quot;),&lt;br /&gt;  (2,&quot;ana trujillo emparedadosy helados&quot;,&quot;ana trujillo&quot;,&quot;avda. de la constitucion 2222&quot;,&quot;mexico d.f.&quot;,&quot;5021&quot;,&quot;mexico&quot;),&lt;br /&gt;  (3,&quot;antonio moreno taqueria&quot;,&quot;antonio moreno&quot;,&quot;mataderos 2312&quot;,&quot;mexico d.f.&quot;,&quot;5023&quot;,&quot;mexico&quot;),&lt;br /&gt;  (4,&quot;around the horn&quot;,&quot;thomas hardy&quot;,&quot;120 hanover sq.&quot;,&quot;london&quot;,&quot;wa11dp&quot;,&quot;uk&quot;),&lt;br /&gt;  (5,&quot;berglunds snabbkop&quot;,&quot;christina berglund&quot;,&quot;berguvsvagen 8&quot;,&quot;lulea&quot;,&quot;s-95822&quot;,&quot;sweden&quot;),&lt;br /&gt;  (6,&quot;blauer see delikatessen&quot;,&quot;hanna moos&quot;,&quot;forsterstr. 57&quot;,&quot;mannheim&quot;,&quot;68306&quot;,&quot;germany&quot;),&lt;br /&gt;  (7,&quot;blondel pere et fils&quot;,&quot;frederique citeaux&quot;,&quot;24, place kleber&quot;,&quot;strasbourg&quot;,&quot;67000&quot;,&quot;france&quot;),&lt;br /&gt;  (8,&quot;bolido comidas preparadas&quot;,&quot;martin sommer&quot;,&quot;c/araquil,67&quot;,&quot;madrid&quot;,&quot;28023&quot;,&quot;spain&quot;),&lt;br /&gt;  (9,&quot;bon app&#39;&quot;,&quot;laurence lebihans&quot;,&quot;12,rue des bouchers&quot;,&quot;marseille&quot;,&quot;13008&quot;,&quot;france&quot;),&lt;br /&gt;  (10,&quot;bottom-dollar marketse&quot;,&quot;elizabeth lincoln&quot;,&quot;23 tsawassen blyd&quot;,&quot;tsawssen&quot;,&quot;t2f8m4&quot;,&quot;canada&quot;),&lt;br /&gt;  (11,&quot;b&#39;s beverages&quot;,&quot;victoria ashworth&quot;,&quot;fauntleroy circus&quot;,&quot;london&quot;,&quot;ec25nt&quot;,&quot;uk&quot;),&lt;br /&gt;  (12,&quot;cactus comidas parallevar&quot;,&quot;patricio simpson&quot;,&quot;cerrito 333&quot;,&quot;buenos aires&quot;,&quot;1010&quot;,&quot;argentina&quot;),&lt;br /&gt;  (13, &quot;centro comercial moctezuma&quot;,&quot;francisco chang&quot;,&quot;sierras de granada 9993&quot;,&quot;mexico d.f.&quot;,&quot;5022&quot;,&quot;mexico&quot;),&lt;br /&gt;  (14,&quot;chop-suey chinese&quot;,&quot;yang wang&quot;,&quot;haupstr. 29&quot;,&quot;bern&quot;,&quot;3012&quot;,&quot;switzerland&quot;),&lt;br /&gt;  (15,&quot;comercio mineiro&quot;,&quot;pedro afonso&quot;,&quot;av. dos lusiadas,23&quot;,&quot;sao paulo&quot;,&quot;05432043&quot;,&quot;brazil&quot;),&lt;br /&gt;  (16,&quot;consolidated holdings&quot;,&quot;elizabeth brown&quot;,&quot;berkeley gardens 12 brewery&quot;,&quot;london&quot;,&quot;wx16lt&quot;,&quot;uk&quot;),&lt;br /&gt;  (17,&quot;drachenblut delikatessend&quot;,&quot;sven ottlieb&quot;,&quot;waiserweg 21&quot;,&quot;aachen&quot;,&quot;52066&quot;,&quot;germany&quot;),&lt;br /&gt;  (18,&quot;du monde entier&quot;,&quot;janine labrune&quot;,&quot;67, rue des cinquante otages&quot;,&quot;nantes&quot;,&quot;44000&quot;,&quot;france&quot;),&lt;br /&gt;  (19,&quot;eastern connection&quot;,&quot;ann devon&quot;,&quot;35 king george&quot;,&quot;london&quot;,&quot;wx36fw&quot;,&quot;uk&quot;),&lt;br /&gt;  (20,&quot;ernst handel&quot;,&quot;roland mendel&quot;,&quot;kirchgasse 6&quot;,&quot;graz&quot;,&quot;8010&quot;,&quot;austria&quot;);&lt;br /&gt;&lt;br /&gt;select* from customers where country=&quot;germany&quot; and (city=&quot;berlin&quot; or city=&quot;munchen&quot;);&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/507978314543642624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2022/01/use-table-1-ie-customer-table-and-write.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/507978314543642624'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/507978314543642624'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2022/01/use-table-1-ie-customer-table-and-write.html' title=' Use the following customer table and write the SQL query to select all fields from &quot;Customers&quot; where the country is &quot;Germany&quot; AND the city must be &quot;Berlin&quot; OR &quot;München&quot;.'/><author><name>cuplex2b</name><uri>http://www.blogger.com/profile/14395150307965637250</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-eyazKw8nnmk/YdBIUh6pJRI/AAAAAAAAAAM/Y0Hva24Vye0-Jdpo0nNPSOsrfVUqmphNwCNcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-2398812631944231958</id><published>2021-11-25T20:14:00.003+05:30</published><updated>2022-02-26T13:26:19.031+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer networking"/><title type='text'>Write an “Echo Client” and “Echo Server” using UDP to estimate the round trip Time from client to the server. The server should be such that it can accept Multiple connections at any given time</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;Write an “Echo Client” and “Echo Server” using UDP in Cto estimate the round trip Time from client to the server. The server should be such that it can accept Multiple connections at any given time.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;CODE FOR SERVER:&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;br /&gt;#include &amp;lt; stdio.h &amp;gt;&lt;br /&gt;#include &amp;lt; sys/types.h &amp;gt;&lt;br /&gt;#include &amp;lt; sys/socket.h &amp;gt;&lt;br /&gt;#include &amp;lt; netinet/in.h &amp;gt;&lt;br /&gt;#include &amp;lt; unistd.h &amp;gt;&lt;br /&gt;#include &amp;lt; netdb.h &amp;gt;&lt;br /&gt;#include &amp;lt; string.h &amp;gt;&lt;br /&gt;#include &amp;lt; arpa/inet.h &amp;gt;&lt;br /&gt;#define MAXLINE 1024&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;  int sockfd;&lt;br /&gt;  int n;&lt;br /&gt;  socklen_t len;&lt;br /&gt;  char msg[1024];&lt;br /&gt;  struct sockaddr_in servaddr,cliaddr;&lt;br /&gt;  sockfd=socket(AF_INET,SOCK_DGRAM,0);&lt;br /&gt;  bzero(&amp;servaddr,sizeof(servaddr));&lt;br /&gt;  servaddr.sin_family=AF_INET;&lt;br /&gt;  servaddr.sin_addr.s_addr=INADDR_ANY;&lt;br /&gt;  servaddr.sin_port=htons(5035);&lt;br /&gt;  bind(sockfd,(struct sockaddr*)&amp;servaddr,sizeof(servaddr));&lt;br /&gt;  printf(&quot;\n\n Successfully Binded&quot;);&lt;br /&gt;  printf(&quot;\n\n Listening...&quot;);&lt;br /&gt;  for(;;)&lt;br /&gt;&lt;br /&gt;  {&lt;br /&gt;       printf(&quot;\n &quot;);&lt;br /&gt;       len=sizeof(cliaddr);&lt;br /&gt;       n=recvfrom(sockfd,msg,MAXLINE,0,(struct sockaddr*)&amp;cliaddr,&amp;len);&lt;br /&gt;       printf(&quot;\n Client&#39;s Message : %s\n&quot;,msg);&lt;br /&gt;       if(n &amp;lt; 6)&lt;br /&gt;          perror(&quot;send error&quot;);&lt;br /&gt;       sendto(sockfd,msg,n,0,(struct sockaddr*)&amp;cliaddr,len);&lt;br /&gt;  }&lt;br /&gt;return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;span style=&quot;font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043;&quot;&gt;&lt;span style=&quot;font-size: 14px; letter-spacing: 0.2px;&quot;&gt;CODE FOR CLIENT&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-c&quot;&gt;&lt;br /&gt;#include &amp;lt; stdio.h &amp;gt;&lt;br /&gt;#include &amp;lt; stdlib.h &amp;gt;&lt;br /&gt;#include &amp;lt; sys/types.h &amp;gt;&lt;br /&gt;#include &amp;lt; sys/socket.h &amp;gt;&lt;br /&gt;#include &amp;lt; netinet/in.h &amp;gt;&lt;br /&gt;#include &amp;lt; string.h &amp;gt;&lt;br /&gt;#include &amp;lt; arpa/inet.h &amp;gt;&lt;br /&gt;#include &amp;lt; time.h &amp;gt;&lt;br /&gt;#define MAXLINE 1024&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;  int sockfd;&lt;br /&gt;  int n;&lt;br /&gt;  socklen_t len;&lt;br /&gt;  char sendline[1024],recvline[1024];&lt;br /&gt;  struct sockaddr_in servaddr;&lt;br /&gt;  memset(sendline,&#39; &#39;,sizeof(sendline));&lt;br /&gt;  printf(&quot;\n Enter the message : &quot;);&lt;br /&gt;  gets(sendline);&lt;br /&gt;  sockfd=socket(AF_INET,SOCK_DGRAM,0);&lt;br /&gt;  bzero(&amp;servaddr,sizeof(servaddr));&lt;br /&gt;  servaddr.sin_family=AF_INET;&lt;br /&gt;  servaddr.sin_addr.s_addr=inet_addr(&quot;127.0.0.1&quot;);&lt;br /&gt;  servaddr.sin_port=htons(5035);&lt;br /&gt;  len=sizeof(servaddr);&lt;br /&gt;  clock_t t;&lt;br /&gt;  t=clock();&lt;br /&gt;  sendto(sockfd,sendline,MAXLINE,0,(struct sockaddr*)&amp;servaddr,len);&lt;br /&gt;  n=recvfrom(sockfd,recvline,MAXLINE,0,NULL,NULL);&lt;br /&gt;  t=clock()-t;&lt;br /&gt;  double time_taken = ((double)t)/CLOCKS_PER_SEC; &lt;br /&gt;  recvline[n]=0;&lt;br /&gt;  printf(&quot;\n Server&#39;s Echo : %s\n&quot;,recvline);&lt;br /&gt;  printf(&quot;\n Round trip time=%f sec\n\n&quot;,time_taken);&lt;br /&gt;return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-KPxDV33M3WI/YZ-gUbP4ZMI/AAAAAAAABmI/ei_gqB-EpGg1pdxFIWCjCZ1MMMD_H12qQCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;205&quot; data-original-width=&quot;437&quot; height=&quot;150&quot; src=&quot;https://lh3.googleusercontent.com/-KPxDV33M3WI/YZ-gUbP4ZMI/AAAAAAAABmI/ei_gqB-EpGg1pdxFIWCjCZ1MMMD_H12qQCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-F5LNEt7p02A/YZ-gd0Vh_PI/AAAAAAAABmQ/EKpQp3c-M4cjQEOs4fnh0XiId6_VpDJewCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;97&quot; data-original-width=&quot;311&quot; height=&quot;100&quot; src=&quot;https://lh3.googleusercontent.com/-F5LNEt7p02A/YZ-gd0Vh_PI/AAAAAAAABmQ/EKpQp3c-M4cjQEOs4fnh0XiId6_VpDJewCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;span face=&quot;Roboto, Arial, sans-serif&quot; style=&quot;color: #3c4043; font-size: 14px; letter-spacing: 0.2px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/2398812631944231958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/11/write-echo-client-and-echo-server-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2398812631944231958'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2398812631944231958'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/11/write-echo-client-and-echo-server-using.html' title='Write an “Echo Client” and “Echo Server” using UDP to estimate the round trip Time from client to the server. The server should be such that it can accept Multiple connections at any given time'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-KPxDV33M3WI/YZ-gUbP4ZMI/AAAAAAAABmI/ei_gqB-EpGg1pdxFIWCjCZ1MMMD_H12qQCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-28554505757320265</id><published>2021-11-25T11:30:00.000+05:30</published><updated>2021-11-25T11:30:33.297+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBMS"/><category scheme="http://www.blogger.com/atom/ns#" term="ER diagram"/><title type='text'>Consider the E-R diagram in the following Figure  , which models an online bookstore.a. List the entity sets and their primary keys.b. Suppose the bookstore adds music cassettes and compact disks to its collection. The same music item may be present in cassette or compact disk format, with differing prices. Extend the E-R diagram to model this addition, ignoring the effect on shopping baskets.c. Now extend the E-R diagram, using generalization, to model the case where a shopping basket may contain any combination of books, music cassettes, or compact disks.</title><content type='html'>&lt;p&gt;&amp;nbsp;Consider the E-R diagram in the following Figure&amp;nbsp; , which models an online bookstore.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-AhVVhYTnDn0/YZ8b3tRMDhI/AAAAAAAABlw/u5m7MCCDcO8pMPzL1JzTp8TI7EqZG3_5wCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;530&quot; data-original-width=&quot;686&quot; height=&quot;309&quot; src=&quot;https://lh3.googleusercontent.com/-AhVVhYTnDn0/YZ8b3tRMDhI/AAAAAAAABlw/u5m7MCCDcO8pMPzL1JzTp8TI7EqZG3_5wCLcBGAsYHQ/w400-h309/image.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;a. List the entity sets and their primary keys.&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;The entity sets are:&lt;/p&gt;&lt;p&gt;i) Author ( name, address, URL)&lt;/p&gt;&lt;p&gt;ii) Book(year, title, year, ISBN)&lt;/p&gt;&lt;p&gt;iii) Warehouse(code, phone, address)&lt;/p&gt;&lt;p&gt;iv) Publisher(name, address, URL, phone)&lt;/p&gt;&lt;p&gt;v) Shopping Basket(basket ID)&lt;/p&gt;&lt;p&gt;vi) Customer(name, address, phone, email)&lt;/p&gt;&lt;p&gt;b. Suppose the bookstore adds music cassettes and compact disks to its collection. The same music item may be present in cassette or compact disk format, with differing prices. Extend the E-R diagram to model this addition, ignoring the effect on shopping baskets.&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg5jYMugKscquD3XR9JBoTjz8Dh8-E2IAFrbq9Fy7G5jhthQSG6HZ-opeSw3jtUN23-aP2TapOB8BvlBYuDRwwNtrQHsWeQpXtIFQMfsyKktNWaPC7FPwg9iyO9URdYhc7J09ZvHy30adqsM0x6nBX9YZq22LODwNVMz92VRV56RiMQjkzL9evN6K9E=s2048&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;2048&quot; data-original-width=&quot;1531&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg5jYMugKscquD3XR9JBoTjz8Dh8-E2IAFrbq9Fy7G5jhthQSG6HZ-opeSw3jtUN23-aP2TapOB8BvlBYuDRwwNtrQHsWeQpXtIFQMfsyKktNWaPC7FPwg9iyO9URdYhc7J09ZvHy30adqsM0x6nBX9YZq22LODwNVMz92VRV56RiMQjkzL9evN6K9E=w478-h640&quot; width=&quot;478&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;c. Now extend the E-R diagram, using generalization, to model the case where a shopping basket may contain any combination of books, music cassettes, or compact disks.&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjyUmrQJyp6-iW4qhzp9fS7WDZI5KV4dAdtS6Bu3KBUbOGbwOdsWUyS55m9Lp9c4nRfyzDAWhPyWPr6X4LO_RDTZF7LVK-g9mOiO7jG8BCkAEbIvR3FvglULzEZmD9xYpvtOsivqOkJT2Cpz9IjH9cySaN0xCC07Xw7z9KFZr06P6hwydp3fBsnvOUI=s2048&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;2048&quot; data-original-width=&quot;1531&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjyUmrQJyp6-iW4qhzp9fS7WDZI5KV4dAdtS6Bu3KBUbOGbwOdsWUyS55m9Lp9c4nRfyzDAWhPyWPr6X4LO_RDTZF7LVK-g9mOiO7jG8BCkAEbIvR3FvglULzEZmD9xYpvtOsivqOkJT2Cpz9IjH9cySaN0xCC07Xw7z9KFZr06P6hwydp3fBsnvOUI=w478-h640&quot; width=&quot;478&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/28554505757320265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/11/consider-e-r-diagram-in-following.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/28554505757320265'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/28554505757320265'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/11/consider-e-r-diagram-in-following.html' title='Consider the E-R diagram in the following Figure  , which models an online bookstore.a. List the entity sets and their primary keys.b. Suppose the bookstore adds music cassettes and compact disks to its collection. The same music item may be present in cassette or compact disk format, with differing prices. Extend the E-R diagram to model this addition, ignoring the effect on shopping baskets.c. Now extend the E-R diagram, using generalization, to model the case where a shopping basket may contain any combination of books, music cassettes, or compact disks.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-AhVVhYTnDn0/YZ8b3tRMDhI/AAAAAAAABlw/u5m7MCCDcO8pMPzL1JzTp8TI7EqZG3_5wCLcBGAsYHQ/s72-w400-h309-c/image.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-1863331366378798907</id><published>2021-11-13T20:39:00.003+05:30</published><updated>2021-11-13T20:39:18.490+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="chapter19"/><category scheme="http://www.blogger.com/atom/ns#" term="computer networking"/><category scheme="http://www.blogger.com/atom/ns#" term="Forouzan"/><title type='text'>Data communication and networking by Forouzan chapter 19 solution</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;b&gt;11. What is the address space in each of the following systems?&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;a. A system with 8-bit addresses&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; 2^8&amp;nbsp;&lt;/p&gt;&lt;p&gt;b. A system with 16-bit addresses&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt;2^16&lt;/p&gt;&lt;p&gt;c. A system with 64-bit addresses &lt;/p&gt;&lt;p&gt;=&amp;gt;2^64&lt;/p&gt;&lt;p&gt;&lt;b&gt;12. An address space has a total of 1024 addresses. How many bits are needed to represent an address.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;solution:&amp;nbsp;&lt;/p&gt;&lt;p&gt;Let n bits are needed to represent an address.&lt;/p&gt;&lt;p&gt;so, 2^n = 1024&lt;/p&gt;&lt;p&gt;=&amp;gt;n= 9&lt;/p&gt;&lt;p&gt;&lt;b&gt;13. An address space uses the three symbols 0, 1, and 2 to represent addresses. If each address is made of 10 symbols, how many addresses are available in this system?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;Since, no of symbols used= 3&lt;/p&gt;&lt;p&gt;no of symbols a address consists of =10&lt;/p&gt;&lt;p&gt;So, addresses available= 3^10&lt;/p&gt;&lt;p&gt;&lt;b&gt;14. Change the following IP addresses from dotted-decimal notation to binary notation.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;a. 114.34.2.8&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; 01011110 00100010 00000010 00001000&lt;/p&gt;&lt;p&gt;b. 129.14.6.8&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; 10000001 00001110 00000110 00001000&lt;/p&gt;&lt;p&gt;c. 208.34.54.12&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; 11010000 00100010 00110110 00001100&lt;/p&gt;&lt;p&gt;d. 238.34.2.1&lt;/p&gt;&lt;p&gt;=&amp;gt; 11101110 00100010 00000010 00000001&lt;/p&gt;&lt;p&gt;&lt;b&gt;15. Change the following IP addresses from binary notation to dotted-decimal notation.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;a. 01111111 11110000 01100111 01111101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; 127.240.103.125&lt;/p&gt;&lt;p&gt;b. 10101111 11000000 11111000 00011101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt;175.192.248.29&lt;/p&gt;&lt;p&gt;c. 11011111 10110000 00011111 01011101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt;223.176.31.129&lt;/p&gt;&lt;p&gt;d. 11101111 11110111 11000111 00011101&lt;/p&gt;&lt;p&gt;=&amp;gt; 239.247.199.29&lt;/p&gt;&lt;p&gt;&lt;b&gt;16. Find the class of the following IP addresses.&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;a. 208.34.54.12&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt;&amp;nbsp; class C&lt;/p&gt;&lt;p&gt;b. 238.34.2.1&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; class D&lt;/p&gt;&lt;p&gt;c. 114.34.2.8&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; class A&lt;/p&gt;&lt;p&gt;d. 129.14.6.8&lt;/p&gt;&lt;p&gt;=&amp;gt; class B&lt;/p&gt;&lt;p&gt;&lt;b&gt;17. Find the class of the following IP addresses.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;a. 11110111 11110011 10000111 11011101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; class E&lt;/p&gt;&lt;p&gt;b. 10101111 11000000 11110000 00011101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; class B&lt;/p&gt;&lt;p&gt;c. 11011111 10110000 00011111 01011101&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; class C&lt;/p&gt;&lt;p&gt;d. 11101111 11110111 11000111 00011101&lt;/p&gt;&lt;p&gt;=&amp;gt; class D&lt;/p&gt;&lt;p&gt;&lt;b&gt;18. Find the netid and the hostid of the following IP addresses.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;a. 114.34.2.8&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; Netid=114&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Hostid=34.2.8&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;b. 132.56.8.6&amp;nbsp;&lt;/p&gt;&lt;p&gt;=&amp;gt; Netid=132.56&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Hostid=8.6&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;c. 208.34.54.12&lt;/p&gt;&lt;p&gt;=&amp;gt; Netid=208.34.54&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Hostid=12&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;19. In a block of addresses, we know the IP address of one host is 25.34.12.56/16. What are the first address (network address) and the last address (limited broadcast address) in this block?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;The IP address can be written as: 00011001 00100110 00001100 00111000&lt;/p&gt;&lt;p&gt;To obtain the first address, we will set the rightmost 32-16 bits to 0&lt;/p&gt;&lt;p&gt;The first address will be-&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;00011001 00100110 00000000 00000000&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;i.e. 25.34.0.0&lt;/p&gt;&lt;p&gt;To obtain the last address, we will set the rightmost 16 bits to 1.&lt;/p&gt;&lt;p&gt;So, the last address will be-&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;00011001 00100110 11111111 11111111&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;i.e. 25.34.255.255&lt;/p&gt;&lt;p&gt;&lt;b&gt;20. In a block of addresses, we know the IP address of one host is 182.44.82.16/26. What are the first address (network address) and the last address in this block?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;The IP address can be written as-&lt;/p&gt;&lt;p&gt;10110110 00101100 01010010 00010000&lt;/p&gt;&lt;p&gt;The first address can be obtained by replacing rightmost 32-26=6 bits with 0&lt;/p&gt;&lt;p&gt;So, the first address will be&lt;/p&gt;&lt;p&gt;10110110 00101100 01010010 00000000&lt;/p&gt;&lt;p&gt;i.e. 182.44.82.0&lt;/p&gt;&lt;p&gt;The last address can be obtained by replacing last rightmost 6 bits by 1&lt;/p&gt;&lt;p&gt;So, the last address will be&lt;/p&gt;&lt;p&gt;10110110 00101100 01010010 00111111&lt;/p&gt;&lt;p&gt;i.e. 182.44.82.63&lt;/p&gt;&lt;p&gt;&lt;b&gt;21. An organization is granted the block 16.0.0.0/8. The administrator wants to create 500 fixed-length subnets.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;a. Find the subnet mask.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;b. Find the number of addresses in each subnet.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;c. Find the first and last addresses in subnet 1.&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;d. Find the first and last addresses in subnet 500&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;Total number of addresses in the block will be:&lt;/p&gt;&lt;p&gt;2^(32-8)&lt;/p&gt;&lt;p&gt;=2^24&lt;/p&gt;&lt;p&gt;=16,777,216&lt;/p&gt;&lt;p&gt;So, each subnet will have (16,777,216)%500=33,554.432&lt;/p&gt;&lt;p&gt;The nearest power of 2 is 32,768&lt;/p&gt;&lt;p&gt;a)&amp;nbsp;&lt;/p&gt;&lt;p&gt;Let, mask of each subnet be n, then&lt;/p&gt;&lt;p&gt;2^(32-n)=32,768&lt;/p&gt;&lt;p&gt;=&amp;gt;2^(32-n)=2^15&lt;/p&gt;&lt;p&gt;=&amp;gt;32-n=15&lt;/p&gt;&lt;p&gt;=&amp;gt;n=17&lt;/p&gt;&lt;p&gt;So, subnet mask is 17&lt;/p&gt;&lt;p&gt;b)&lt;/p&gt;&lt;p&gt;The number of address in each subnet&lt;/p&gt;&lt;p&gt;= 2^(32-subnet mask)&lt;/p&gt;&lt;p&gt;=2^(32-17)&lt;/p&gt;&lt;p&gt;=2^15&lt;/p&gt;&lt;p&gt;=32,768&lt;/p&gt;&lt;p&gt;c)&lt;/p&gt;&lt;p&gt;The first address in first subnet is 16.0.0.0&lt;/p&gt;&lt;p&gt;which can be written&lt;/p&gt;&lt;p&gt;00010000 00000000 00000000 00000000&lt;/p&gt;&lt;p&gt;To obtain the last address of first subnet, we will replace the rightmost (32-17)=15 bits with 1&lt;/p&gt;&lt;p&gt;So, the last address will be&lt;/p&gt;&lt;p&gt;00010000 00000000 01111111 11111111&lt;/p&gt;&lt;p&gt;i.e. 16.0.127.255&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/1863331366378798907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/11/data-communication-and-networking-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1863331366378798907'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1863331366378798907'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/11/data-communication-and-networking-by.html' title='Data communication and networking by Forouzan chapter 19 solution'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-597616296344191063</id><published>2021-09-27T11:51:00.000+05:30</published><updated>2021-09-27T11:51:38.979+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="operating system"/><category scheme="http://www.blogger.com/atom/ns#" term="Peterson&#39;s solution"/><title type='text'>What is Peterson&#39;s solution?</title><content type='html'>&lt;p&gt;&amp;nbsp;As discussed in the post,&amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2021/09/what-is-process-synchronization.html&quot;&gt;What is Process Synchronization?&lt;/a&gt;, we came to know what is process synchronization and what is critical section problem.&lt;/p&gt;&lt;p&gt;Peterson&#39;s solution is a software based solution to the critical section problem.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;do&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; flag[i]=true;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; turn=j;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; while (flag[j] &amp;amp;&amp;amp; turn==j);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; CRITICAL SECTION&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; flag[i]=false;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; REMAINDER SECTION&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;} while(true);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The above code is the basic structure of a process in Peterson&#39;s solution. The variable turn indicates whose turn it is to enter the critical section and flag[i] is used to indicate if a process is ready to enter it&#39;s critical section.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In the entry section before entering critical section, process Pi sets the flag[i] value to true indicating that Pi is ready to enter it&#39;s critical section and then set the turn value to j asserting if any other process wants to enter the critical section they can do so to ensure progress. Then it execute the while loop until flag[j] is true and turn is j i.e. other process is using the critical section. After that if any of the above two conditions in the while loop becomes false, it can enter the critical section. In the exit section, it sets flag[i] to false indicating that it is leaving critical section.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If both processes try to enter the critical section at the same time, turn value will be set to i and j apparently at the same time and the first turn value will be overwritten immediately, the one which will make change in the turn value first will get to enter the critical section.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Peterson&#39;s solution preserves all the conditions mutual exclusion, progress and bounded waiting.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;When both the processes are ready to enter critical section i.e. flag[i]==flag[j]==true, both cannot enter the critical section at the same time because only one while loop will get executed as the value of turn can be either i or j not both at the same time. Hence ensures mutual exclusion.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Process Pi can be prevented from entering critical section if it is stuck in the while loop i.e. when turn==j and flag[j]==true. But if Pj is not ready to enter the critical section, then flag[j]=false and then Pi can enter the critical section. If flag[j]=false, then turn value must be i and in the while loop, Pi cannot change the turn value, that&#39;s why Pi will get to enter the critical section after at most one entry of Pj ensuring both progress and bounded waiting.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;IMPORTANT POINTS:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Peterson&#39;s solution is restricted to two processes that alternate executions between their critical section and remainder section.&lt;/li&gt;&lt;li&gt;The shared data by the two processes P0 and P1 in Peterson&#39;s solution are:&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; int turn;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; boolean flag[2];&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;span&gt;&lt;span&gt;flag[i] indicates that process Pi is ready to enter the critical section and turn =j makes sure that if the other process is also ready to enter the critical section, then it can enter before i ensuring mutual exclusion.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-gxysuC3gIT8/YVFiTQ5t9pI/AAAAAAAABlY/fqlPMTyq7dYOV6fYh6LLJmzlvUq2NJf1ACLcBGAsYHQ/s1920/learn-1996845_1920.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1122&quot; data-original-width=&quot;1920&quot; height=&quot;187&quot; src=&quot;https://1.bp.blogspot.com/-gxysuC3gIT8/YVFiTQ5t9pI/AAAAAAAABlY/fqlPMTyq7dYOV6fYh6LLJmzlvUq2NJf1ACLcBGAsYHQ/s320/learn-1996845_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/597616296344191063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/09/what-is-petersons-solution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/597616296344191063'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/597616296344191063'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/09/what-is-petersons-solution.html' title='What is Peterson&#39;s solution?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-gxysuC3gIT8/YVFiTQ5t9pI/AAAAAAAABlY/fqlPMTyq7dYOV6fYh6LLJmzlvUq2NJf1ACLcBGAsYHQ/s72-c/learn-1996845_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-4456136539109581362</id><published>2021-09-23T14:32:00.000+05:30</published><updated>2021-09-23T14:32:14.074+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="operating system"/><category scheme="http://www.blogger.com/atom/ns#" term="process synchronization"/><title type='text'>What is Process Synchronization? </title><content type='html'>WHY DO WE REQUIRE PROCESS SYNCHRONIZATION?&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In Multiprogramming, there are two kinds of processes. One is independent processes and the another one is cooperative processes. Independent processes are independent of each other, but cooperative processes can affect or affected by other processes executing in the system. They share logical address space or data through files or messages. Concurrent access to the shared data by the cooperating processes can result into data inconsistency.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For example, we can take race condition when several processes access and manipulate the same data concurrently and the outcome varies with the particular order in which access takes place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Consider the following processes.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;initially, count=5&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;P2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;count++&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;count--;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;The increment or decrement of count inside the processor happens as follows:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;P1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;nbsp; &amp;nbsp; P&lt;span&gt;&amp;nbsp;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R1&amp;lt;=count&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R2&amp;lt;=count&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R1&amp;lt;=count+1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R2&amp;lt;=count-1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;count&amp;lt;=R1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; count&amp;lt;=R2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Consider the following sequence of the steps,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R1&amp;lt;=count&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R1=5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R1&amp;lt;=R1+1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R1=6&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R2&amp;lt;=count&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R2=5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;R2&amp;lt;=R2-1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; R2=4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;count&amp;lt;=R2&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; count=4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;count&amp;lt;=R1&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; count=6&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;The final output will be either 4 or 6 depending on which process will execute it&#39;s final step last. But, You can see that the actual answer should be 5. Thus, both the processes are racing with each other to manipulate the final result. This is known as race condition.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;To avoid these kind of situations, we require Process Synchronization.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;THE CRITICAL SECTION PROBLEM:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;The critical section is the part of code of the cooperative processes which involves changing common variables or accessing shared resources.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;If one process is executing in its critical section, no other process is allowed to enter into critical section. There are some protocols designed regarding critical section which every process must follow. Each process must request permission to enter it&#39;s critical section. The section of code implementing this request is called entry section. After passing through entry section, a process enters the critical section and then followed by a exit section. The remaining code of the process is known as remainder section.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-8Tw1zsWNLcU/YUxCPBUWUFI/AAAAAAAABlQ/b9OylY5G8hkCpSKHZaM4mH0LFhgPHieigCLcBGAsYHQ/s1920/ENTRY%2BSECTION.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1920&quot; height=&quot;180&quot; src=&quot;https://1.bp.blogspot.com/-8Tw1zsWNLcU/YUxCPBUWUFI/AAAAAAAABlQ/b9OylY5G8hkCpSKHZaM4mH0LFhgPHieigCLcBGAsYHQ/s320/ENTRY%2BSECTION.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;There are several solutions are designed for this critical solution problem. But every solution must satisfy the following requirements.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;1)&amp;nbsp; Mutual exclusion: If one process is executing in it&#39;s critical section, then no other process can enter it&#39;s critical section.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;2)&amp;nbsp; Progress: If no process is executing in it&#39;s critical section, and some processes want to enter in their critical section, then only those who are not in their remainder section can participate to decide who will enter the critical section next.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;3) Bounded Waiting: There will be a limit on the umber of times that other processes are allowed to enter their critical section when a process made a request to enter it&#39;s critical section and before that request is granted.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;SOLUTIONS OF CRITICAL SECTION PROBLEM:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 1) Peterson&#39;s solution.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 2) Mutex Locks.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 3&lt;/span&gt;) Test and set&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 2) compare and swap.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; 4) Semaphores.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/4456136539109581362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/09/what-is-process-synchronization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4456136539109581362'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4456136539109581362'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/09/what-is-process-synchronization.html' title='What is Process Synchronization? '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-8Tw1zsWNLcU/YUxCPBUWUFI/AAAAAAAABlQ/b9OylY5G8hkCpSKHZaM4mH0LFhgPHieigCLcBGAsYHQ/s72-c/ENTRY%2BSECTION.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8005365538319379152</id><published>2021-09-22T19:48:00.002+05:30</published><updated>2021-09-22T19:50:04.280+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>How to create a .sh file in linux?</title><content type='html'>&lt;p&gt;&amp;nbsp;STEPS TO CREATE A .SH FILE IN LINUX:&lt;/p&gt;&lt;p&gt;&lt;i&gt;Sorry for the poor quality of the images, we will update it very soon&amp;nbsp; :)&lt;/i&gt;&lt;/p&gt;&lt;p&gt;STEP 1: Open a folder using cd command : cd&amp;nbsp; ~/Desktop/&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Use vi command to create a .sh file&lt;span&gt;&amp;nbsp;:&amp;nbsp; vi tutorial.sh&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-xRvc8fTjIb4/YUs4pZ4MU8I/AAAAAAAABkU/E9XmbyYj1mY8GtHZDdBxAmeV--GxJwxIgCLcBGAsYHQ/s804/Screenshot%2B2021-09-22%2B192514.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;69&quot; data-original-width=&quot;804&quot; height=&quot;27&quot; src=&quot;https://1.bp.blogspot.com/-xRvc8fTjIb4/YUs4pZ4MU8I/AAAAAAAABkU/E9XmbyYj1mY8GtHZDdBxAmeV--GxJwxIgCLcBGAsYHQ/s320/Screenshot%2B2021-09-22%2B192514.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;STEP 2:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The screen will look like this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-ULiKQqIJ5fE/YUs5OtuByQI/AAAAAAAABkc/ZOWmJ1mLGIEd9HKmxaU1oUnJfw4iluY-QCLcBGAsYHQ/s800/Screenshot%2B2021-09-22%2B192626.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;498&quot; data-original-width=&quot;800&quot; height=&quot;226&quot; src=&quot;https://1.bp.blogspot.com/-ULiKQqIJ5fE/YUs5OtuByQI/AAAAAAAABkc/ZOWmJ1mLGIEd9HKmxaU1oUnJfw4iluY-QCLcBGAsYHQ/w363-h226/Screenshot%2B2021-09-22%2B192626.jpg&quot; width=&quot;363&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Type&amp;nbsp; i&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-v1L4B0t1ci8/YUs5axUA8gI/AAAAAAAABkg/-gs7mL_pdIACc8pN2PK-kuC87LMwFYc7wCLcBGAsYHQ/s792/Screenshot%2B2021-09-22%2B192655.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;507&quot; data-original-width=&quot;792&quot; height=&quot;234&quot; src=&quot;https://1.bp.blogspot.com/-v1L4B0t1ci8/YUs5axUA8gI/AAAAAAAABkg/-gs7mL_pdIACc8pN2PK-kuC87LMwFYc7wCLcBGAsYHQ/w365-h234/Screenshot%2B2021-09-22%2B192655.jpg&quot; width=&quot;365&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;STEP 3:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, You can write whatever You want to write inside .sh file&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-TSB4q7WpIvo/YUs5qM_2f7I/AAAAAAAABko/TflLwfDebF4VgDYROj6DoOnGfMrKR6usgCLcBGAsYHQ/s797/Screenshot%2B2021-09-22%2B192842.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;510&quot; data-original-width=&quot;797&quot; height=&quot;250&quot; src=&quot;https://1.bp.blogspot.com/-TSB4q7WpIvo/YUs5qM_2f7I/AAAAAAAABko/TflLwfDebF4VgDYROj6DoOnGfMrKR6usgCLcBGAsYHQ/w390-h250/Screenshot%2B2021-09-22%2B192842.jpg&quot; width=&quot;390&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;STEP 4:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Press Esc key&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-WskTNGyIZo8/YUs5-CxLtEI/AAAAAAAABk0/mbCy6AoHiUoKrVDLMvM7QSUlp07n3pDTgCLcBGAsYHQ/s797/Screenshot%2B2021-09-22%2B192903.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;508&quot; data-original-width=&quot;797&quot; height=&quot;243&quot; src=&quot;https://1.bp.blogspot.com/-WskTNGyIZo8/YUs5-CxLtEI/AAAAAAAABk0/mbCy6AoHiUoKrVDLMvM7QSUlp07n3pDTgCLcBGAsYHQ/w381-h243/Screenshot%2B2021-09-22%2B192903.jpg&quot; width=&quot;381&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;STEP 5:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enter&amp;nbsp; :wq&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-dYv4eOBh0jY/YUs6RCw-HcI/AAAAAAAABk8/bgh7Gp2RvqMywv7-feX4GOUdPSErrtDLwCLcBGAsYHQ/s795/Screenshot%2B2021-09-22%2B192932.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;506&quot; data-original-width=&quot;795&quot; height=&quot;244&quot; src=&quot;https://1.bp.blogspot.com/-dYv4eOBh0jY/YUs6RCw-HcI/AAAAAAAABk8/bgh7Gp2RvqMywv7-feX4GOUdPSErrtDLwCLcBGAsYHQ/w382-h244/Screenshot%2B2021-09-22%2B192932.jpg&quot; width=&quot;382&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After entering, it will look like this&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-1ZzMVycTDZ0/YUs6cYxAdDI/AAAAAAAABlA/dSaU8wXL3oYkdf7-yQq0IlIFdbxJu2nEgCLcBGAsYHQ/s801/Screenshot%2B2021-09-22%2B193032.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;106&quot; data-original-width=&quot;801&quot; height=&quot;51&quot; src=&quot;https://1.bp.blogspot.com/-1ZzMVycTDZ0/YUs6cYxAdDI/AAAAAAAABlA/dSaU8wXL3oYkdf7-yQq0IlIFdbxJu2nEgCLcBGAsYHQ/w389-h51/Screenshot%2B2021-09-22%2B193032.jpg&quot; width=&quot;389&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;STEP 6:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now make the .sh file executable : chmod +x tutorial.sh&lt;/div&gt;&lt;div&gt;Execute the file :&amp;nbsp; ./tutorial.sh&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-3fqbIsBxw4Q/YUs61UYTTtI/AAAAAAAABlI/f3Ytgv556EUM7KiTZ84GKLHT0w6NakaIACLcBGAsYHQ/s801/Screenshot%2B2021-09-22%2B193259.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;133&quot; data-original-width=&quot;801&quot; height=&quot;64&quot; src=&quot;https://1.bp.blogspot.com/-3fqbIsBxw4Q/YUs61UYTTtI/AAAAAAAABlI/f3Ytgv556EUM7KiTZ84GKLHT0w6NakaIACLcBGAsYHQ/w386-h64/Screenshot%2B2021-09-22%2B193259.jpg&quot; width=&quot;386&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8005365538319379152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/09/how-to-create-sh-file-in-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8005365538319379152'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8005365538319379152'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/09/how-to-create-sh-file-in-linux.html' title='How to create a .sh file in linux?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-xRvc8fTjIb4/YUs4pZ4MU8I/AAAAAAAABkU/E9XmbyYj1mY8GtHZDdBxAmeV--GxJwxIgCLcBGAsYHQ/s72-c/Screenshot%2B2021-09-22%2B192514.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-4818985976067373669</id><published>2021-09-06T21:23:00.003+05:30</published><updated>2021-09-08T10:57:10.762+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="computer networking"/><category scheme="http://www.blogger.com/atom/ns#" term="network topology"/><title type='text'>What are the different types of Network Topology in computer networking?</title><content type='html'>&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;Network Topology in computer networking explains how different devices or nodes are connected physically to form a network and the logical flow of information in the network. It is the geometric representation of the relationship of all the links and nodes to one another.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;MESH TOPOLOGY:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In Mesh Topology, every device has point-to-point unique connections(links) with every other device.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If there are n nodes, then one node will have (n-1) links.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;n nodes should have n*(n-1) total number of links. But since one link connects two devices, so the number of links for n nodes will be n*(n-1)/2.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-aand8VsAQgE/YThAW0rB1QI/AAAAAAAABjk/TvuTjZqll9c9FjnB8i7r95vcRXubXX58wCLcBGAsYHQ/s1920/Untitled%2Bdesign%2B%25281%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1920&quot; height=&quot;180&quot; src=&quot;https://1.bp.blogspot.com/-aand8VsAQgE/YThAW0rB1QI/AAAAAAAABjk/TvuTjZqll9c9FjnB8i7r95vcRXubXX58wCLcBGAsYHQ/s320/Untitled%2Bdesign%2B%25281%2529.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;ADVANTAGES OF MESH TOPOLOGY:&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Each connection can carry its own data, so there is no traffic problem that occurs when links are shared by multiple devices.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Failure to one link doesn&#39;t affect others as all the connections are independent.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Every message is transferred through dedicated lines, only the intended recipient can see the messages, so there is no issue of privacy or security.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Fault isolation and fault identification become much easier.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;DISADVANTAGES OF MESH TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Installation and reconfiguration are difficult as every device is connected to every other device through unique connections.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Large number of I/O ports and cabling is required.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Takes lots of physical space.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Hardware required to connect each link can be expensive.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;STAR TOPOLOGY&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In star topology, there is a central controller called a hub to which every other device is connected point to point. There is no direct link between the devices. One device can send a message to another via the hub.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;ul style=&quot;color: #0e101a; text-align: left;&quot;&gt;&lt;li&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If there are n nodes or devices, then there will be n links&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;color: #0e101a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-hdM8dA0_dNI/YThGBAZDNaI/AAAAAAAABjs/Elkczy43ML4PmA14wKYPr2xnwEIuqTZDQCLcBGAsYHQ/s1920/HUB.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1920&quot; height=&quot;180&quot; src=&quot;https://1.bp.blogspot.com/-hdM8dA0_dNI/YThGBAZDNaI/AAAAAAAABjs/Elkczy43ML4PmA14wKYPr2xnwEIuqTZDQCLcBGAsYHQ/s320/HUB.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADVANTAGES OF STAR TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Easy to install and reconfigure as compared to mesh topology.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Less expensive than mesh topology as each device or node requires only one link and one I/O port to connect to other devices.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If one link fails, then no other link is affected.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;DISADVANTAGES OF STAR TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If the hub fails, then the whole system goes dead as all other devices are dependent on the hub.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Although the number of cables is lesser than mesh topology, the number is still high than some other topologies.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;BUS TOPOLOGY:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In bus topology, there is one long cable to which all the devices are connected. The cable acts as a backbone of the network. Nodes are connected to the bus cable by droplines and tap. Droplines are the links that connect the main bus cable and each device.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;There will always be one bus cable irrespective of the number of nodes or devices.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-kXeHjZ-z0_U/YThID3ScY-I/AAAAAAAABj0/yNMGcKvJuF8UQh7zTseByatvsYFiekJDACLcBGAsYHQ/s1920/HUB%2B%25281%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1920&quot; height=&quot;180&quot; src=&quot;https://1.bp.blogspot.com/-kXeHjZ-z0_U/YThID3ScY-I/AAAAAAAABj0/yNMGcKvJuF8UQh7zTseByatvsYFiekJDACLcBGAsYHQ/s320/HUB%2B%25281%2529.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADVANTAGES OF BUS TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Easy installation.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Lesser number of cables is required than star and mesh topology.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;DISADVANTAGES OF BUS TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Signals become weaker to the farthest point of the bus cable from the starting point as some energy is transformed into heat.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Difficult reconnection and fault isolation.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;A fault or break in the bus cable disables the entire system by disabling all transmissions.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;RING TOPOLOGY:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In ring topology, the devices are connected as a ring. Each device has point-to-point connection to only the two devices on either side of it. The signal passes through one device to another in one direction to the destination.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-SapY0POhpGI/YThJeX_IyaI/AAAAAAAABj8/PJclPLMp1swCSwqZpbaR1MXPulEX-FwQACLcBGAsYHQ/s1920/HUB%2B%25282%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1080&quot; data-original-width=&quot;1920&quot; height=&quot;180&quot; src=&quot;https://1.bp.blogspot.com/-SapY0POhpGI/YThJeX_IyaI/AAAAAAAABj8/PJclPLMp1swCSwqZpbaR1MXPulEX-FwQACLcBGAsYHQ/s320/HUB%2B%25282%2529.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ADVANTAGES OF RING TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Easy to install and reconfigure as each device is connected to only its immediate neighbors.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Easy fault isolation.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;DISADVANTAGES OF RING TOPOLOGY:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; list-style-type: disc; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Break in one ring can disable the entire network.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #0e101a; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;HYBRID TOPOLOGY:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;background: transparent; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span data-preserver-spaces=&quot;true&quot; style=&quot;background: transparent; color: #0e101a; margin-bottom: 0pt; margin-top: 0pt;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Hybrid topology is obtained from the combination of the above-mentioned topologies. Hybrid topologies have more advantages than the above topologies.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/4818985976067373669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/09/what-are-different-types-of-network.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4818985976067373669'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/4818985976067373669'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/09/what-are-different-types-of-network.html' title='What are the different types of Network Topology in computer networking?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-aand8VsAQgE/YThAW0rB1QI/AAAAAAAABjk/TvuTjZqll9c9FjnB8i7r95vcRXubXX58wCLcBGAsYHQ/s72-c/Untitled%2Bdesign%2B%25281%2529.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-2255600569091185529</id><published>2021-06-16T19:02:00.000+05:30</published><updated>2021-06-16T19:02:30.476+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="operating system"/><title type='text'>What is the output of the following code- fork() system call</title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;b&gt;What is the output of the following code- fork() system call&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;#include &amp;lt;stdio.h&amp;gt;&lt;/p&gt;&lt;p&gt;#include&amp;lt;unistd.h&amp;gt;&lt;/p&gt;&lt;p&gt;int main()&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; if(fork() &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;amp;&amp;amp; &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;fork())&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fork();&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; printf(&quot;Hi&amp;nbsp; &quot;);&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; return 0;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;div&gt;OUTPUT: Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-ihW6Gt5oTxk/YMn55Pd8L2I/AAAAAAAABh0/GEWnkfiVsVgSx2EWx2MeJ_vB8YTryVgugCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;60&quot; data-original-width=&quot;240&quot; height=&quot;80&quot; src=&quot;https://lh3.googleusercontent.com/-ihW6Gt5oTxk/YMn55Pd8L2I/AAAAAAAABh0/GEWnkfiVsVgSx2EWx2MeJ_vB8YTryVgugCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;EXPLANATION:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When the first fork() inside the conditional statement will execute, then two processes will be cloned, one is child process &lt;b&gt;C1&amp;nbsp; &lt;/b&gt;with logic 0 and another is the parent process &lt;b&gt;P&lt;/b&gt; with logic +1. Both the processes will run parallelly.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For &lt;b&gt;C1&lt;/b&gt;, the logic of &lt;b&gt;C1&lt;/b&gt; is&amp;nbsp; 0 , So, the logic of the conditional statement will be zero and the second fork() and third fork() will not be executed. The program will simply output &lt;b&gt;Hi.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;For &lt;b&gt;P&lt;/b&gt;, the logic of &lt;b&gt;P &lt;/b&gt;is 1, so the second fork() call will be executed and it will again create two processes, one is child process&lt;b&gt; C2&lt;/b&gt; and another is parent process &lt;b&gt;P.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;C2&lt;/b&gt; will simply print &lt;b&gt;Hi&lt;/b&gt; as &lt;b&gt;C1.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In P, the logic of the conditional statement will be 1, so the third fork() will be called and it will again create one child process &lt;b&gt;C3&lt;/b&gt; and parent process &lt;b&gt;P.&lt;/b&gt; Both of them will return &lt;b&gt;Hi.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;So, the output of the program will be&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;span&gt;&amp;nbsp; &amp;nbsp; Hi&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;C1&lt;span&gt;&amp;nbsp; &amp;nbsp; C2&lt;span&gt;&amp;nbsp; &amp;nbsp; C3&lt;span&gt;&amp;nbsp; &amp;nbsp; P&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/2255600569091185529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/06/what-is-output-of-following-code-fork.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2255600569091185529'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2255600569091185529'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/06/what-is-output-of-following-code-fork.html' title='What is the output of the following code- fork() system call'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-ihW6Gt5oTxk/YMn55Pd8L2I/AAAAAAAABh0/GEWnkfiVsVgSx2EWx2MeJ_vB8YTryVgugCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-5101197266956015753</id><published>2021-06-07T13:01:00.004+05:30</published><updated>2022-02-25T15:27:01.614+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><title type='text'>Write a program to create a class shape with functions to find the area of the shapes. Create  derived classes circle, rectangle and trapezoid each having overridden functions area and display.  Base class:</title><content type='html'>&lt;p&gt;&amp;nbsp;Write a program to create a class shape with functions to find the area of the shapes. Create&lt;/p&gt;&lt;p&gt;derived classes circle, rectangle and trapezoid each having overridden functions area and display.&lt;/p&gt;&lt;p&gt;Base class:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;● Member Variables: (protected) length, breadth&lt;/p&gt;&lt;p&gt;● Member Function: (public) virtual function area&lt;/p&gt;&lt;p&gt;CODE:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;&lt;br /&gt;import java.util.*;&lt;br /&gt;&lt;br /&gt;public abstract class Shape {&lt;br /&gt;&lt;br /&gt;	public abstract double area();&lt;br /&gt;	public abstract void display();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Circle extends Shape{&lt;br /&gt;    public void display() {&lt;br /&gt;        System.out.println(area());&lt;br /&gt;    }&lt;br /&gt;    public Circle(int radius) {&lt;br /&gt;        this.radius = radius;&lt;br /&gt;    }&lt;br /&gt;    protected int radius;&lt;br /&gt;    public double area() {&lt;br /&gt;        return (3.14*radius*radius);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Rectangle extends Shape {&lt;br /&gt;	   &lt;br /&gt;    public void display() {&lt;br /&gt;        System.out.println(area());        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Rectangle(double length, double width) {&lt;br /&gt;        this.length = length;&lt;br /&gt;        this.width = width;&lt;br /&gt;    }&lt;br /&gt;    protected double length;&lt;br /&gt;    protected double width;&lt;br /&gt;    &lt;br /&gt;    public double area() {&lt;br /&gt;        return length*width;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Trapezoid extends Shape{&lt;br /&gt;    public void display() {&lt;br /&gt;        System.out.println(area());&lt;br /&gt;    }&lt;br /&gt;    public Trapezoid(double lenght, double breadth, double height) {&lt;br /&gt;        this.lenght = lenght;&lt;br /&gt;        this.breadth = breadth;&lt;br /&gt;        this.height = height;&lt;br /&gt;    }&lt;br /&gt;    protected double lenght;&lt;br /&gt;    protected double breadth;&lt;br /&gt;    protected double height;&lt;br /&gt;   &lt;br /&gt;    public double area() {&lt;br /&gt;        return ((lenght+breadth)/2)*height;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public class Main2 {&lt;br /&gt;	 public static void main (String[] args) {&lt;br /&gt;	&lt;br /&gt;	        Rectangle rectangle = new Rectangle(4,4);&lt;br /&gt;	        rectangle.display();&lt;br /&gt;	        Circle circle= new Circle(6);&lt;br /&gt;	        circle.display();&lt;br /&gt;	        Trapezoid trapezoid=new Trapezoid(5,7,4);&lt;br /&gt;	        trapezoid.display();&lt;br /&gt;	        System.out.println();&lt;br /&gt;	    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-_ulIhuXnaKE/YL3LODQQ76I/AAAAAAAABho/h_hqEGY8ywEB_m2PNQQGAOLD3hAk4uyjQCLcBGAsYHQ/s1920/monitor-1307227_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1355&quot; data-original-width=&quot;1920&quot; src=&quot;https://1.bp.blogspot.com/-_ulIhuXnaKE/YL3LODQQ76I/AAAAAAAABho/h_hqEGY8ywEB_m2PNQQGAOLD3hAk4uyjQCLcBGAsYHQ/s320/monitor-1307227_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/5101197266956015753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/06/write-program-to-create-class-shape.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/5101197266956015753'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/5101197266956015753'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/06/write-program-to-create-class-shape.html' title='Write a program to create a class shape with functions to find the area of the shapes. Create  derived classes circle, rectangle and trapezoid each having overridden functions area and display.  Base class:'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-_ulIhuXnaKE/YL3LODQQ76I/AAAAAAAABho/h_hqEGY8ywEB_m2PNQQGAOLD3hAk4uyjQCLcBGAsYHQ/s72-c/monitor-1307227_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-328055939321649723</id><published>2021-06-07T12:56:00.003+05:30</published><updated>2022-02-26T13:28:00.022+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><title type='text'>Create a class called &#39;Matrix&#39; containing a constructor that initializes the number of rows and  number of columns of a new Matrix object. The Matrix class has the following information:</title><content type='html'>&lt;p&gt;&amp;nbsp;Create a class called &#39;Matrix&#39; containing a constructor that initializes the number of rows and&lt;/p&gt;&lt;p&gt;number of columns of a new Matrix object. The Matrix class has the following information:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;- number of rows of matrix&lt;/p&gt;&lt;p&gt;- number of columns of matrix&lt;/p&gt;&lt;p&gt;- elements of matrix in the form of 2D array&lt;/p&gt;&lt;p&gt;The Matrix class has the following methods:&lt;/p&gt;&lt;p&gt;- get the number of rows&lt;/p&gt;&lt;p&gt;- get the number of columns&lt;/p&gt;&lt;p&gt;- set the elements of the matrix at given position (i,j)&lt;/p&gt;&lt;p&gt;- adding two matrices. If the matrices are not addable, &quot;Matrices cannot be added&quot;&lt;/p&gt;&lt;p&gt;will be displayed.&lt;/p&gt;&lt;p&gt;- multiplying the two matrices&lt;/p&gt;&lt;p&gt;CODE:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.util.*;&lt;br /&gt;class Matrix {&lt;br /&gt;    int row;&lt;br /&gt;    int col;&lt;br /&gt;    int[][] a;&lt;br /&gt;    public Matrix(int r, int c)&lt;br /&gt;    {&lt;br /&gt;        row = r;&lt;br /&gt;        col = c;&lt;br /&gt;        a = new int[row][col];&lt;br /&gt;    }&lt;br /&gt;    public int getrow()&lt;br /&gt;    {&lt;br /&gt;        return row;&lt;br /&gt;    }&lt;br /&gt;    public int getcol()&lt;br /&gt;    {&lt;br /&gt;        return col;&lt;br /&gt;    }&lt;br /&gt;    public int getelement(int r, int c)&lt;br /&gt;    {&lt;br /&gt;        return a[r][c];&lt;br /&gt;    }&lt;br /&gt;    public void setelement(int r, int c, int value)&lt;br /&gt;    {&lt;br /&gt;        a[r][c] = value;&lt;br /&gt;    }&lt;br /&gt;    public static Matrix add(Matrix a, Matrix b)&lt;br /&gt;    {&lt;br /&gt;        if((a.row != b.row) || (a.col != b.col))&lt;br /&gt;        {&lt;br /&gt;          System.out.println(&quot;Matrices can not be added&quot;);&lt;br /&gt;          return new Matrix(0,0);&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;          Matrix m = new Matrix(a.row,a.col);&lt;br /&gt;          for(int i = 0;i &amp;lt; m.row;i++)&lt;br /&gt;          {&lt;br /&gt;            for(int j = 0;j &amp;lt; m.col;j++)&lt;br /&gt;            {&lt;br /&gt;              m.setelement(i,j,(a.getelement(i,j)+b.getelement(i,j)));&lt;br /&gt;            }&lt;br /&gt;          }&lt;br /&gt;          return m;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    public static Matrix mult(Matrix a, Matrix b)&lt;br /&gt;    {&lt;br /&gt;      Matrix m = new Matrix(a.row,b.col);&lt;br /&gt;      for(int i = 0;i &amp;lt; a.row;i++)&lt;br /&gt;      {&lt;br /&gt;        for(int j = 0;j &amp;lt; b.col;j++)&lt;br /&gt;        {&lt;br /&gt;          int s = 0;&lt;br /&gt;          for(int k = 0;k &amp;lt; a.col;k++)&lt;br /&gt;          {&lt;br /&gt;            s = s+(a.getelement(i,k)*b.getelement(k,j));&lt;br /&gt;          }&lt;br /&gt;          m.setelement(i,j,s);&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;      return m;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void printmat()&lt;br /&gt;    {&lt;br /&gt;        for(int i = 0;i &amp;lt; row;i++)&lt;br /&gt;        {&lt;br /&gt;            for(int j = 0;j &amp;lt; col;j++)&lt;br /&gt;            {&lt;br /&gt;              System.out.print(a[i][j]+&quot;	&quot;);&lt;br /&gt;            }&lt;br /&gt;            System.out.println(&quot;&quot;);&lt;br /&gt;         }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-J_BYaZG2EnY/YL3KAf5PBVI/AAAAAAAABhg/H9vOzYFJW5Y1msaow9gmZHjxbCUup75ngCLcBGAsYHQ/s1920/monitor-1307227_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1355&quot; data-original-width=&quot;1920&quot; src=&quot;https://1.bp.blogspot.com/-J_BYaZG2EnY/YL3KAf5PBVI/AAAAAAAABhg/H9vOzYFJW5Y1msaow9gmZHjxbCUup75ngCLcBGAsYHQ/s320/monitor-1307227_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/328055939321649723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/06/create-class-called-matrix-containing.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/328055939321649723'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/328055939321649723'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/06/create-class-called-matrix-containing.html' title='Create a class called &#39;Matrix&#39; containing a constructor that initializes the number of rows and  number of columns of a new Matrix object. The Matrix class has the following information:'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-J_BYaZG2EnY/YL3KAf5PBVI/AAAAAAAABhg/H9vOzYFJW5Y1msaow9gmZHjxbCUup75ngCLcBGAsYHQ/s72-c/monitor-1307227_1920.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-241301484438585688</id><published>2021-05-25T18:57:00.004+05:30</published><updated>2022-02-26T13:29:46.160+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>GAME: Choice of area</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span style=&quot;font-family: inherit;&quot;&gt;Consider a game where we are given two types of power A and B and three types of area X,Y,Z.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #40424e; font-family: inherit; letter-spacing: 0.162px;&quot;&gt;Every second you have to switch between these areas, each area has specific properties by which your power A and power B increase or decrease. We need to keep choosing areas in such a way that our survival time is maximized. Survival time ends when any of the powers, A or B reaches less than 0.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt; bits/stdc++.h &amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;int Survival(int A,int B, int x1,int x2,int y1,int y2,int z1,int z2,int last,map &amp;lt; pair &amp;lt; int,int &amp;gt; ,int &amp;gt; mp)&lt;br /&gt;{&lt;br /&gt;          if(A &amp;lt;=0 || B &amp;lt;=0)&lt;br /&gt;                    return 0;&lt;br /&gt;          pair &amp;lt; int,int &amp;gt; current=make_pair(A,B);&lt;br /&gt;          if(mp.find(current)!=mp.end())&lt;br /&gt;                    return mp[current];&lt;br /&gt;&lt;br /&gt;          int temp;&lt;br /&gt;          if(last==1)&lt;br /&gt;                    temp=1+max(Survival(A+y1,B+y2,x1,x2,y1,y2,z1,z2,2,mp),Survival(A+z1,B+z2,x1,x2,y1,y2,z1,z2,3,mp));&lt;br /&gt;          else if(last==2)&lt;br /&gt;                    temp=1+max(Survival(A+x1,B+x2,x1,x2,y1,y2,z1,z2,1,mp),Survival(A+z1,B+z2,x1,x2,y1,y2,z1,z2,3,mp));&lt;br /&gt;          else&lt;br /&gt;                    temp=1+max(Survival(A+y1,B+y2,x1,x2,y1,y2,z1,z2,2,mp),Survival(A+x1,B+x2,x1,x2,y1,y2,z1,z2,1,mp));&lt;br /&gt;          mp[current]=temp;&lt;br /&gt;          return temp;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;       int A,B,x1,x2,y1,y2,z1,z2;&lt;br /&gt;       cin &amp;gt;&amp;gt; A &amp;gt;&amp;gt; B;&lt;br /&gt;       cin &amp;gt;&amp;gt; x1 &amp;gt;&amp;gt; x2;&lt;br /&gt;       cin &amp;gt;&amp;gt; y1 &amp;gt;&amp;gt; y2;&lt;br /&gt;       cin &amp;gt;&amp;gt; z1 &amp;gt;&amp;gt; z2;&lt;br /&gt;       map &amp;lt; pair &amp;lt; int,int &amp;gt; ,int &amp;gt; mp;&lt;br /&gt;       int ans=0;&lt;br /&gt;       if(A &amp;lt;=0 || B &amp;lt;=0)&lt;br /&gt;          ans=0;&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;                  ans=max(Survival(A+x1,B+x2,x1,x2,y1,y2,z1,z2,1,mp),max(Survival(A+y1,B+y2,x1,x2,y1,y2,z1,z2,2,mp),Survival(A+z1,B+z2,x1,x2,y1,y2,z1,z2,3,mp)));&lt;br /&gt;       }&lt;br /&gt;        cout &amp;lt;&amp;lt; ans;&lt;br /&gt;        return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;20&lt;span&gt;&amp;nbsp; &amp;nbsp; 8&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;3&lt;span&gt;&amp;nbsp; &amp;nbsp; 2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;-5&lt;span&gt;&amp;nbsp; &amp;nbsp; -10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;-20&lt;span&gt;&amp;nbsp; &amp;nbsp; 5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-_slLCdh8t_Q/YKz4mqEDh2I/AAAAAAAABhY/igYPFMApZ0QMZjxqH1mKsu7GCaGOBxeRwCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;242&quot; data-original-width=&quot;523&quot; height=&quot;148&quot; src=&quot;https://lh3.googleusercontent.com/-_slLCdh8t_Q/YKz4mqEDh2I/AAAAAAAABhY/igYPFMApZ0QMZjxqH1mKsu7GCaGOBxeRwCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/241301484438585688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/game-choice-of-area.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/241301484438585688'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/241301484438585688'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/game-choice-of-area.html' title='GAME: Choice of area'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-_slLCdh8t_Q/YKz4mqEDh2I/AAAAAAAABhY/igYPFMApZ0QMZjxqH1mKsu7GCaGOBxeRwCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-6853789431867762583</id><published>2021-05-25T17:57:00.004+05:30</published><updated>2022-02-26T13:31:54.606+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>How to print all subset of an array with given sum?</title><content type='html'>&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt; bits/stdc++.h &amp;gt;&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;bool**dp;&lt;br /&gt;void printvector(vector &amp;lt; int &amp;gt; &amp;v)&lt;br /&gt;{&lt;br /&gt;          for(int i=0;i &amp;lt; v.size();i++)&lt;br /&gt;                    cout &amp;lt;&amp;lt; v[i] &amp;lt;&amp;lt; &quot; &quot;;&lt;br /&gt;          cout &amp;lt;&amp;lt; endl;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void print(int a[], int i,int sum, vector &amp;lt; int &amp;gt; &amp;v)&lt;br /&gt;{&lt;br /&gt;        if(i==1 &amp;&amp; sum!=0 &amp;&amp; dp[1][sum])&lt;br /&gt;        {&lt;br /&gt;                  v.push_back(a[i-1]);&lt;br /&gt;                  if(a[i-1]==sum)&lt;br /&gt;                    printvector(v);&lt;br /&gt;                  return;&lt;br /&gt;        }&lt;br /&gt;        if(i==1 &amp;&amp; sum==0)&lt;br /&gt;        {&lt;br /&gt;                  printvector(v);&lt;br /&gt;                  return;&lt;br /&gt;        }&lt;br /&gt;        //excluding given element make a new path&lt;br /&gt;        if(dp[i-1][sum])&lt;br /&gt;        {&lt;br /&gt;                  vector &amp;lt; int &amp;gt; p=v;&lt;br /&gt;                  print(a,i-1,sum,p);&lt;br /&gt;        }&lt;br /&gt;        //including given element&lt;br /&gt;         if (sum &amp;gt;= a[i-1] &amp;&amp; dp[i-1][sum-a[i-1]])&lt;br /&gt;          {&lt;br /&gt;                    v.push_back(a[i-1]);&lt;br /&gt;                    print(a, i-1, sum-a[i-1],v);&lt;br /&gt;          }&lt;br /&gt;}&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;        int n,sum;&lt;br /&gt;        cin &amp;gt;&amp;gt; n &amp;gt;&amp;gt; sum;&lt;br /&gt;        int a[n];&lt;br /&gt;        for(int i=0;i &amp;lt; n;i++)&lt;br /&gt;          cin &amp;gt;&amp;gt; a[i];&lt;br /&gt;        dp = new bool*[n+1];&lt;br /&gt;        for(int i=0;i &amp;lt;=n;i++)&lt;br /&gt;          dp[i]=new bool[sum+1];&lt;br /&gt;        //initialize if i==0 dp[i][j]=False if j==0 dp[i][j]=true but if i==0 &amp;&amp; j==0 dp[i][j]=True&lt;br /&gt;        dp[0][0]= 1;&lt;br /&gt;        for(int i=1;i &amp;lt;=n;i++)&lt;br /&gt;          dp[i][0]=1;&lt;br /&gt;        for(int j=1;j &amp;lt;=sum;j++)&lt;br /&gt;          dp[0][j]=0;&lt;br /&gt;        for(int i=1;i &amp;lt;=n;i++)&lt;br /&gt;        {&lt;br /&gt;                  for(int j=1;j &amp;lt;=sum;j++)&lt;br /&gt;                  {         //exclude a[i] for sum j&lt;br /&gt;                            if(a[i-1] &amp;gt; j)&lt;br /&gt;                              dp[i][j]=dp[i-1][j];&lt;br /&gt;                            //else include if j-a[i] is true&lt;br /&gt;                            else&lt;br /&gt;                              dp[i][j]=dp[i-1][j-a[i-1]] || dp[i-1][j];&lt;br /&gt;                  }&lt;br /&gt;        }&lt;br /&gt;        if(dp[n][sum])&lt;br /&gt;          cout &amp;lt;&amp;lt; &quot;YES&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        else&lt;br /&gt;          cout &amp;lt;&amp;lt; &quot;NO&quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;        vector &amp;lt; int &amp;gt; v;&lt;br /&gt;        print(a,n,sum,v);&lt;br /&gt;&lt;br /&gt;        return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;div&gt;5&lt;span&gt;&amp;nbsp; &amp;nbsp; 10&lt;/span&gt;&lt;/div&gt;&lt;div&gt;1&lt;span&gt;&amp;nbsp; &amp;nbsp; 2&lt;span&gt;&amp;nbsp; &amp;nbsp; 3&lt;span&gt;&amp;nbsp; &amp;nbsp; 4&lt;span&gt;&amp;nbsp; &amp;nbsp; 5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-CmwN7pl-4NY/YKzsugp8f8I/AAAAAAAABhQ/6zDa304LvioCtn8y_dyXtLnjJpHCoB5aQCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;205&quot; data-original-width=&quot;570&quot; height=&quot;115&quot; src=&quot;https://lh3.googleusercontent.com/-CmwN7pl-4NY/YKzsugp8f8I/AAAAAAAABhQ/6zDa304LvioCtn8y_dyXtLnjJpHCoB5aQCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/6853789431867762583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/how-to-print-all-subset-of-array-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/6853789431867762583'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/6853789431867762583'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/how-to-print-all-subset-of-array-with.html' title='How to print all subset of an array with given sum?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-CmwN7pl-4NY/YKzsugp8f8I/AAAAAAAABhQ/6zDa304LvioCtn8y_dyXtLnjJpHCoB5aQCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-1015329677636950235</id><published>2021-05-24T19:37:00.004+05:30</published><updated>2022-02-26T13:32:42.088+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>Find maximum sum i*arr[i] if only rotation of the array is allowed.</title><content type='html'>&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt; bits/stdc++.h &amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;        int n;&lt;br /&gt;        cin &amp;gt;&amp;gt; n;&lt;br /&gt;        int a[n];&lt;br /&gt;        for(int i=0;i &amp;lt; n;i++)&lt;br /&gt;          cin &amp;gt;&amp;gt; a[i];&lt;br /&gt;&lt;br /&gt;        int value=0,sum=0;&lt;br /&gt;        for(int i=0;i &amp;lt; n;i++)&lt;br /&gt;        {&lt;br /&gt;                  sum=sum+a[i];&lt;br /&gt;                  value=value+i*a[i];&lt;br /&gt;        }&lt;br /&gt;        int ans=value;&lt;br /&gt;        for(int i=1;i &amp;lt; n;i++)&lt;br /&gt;        {&lt;br /&gt;                  value=value+sum-n*a[n-i];&lt;br /&gt;                  ans=max(ans,value);&lt;br /&gt;        }&lt;br /&gt;        cout &amp;lt;&amp;lt; ans;&lt;br /&gt;        return 0;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-zknPASvRYSc/YKuy_r79A0I/AAAAAAAABhA/rYWV6Ng1WpooT7nEqfws2-tI87DTvNbuACLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;126&quot; data-original-width=&quot;550&quot; height=&quot;73&quot; src=&quot;https://lh3.googleusercontent.com/-zknPASvRYSc/YKuy_r79A0I/AAAAAAAABhA/rYWV6Ng1WpooT7nEqfws2-tI87DTvNbuACLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/1015329677636950235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/find-maximum-sum-iarri-if-only-rotation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1015329677636950235'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1015329677636950235'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/find-maximum-sum-iarri-if-only-rotation.html' title='Find maximum sum i*arr[i] if only rotation of the array is allowed.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-zknPASvRYSc/YKuy_r79A0I/AAAAAAAABhA/rYWV6Ng1WpooT7nEqfws2-tI87DTvNbuACLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-1615365014870662888</id><published>2021-05-24T18:46:00.004+05:30</published><updated>2021-05-24T18:46:56.343+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>How to rotate an array by d elements? (Efficient approach)</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;b&gt;How to rotate an array by d elements? (Efficient approach)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;#include &amp;lt;bits/stdc++.h&amp;gt;&lt;/p&gt;&lt;p&gt;using namespace std;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;void reverseArray(int a[],int i,int j)&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;while(i&amp;lt;j)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;swap(a[i],a[j]);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i++;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j--;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;int main()&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n,d;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;n&amp;gt;&amp;gt;d;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int a[n];&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;n;i++)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;a[i];&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reverseArray(a,0,d-1);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reverseArray(a,d,n-1);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reverseArray(a,0,n-1);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;n;i++)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;a[i]&amp;lt;&amp;lt;&quot; &quot;;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return 0;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;10&lt;span&gt;&amp;nbsp; &amp;nbsp; 3&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;1&lt;span&gt;&amp;nbsp; &amp;nbsp; 2&lt;span&gt;&amp;nbsp; &amp;nbsp; 3&lt;span&gt;&amp;nbsp; &amp;nbsp; 4&lt;span&gt;&amp;nbsp; &amp;nbsp; 5&lt;span&gt;&amp;nbsp; &amp;nbsp; 6&lt;span&gt;&amp;nbsp; &amp;nbsp; 7&lt;span&gt;&amp;nbsp; &amp;nbsp; 8&lt;span&gt;&amp;nbsp; &amp;nbsp; 9&lt;span&gt;&amp;nbsp; &amp;nbsp; 10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-B0-Dqn_SzPM/YKunN4wxUnI/AAAAAAAABgo/DcEsLOKxoJsercKSezmEo38P8FKViHH_wCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;162&quot; data-original-width=&quot;543&quot; height=&quot;95&quot; src=&quot;https://lh3.googleusercontent.com/-B0-Dqn_SzPM/YKunN4wxUnI/AAAAAAAABgo/DcEsLOKxoJsercKSezmEo38P8FKViHH_wCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/1615365014870662888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/how-to-rotate-array-by-d-elements.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1615365014870662888'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1615365014870662888'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/how-to-rotate-array-by-d-elements.html' title='How to rotate an array by d elements? (Efficient approach)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-B0-Dqn_SzPM/YKunN4wxUnI/AAAAAAAABgo/DcEsLOKxoJsercKSezmEo38P8FKViHH_wCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-2273676481118622654</id><published>2021-05-11T19:38:00.004+05:30</published><updated>2021-05-24T18:48:13.119+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="data structure and algorithm"/><title type='text'>VARIOUS PROGRAMMING QUESTIONS AND DATA STRUCTURE AND ALGORITHM </title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;b&gt;POSTS:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;1. &amp;nbsp;&amp;nbsp; &lt;a href=&quot;https://www.cuplex2b.com/2020/09/compare-and-plot-graph-of-cpu-time-for.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/09/compare-and-plot-graph-of-cpu-time-for.html&quot;&gt;Compare and plot the graph of CPU time for different sorting algorithms- bubble sort, selection sort, insertion sort for different cases&lt;/a&gt;&lt;/p&gt;&lt;p&gt;2.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/09/even-array.html&quot;&gt; Even array &lt;/a&gt;&lt;/p&gt;&lt;p&gt;3.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/09/how-to-convert-decimal-to-binary-upto.html&quot;&gt;HOW TO CONVERT DECIMAL TO ROMAN UPTO 10000000000 IN C and CPP&lt;/a&gt;&lt;/p&gt;&lt;p&gt;4.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/09/count-and-print-numbers-which-are.html&quot;&gt;MOST EFFECTIVE WAY: COUNT AND PRINT THE NUMBERS WHICH ARE POWERS OF 2 || CHECK IF A NUMBER IS A POWER OF TWO&lt;/a&gt;&lt;/p&gt;&lt;p&gt;5.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/09/general-casecount-and-print-numbers.html&quot;&gt;general case::::COUNT AND PRINT THE NUMBERS WHICH ARE POWERS OF ANOTHER GIVEN NUMBER || CHECK IF A NUMBER IS A POWER OF ANOTHER GIVEN NUMBER&lt;/a&gt;&lt;/p&gt;&lt;p&gt;6.&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/time-complexity-of-different-algorithms.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/time-complexity-of-different-algorithms.html&quot;&gt;TIME COMPLEXITY OF DIFFERENT ALGORITHMS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;7.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/how-to-find-kth-largest-element-of.html&quot;&gt;How to find Kth smallest element and Kth largest element of an array using heap&lt;/a&gt;&lt;/p&gt;&lt;p&gt;8.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/find-k-closest-number-of-given-number.html&quot;&gt;FIND K CLOSEST NUMBER OF A GIVEN NUMBER  FROM A SET OF NUMBERS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;10.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/find-k-most-frequent-numbers-in-set-of.html&quot;&gt;FIND K MOST FREQUENT NUMBERS IN A SET OF NUMBERS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;11.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/10/sort-set-of-numbers-in-terms-of.html&quot;&gt;SORT A SET OF NUMBERS IN TERMS OF THE FREQUENCY OF THE NUMBERS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;12.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/comparison-between-different-sorting.html&quot;&gt;COMPARISON BETWEEN DIFFERENT SORTING TECHNIQUES&lt;/a&gt;&lt;/p&gt;&lt;p&gt;13.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/write-program-to-rotate-matrix-in-90.html&quot;&gt;write a program to rotate a matrix in 90 degree angle using dynamic memory allocation and random number generator. &lt;/a&gt;&lt;/p&gt;&lt;p&gt;14.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/find-number-which-occurs-once-in-array.html&quot;&gt;Find the number which occurs once in an array while all other elements occurs twice using XOR&lt;/a&gt;&lt;/p&gt;&lt;p&gt;15.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/write-code-to-print-large-fibonacci.html&quot;&gt;Write a code to print large fibonacci numbers in minimum time&lt;/a&gt;&lt;/p&gt;&lt;p&gt;16.&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/write-program-in-c-to-insert-and-delete.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/write-program-in-c-to-insert-and-delete.html&quot;&gt;Write a program in c to insert and delete a middle element of a stack implemented using array&lt;/a&gt;&lt;/p&gt;&lt;p&gt;17.&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/what-is-dynamic-programming-basic-of-dp.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/what-is-dynamic-programming-basic-of-dp.html&quot;&gt;WHAT IS DYNAMIC PROGRAMMING? BASIC OF DP WITH EXAMPLE&lt;/a&gt;&lt;/p&gt;&lt;p&gt;18.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/11/determine-if-there-is-subset-in-given.html&quot;&gt;DETERMINE IF THERE IS A SUBSET IN A GIVEN ARRAY WHOSE SUM IS EQUAL TO THE GIVEN SUM-( SUBSET SUM PROBLEM)&lt;/a&gt;&lt;/p&gt;&lt;p&gt;19.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/c-program-to-implement-queue-using.html&quot;&gt;C PROGRAM TO IMPLEMENT QUEUE USING ARRAY AND PERFORM INSERTON, DELETION OPERATION&lt;/a&gt;&lt;/p&gt;&lt;p&gt;20.&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/write-program-in-c-to-insert-element-in.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/write-program-in-c-to-insert-element-in.html&quot;&gt;Write a program in c to insert an element in the middle and delete the middle element of queue&lt;/a&gt;&lt;/p&gt;&lt;p&gt;21.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/how-to-implement-stack-using-queue-in-c.html&quot;&gt;HOW TO IMPLEMENT STACK USING QUEUE IN C?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;22.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/c%20programming.html&quot;&gt;B TECH FIRST YEAR C PROGRAMMMING QUESTIONS &lt;/a&gt;&lt;/p&gt;&lt;p&gt;23.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2020/12/palindromic%20substring.html&quot;&gt;WRITE A PROGRAM TO COUNT THE MINIMUM NUMBER OF CHARACTERS TO BE REPLACED TO  CONVERT A STRING TO A NEW STRING WITH NO PALINDROMIC SUBSTRING OF LENGTH MORE THAN ONE&lt;/a&gt;&lt;/p&gt;&lt;p&gt;24.&amp;nbsp; &amp;nbsp;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/equalsumpartition.html&quot;&gt;&amp;nbsp;&lt;/a&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/equalsumpartition.html&quot;&gt;EQUAL SUM PARTITION PROBLEM- YOU ARE GIVEN AN ARRAY, YOU NEED TO FIND IF IT IS POSSIBLE TO DIVIDE THE ARRAY IN TWO PARTS WHOSE SUMS ARE EQUAL.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;25.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/countofsubsetsum.html&quot;&gt;COUNT THE NUMBER OF SUBSETS IN AN ARRAY WHOSE SUM IS EQUAL TO A GIVEN SUM&lt;/a&gt;&lt;/p&gt;&lt;p&gt;26.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/minimumsubsetsumdifference.html&quot;&gt;MINIMUM SUBSET SUM DIFFERENCE : HOW TO DIVIDE AN ARRAY IN TWO PARTS SUCH THAT THE DIFFERENCE BETWEEN THE SUM OF THE SUBSETS IS MINIMUM POSSIBLE&lt;/a&gt;&lt;/p&gt;&lt;p&gt;27.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/number-of-subset-with-given-difference.html&quot;&gt;HOW TO COUNT THE NUMBER OF SUBSETS IN AN ARRAY WITH A GIVEN DIFFERECE OF THE SUM OF THE SUBSETS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;28.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/target-sum.html&quot;&gt;TARGET SUM PROBLEM: DYNAMIC PROGRAMMING&lt;/a&gt;&lt;/p&gt;&lt;p&gt;29.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/rod-cutting-problem.html&quot;&gt;ROD CUTTING PROBLEM-DYNAMIC PROGRAMMING&lt;/a&gt;&lt;/p&gt;&lt;p&gt;30.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/egg-dropping-problem-dynamic-programming.html&quot;&gt;EGG DROPPING PROBLEM- DYNAMIC PROGRAMMING&lt;/a&gt;&lt;/p&gt;&lt;p&gt;31.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/some-simple-mathematics-used-in.html&quot;&gt;SOME SIMPLE MATHEMATICS USED IN COMPETITIVE PROGRAMMING&lt;/a&gt;&lt;/p&gt;&lt;p&gt;32.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/coin-change-problem.html&quot;&gt;COIN CHANGE PROBLEM- TOTAL NUMBER OF WAYS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;33.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/coin-change-problem-ii-minimum-no-of.html&quot;&gt;COIN CHANGE PROBLEM II - MINIMUM NO OF COINS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;34.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/what-is-binary-search-introduction-to.html&quot;&gt;WHAT IS BINARY SEARCH ? INTRODUCTION TO BINARY SEARCH&lt;/a&gt;&lt;/p&gt;&lt;p&gt;35.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-apply-binary-search-on-reverse.html&quot;&gt;HOW TO APPLY BINARY SEARCH ON REVERSE SORTED ARRAY?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;36.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-find-first-and-last-occurance-of.html&quot;&gt;HOW TO FIND FIRST AND LAST OCCURRENCE OF AN ELEMENT IN A SORTED ARRAY?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;37.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-count-number-of-occurrence-of.html&quot;&gt;HOW TO COUNT THE NUMBER OF OCCURRENCE OF AN ELEMENT IN A SORTED ARRAY USING BINARY SEARCH?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;38.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-many-times-sorted-array-is-rotated.html&quot;&gt;HOW MANY TIMES A SORTED ARRAY IS ROTATED TO GET ANOTHER GIVEN ARRAY?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;39.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-find-element-in-sorted-rotated.html&quot;&gt;HOW TO FIND AN ELEMENT IN A SORTED ROTATED ARRAY?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;40.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/searching-in-nearly-sorted-array-using-binary-search.html&quot;&gt;How To Perform Searching Operation In a Nearly Sorted Array?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;41.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/next-nearest-letter.html&quot;&gt;How To Find The Next Nearest Letter Of A Character Present in a Sorted Character Array?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;42.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-find-position-of-element-in.html&quot;&gt;How To Find Position Of An Element in an Infinite Sorted Array?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;43.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/peak-element-binary-search.html&quot;&gt;PEAK ELEMENT-BINARY SEARCH&lt;/a&gt;&lt;/p&gt;&lt;p&gt;44.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/01/how-to-find-maximum-element-in-bitonic.html&quot;&gt;How To Find Maximum Element In a Bitonic Array?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;45.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/shortest-path-in-maze-using-dfs.html&quot;&gt;Shortest path in a maze using BFS&lt;/a&gt;&lt;/p&gt;&lt;p&gt;46.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/what-is-graph-theory-algorithm.html&quot;&gt;WHAT IS GRAPH THEORY ALGORITHM?&lt;/a&gt;&lt;/p&gt;&lt;p&gt;47.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/04/given-binary-matrix-of-size-10x10-where.html&quot;&gt;Given a binary matrix of size 10x10, where 0 represents water and 1 represents land, and connected ones form an island, count the total number of islands (using queue data structure) in c.&lt;/a&gt;&lt;/p&gt;&lt;p&gt;48.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/04/implement-huffman-encoding-using-java.html&quot;&gt;Implement Huffman Encoding using java&lt;/a&gt;&lt;/p&gt;&lt;p&gt;49.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/05/heap-sort-in-c.html&quot;&gt;Heap sort in c&lt;/a&gt;&lt;/p&gt;&lt;p&gt;50.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/05/activity-selection-problem.html&quot;&gt;Activity selection problem&lt;/a&gt;&lt;/p&gt;&lt;p&gt;51.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/05/how-to-rotate-array-by-d-elements.html&quot;&gt;How to rotate an array by d elements? (Efficient approach)&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-C9eCzTKtYa4/YJqPx3mTuSI/AAAAAAAABeg/P_xP7UuNpuo39uF9ybx6sRnQIrLDSPHhQCLcBGAsYHQ/s1920/monitor-1307227_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1355&quot; data-original-width=&quot;1920&quot; src=&quot;https://1.bp.blogspot.com/-C9eCzTKtYa4/YJqPx3mTuSI/AAAAAAAABeg/P_xP7UuNpuo39uF9ybx6sRnQIrLDSPHhQCLcBGAsYHQ/s320/monitor-1307227_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/2273676481118622654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/various-programming-questions-and-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2273676481118622654'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/2273676481118622654'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/various-programming-questions-and-data.html' title='VARIOUS PROGRAMMING QUESTIONS AND DATA STRUCTURE AND ALGORITHM '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-C9eCzTKtYa4/YJqPx3mTuSI/AAAAAAAABeg/P_xP7UuNpuo39uF9ybx6sRnQIrLDSPHhQCLcBGAsYHQ/s72-c/monitor-1307227_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8576713545897405987</id><published>2021-05-10T18:50:00.001+05:30</published><updated>2022-03-01T20:21:00.601+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>Activity selection problem</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;You are given n activities with their start and finish times. Select the maximum number of activities that can be performed by a single person, assuming that a person can only work on a single activity at a time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;CODE:&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;language-cpp&quot;&gt;&lt;br /&gt;#include &amp;lt;bits/stdc++.h&amp;gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;     int n;&lt;br /&gt;     cin&amp;gt;&amp;gt;n;&lt;br /&gt;     int start[n],ending[n];&lt;br /&gt;     for(int i=0;i&amp;lt;n;i++)&lt;br /&gt;      {&lt;br /&gt;          cin&amp;gt;&amp;gt;start[i];&lt;br /&gt;          cin&amp;gt;&amp;gt;ending[i];&lt;br /&gt;      }&lt;br /&gt;      //to sort the elements in terms of ending time&lt;br /&gt;      priority_queue&amp;lt;pair&amp;lt;int,int&amp;gt;,vector&amp;lt;pair&amp;lt;int,int&amp;gt;&amp;gt;,greater&amp;lt;pair&amp;lt;int,int&amp;gt;&amp;gt;&amp;gt;pq;&lt;br /&gt;	for(int i=0;i&amp;lt;n;i++)&lt;br /&gt;	{&lt;br /&gt;   		 pq.push(make_pair(ending[i],start[i]));&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	//to track the count of activities selected&lt;br /&gt;&lt;br /&gt;	int c=0;&lt;br /&gt;&lt;br /&gt;	//to store the activities selected&lt;br /&gt;&lt;br /&gt;	vector&amp;lt;int&amp;gt;v1,v2;&lt;br /&gt;	int p=pq.top().first;&lt;br /&gt;	int q=pq.top().second;&lt;br /&gt;	pq.pop();&lt;br /&gt;	c++;&lt;br /&gt;	v1.push_back(q);&lt;br /&gt;	v2.push_back(p);&lt;br /&gt;	while(!pq.empty())&lt;br /&gt;	{&lt;br /&gt;		if(pq.top().second&gt;=p)&lt;br /&gt;   		{&lt;br /&gt;&lt;br /&gt;          c++;  &lt;br /&gt;          p=pq.top().first;        &lt;br /&gt;          q=pq.top().second;&lt;br /&gt;          v1.push_back(q);&lt;br /&gt;          v2.push_back(p);&lt;br /&gt;    	}&lt;br /&gt;   		pq.pop;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	cout&amp;lt;&amp;lt;&quot;Total no. of activities selected   &quot;&amp;lt;&amp;lt;c&amp;lt;&amp;lt;endl;&lt;br /&gt;	cout&amp;lt;&amp;lt;&quot;The start time and end time of the activities are&quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;	for(int i=0;i&amp;lt;v1.size();i++)&lt;br /&gt;	{&lt;br /&gt;    	cout&amp;lt;&amp;lt;&quot;( &quot;&amp;lt;&amp;lt;v1[i]&amp;lt;&amp;lt;&quot; , &quot;&amp;lt;&amp;lt;v2[i]&amp;lt;&amp;lt;&quot; )&quot;&amp;lt;&amp;lt;endl;&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;OUTPUT:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-ny29CTqv0Us/YJkxLYst9UI/AAAAAAAABeY/Lg7LzGaRe58NRzNzaAPGJQOESkCHVlkoQCLcBGAsYHQ/image.png&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;405&quot; data-original-width=&quot;571&quot; height=&quot;227&quot; src=&quot;https://lh3.googleusercontent.com/-ny29CTqv0Us/YJkxLYst9UI/AAAAAAAABeY/Lg7LzGaRe58NRzNzaAPGJQOESkCHVlkoQCLcBGAsYHQ/image.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8576713545897405987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/activity-selection-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8576713545897405987'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8576713545897405987'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/activity-selection-problem.html' title='Activity selection problem'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-ny29CTqv0Us/YJkxLYst9UI/AAAAAAAABeY/Lg7LzGaRe58NRzNzaAPGJQOESkCHVlkoQCLcBGAsYHQ/s72-c/image.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-707424730618882165</id><published>2021-05-08T18:57:00.000+05:30</published><updated>2021-05-08T18:57:15.472+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="automata theory-theory of computation"/><title type='text'>Construct a DFA that accepts any strings over {a,b} that doesn&#39;t contain the string aabb in it.</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;Construct a DFA that accepts any strings over {a,b} that doesn&#39;t contain the string aabb in it.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: times; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;To solve this problem, first we will construct a DFA that accepts all strings over {a,b} that accepts the string aabb in it.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-_IhcKqaS_eI/YJaQvUhobWI/AAAAAAAABeI/DOflB1W3gt4riXxWHmq0lSO1xHWAz4hOQCLcBGAsYHQ/s1280/WhatsApp%2BImage%2B2021-05-08%2Bat%2B6.48.36%2BPM.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;411&quot; data-original-width=&quot;1280&quot; height=&quot;129&quot; src=&quot;https://1.bp.blogspot.com/-_IhcKqaS_eI/YJaQvUhobWI/AAAAAAAABeI/DOflB1W3gt4riXxWHmq0lSO1xHWAz4hOQCLcBGAsYHQ/w396-h129/WhatsApp%2BImage%2B2021-05-08%2Bat%2B6.48.36%2BPM.jpeg&quot; width=&quot;396&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;We can get the dfa that accepts all other strings except aabb by complementing above DFA. To do that, make all final states as non-final states and all non-final states as final states. The final DFA is shown below.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-k9NpQl4k4Eo/YJaRaBJkkXI/AAAAAAAABeQ/tVSfv1Fo8kUDKT-7hbJ5Q6yZ5YcDdE4YACLcBGAsYHQ/s1280/WhatsApp%2BImage%2B2021-05-08%2Bat%2B6.51.34%2BPM.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;298&quot; data-original-width=&quot;1280&quot; height=&quot;149&quot; src=&quot;https://1.bp.blogspot.com/-k9NpQl4k4Eo/YJaRaBJkkXI/AAAAAAAABeQ/tVSfv1Fo8kUDKT-7hbJ5Q6yZ5YcDdE4YACLcBGAsYHQ/w640-h149/WhatsApp%2BImage%2B2021-05-08%2Bat%2B6.51.34%2BPM.jpeg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/707424730618882165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/construct-dfa-that-accepts-any-strings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/707424730618882165'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/707424730618882165'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/construct-dfa-that-accepts-any-strings.html' title='Construct a DFA that accepts any strings over {a,b} that doesn&#39;t contain the string aabb in it.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-_IhcKqaS_eI/YJaQvUhobWI/AAAAAAAABeI/DOflB1W3gt4riXxWHmq0lSO1xHWAz4hOQCLcBGAsYHQ/s72-w396-h129-c/WhatsApp%2BImage%2B2021-05-08%2Bat%2B6.48.36%2BPM.jpeg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-8414871198383933237</id><published>2021-05-08T18:37:00.002+05:30</published><updated>2021-05-08T18:38:59.209+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="algorithm"/><title type='text'>Heap sort in c</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;span style=&quot;font-family: courier;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;void swap(int *x, int *y)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int temp=*x;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; *x=*y;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; *y=temp;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;void heapify(int a[], int n, int i)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int largest= i;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int l=2*i +1;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int r=2*i +2;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if(l&amp;lt;n &amp;amp;&amp;amp; a[l]&amp;gt;a[largest])&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; largest=l;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if(r&amp;lt;n &amp;amp;&amp;amp; a[r]&amp;gt;a[largest])&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; largest=r;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if(largest!=i)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; swap(&amp;amp;a[i], &amp;amp;a[largest]);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; heapify(a,n,largest);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;void heapsort(int a[], int n)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; for(int i=n/2-1;i&amp;gt;=0;i--)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; heapify(a,n,i);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; for(int i=n-1;i&amp;gt;0;i--)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; swap(&amp;amp;a[0],&amp;amp;a[i]);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; heapify(a,i,0);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;int main()&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int n;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;n);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; int a[n];&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;n;i++)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;a[i]);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; heapsort(a,n);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;n;i++)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; printf(&quot;%d &quot;,a[i]);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-xcifINjHneM/YJaNXye95FI/AAAAAAAABeA/AsVwHxcjhgwCDlzJU595oyfm6ZDx_jXpgCLcBGAsYHQ/s1920/monitor-1307227_1920.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1355&quot; data-original-width=&quot;1920&quot; src=&quot;https://1.bp.blogspot.com/-xcifINjHneM/YJaNXye95FI/AAAAAAAABeA/AsVwHxcjhgwCDlzJU595oyfm6ZDx_jXpgCLcBGAsYHQ/s320/monitor-1307227_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/8414871198383933237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/heap-sort-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8414871198383933237'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/8414871198383933237'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/heap-sort-in-c.html' title='Heap sort in c'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-xcifINjHneM/YJaNXye95FI/AAAAAAAABeA/AsVwHxcjhgwCDlzJU595oyfm6ZDx_jXpgCLcBGAsYHQ/s72-c/monitor-1307227_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1103220104600298126.post-1920690536271203660</id><published>2021-05-08T18:35:00.002+05:30</published><updated>2021-05-08T18:58:37.821+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="automata theory-theory of computation"/><title type='text'>THEORY OF COMPUTATION</title><content type='html'>&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-V_gYGiF9q_8/YJaISgOVXsI/AAAAAAAABd4/57qTCwRvKHsX-6Bac-HxpVRqQe27CGF4QCLcBGAsYHQ/s1920/monitor-1307227_1920.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1355&quot; data-original-width=&quot;1920&quot; src=&quot;https://1.bp.blogspot.com/-V_gYGiF9q_8/YJaISgOVXsI/AAAAAAAABd4/57qTCwRvKHsX-6Bac-HxpVRqQe27CGF4QCLcBGAsYHQ/s320/monitor-1307227_1920.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;Theory of computation is all about what kind of things you can compute mechanically and how fast and how much space does it required to do so.&amp;nbsp;&lt;p&gt;&lt;/p&gt;&lt;p&gt;RELATED POSTS:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;1.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/find-nfa-that-accepts-language-l-aa-b.html&quot;&gt;Find an nfa that accepts the language L (aa* (a + b))- solution of Peter Linz&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;2.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/write-regular-expressions-for-following.html&quot;&gt;Write regular expressions for the following languages on {0, 1}- Solution of Peter Linz&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;3.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/give-regular-expressions-for-following.html&quot;&gt;Give regular expressions for the following languages on Σ = {a, b, c}- solution of Peter Linz&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;4.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/does-expression-0-1-0-1-00-0-1-denote.html&quot;&gt;Does the expression ((0 + 1) (0 + 1)*)* 00 (0 + 1)* denote the language L(r) = {w ∈ Σ*: w has at least one pair of consecutive zeros}, for Σ = {0, 1} ?&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;5.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/find-all-strings-in-la-b-b-ab-of-length.html&quot;&gt;Find all strings in L((a + b) b (a + ab)*) of length less than four.&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;6.&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/for-ab-construct-dfas-that-accept-sets.html&quot;&gt;For  ∑ ={ a,b }, construct dfa&#39;s that accept the sets consisting of&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;7.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/03/consider-set-of-strings-on-01-defined.html&quot;&gt;Consider the set of strings on {0,1} defined by the requirements below. For each construct an accepting DFA-solution of peter linz&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;8.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/minimize-following-dfa-using-table.html&quot;&gt;Minimize  the following DFA using table filling method or Myhill-Nerode Theoram&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;9.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/let-lab-aa-baa-which-of-following.html&quot;&gt;ASSIGNMENT OF AUTOMATA THEORY&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;10.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/design-nfa-which-accepts-all-strings.html&quot;&gt;Design an NFA which accepts all the strings over {0,1} which ends with &#39;01&#39;. Construct the equivalent DFA of this NFA.&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;11.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/02/design-nfa-for-language-that-accepts.html&quot;&gt;Design an NFA for a language that accepts all strings over {0,1} in which the second last symbol is always &#39;1&#39;, then convert it to it&#39;s equivalent DFA.&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;12.&amp;nbsp;&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/04/theory-of-computation-mcq-questions.html&quot;&gt;THEORY OF COMPUTATION MCQ QUESTIONS&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;13.&lt;span&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.cuplex2b.com/2021/05/construct-dfa-that-accepts-any-strings.html&quot;&gt;Construct a DFA that accepts any strings over {a,b} that doesn&#39;t contain the string aabb in it.&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://www.cuplex2b.com/feeds/1920690536271203660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.cuplex2b.com/2021/05/theory-of-computation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1920690536271203660'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1103220104600298126/posts/default/1920690536271203660'/><link rel='alternate' type='text/html' href='https://www.cuplex2b.com/2021/05/theory-of-computation.html' title='THEORY OF COMPUTATION'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-V_gYGiF9q_8/YJaISgOVXsI/AAAAAAAABd4/57qTCwRvKHsX-6Bac-HxpVRqQe27CGF4QCLcBGAsYHQ/s72-c/monitor-1307227_1920.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>