Skip to content
  • 0 Votes
    5 Posts
    1k Views
    zareenZ
    https://www.youtube.com/watch?v=3IaB2a8tXLA
  • 0 Votes
    3 Posts
    963 Views
    zaasmiZ
    https://m.youtube.com/watch?v=4_H2xc0P96Q&feature=youtu.be https://youtu.be/qVw5CQdcg08
  • 0 Votes
    4 Posts
    2k Views
    zareenZ
    @zareen Solution: Question # 01 8 Marks Convert a decimal number 724 into its equivalent binary numbers. You are required to show the complete steps of conversion and also write the final answer in its equivalent binary numbers. 2 724 2 362- 0 2 181- 0 2 90- 1 2 45- 0 2 22- 1 2 11- 0 2 5- 1 2 2- 1 1- 0 Answer: (724)2 =1011010100 Question # 02 12 Marks Complete the following truth table by using the stated Boolean logical operations. A B C A + B A . C (A + B) ⊕ C 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 0
  • 0 Votes
    21 Posts
    12k Views
    zareenZ
    Solution Files: Fall 2019_CS506_2_SOL.zip
  • 0 Votes
    9 Posts
    2k Views
    zareenZ
    Assignment No. 2 Solution and Discussion Semester: Fall 2019 CS408 – Human Computer Interaction Question No. 1: Analyze the following scenario and write down seven stages of action for given particular scenario for solution. Scenario is: Suppose I want to go to market, but the tyre of my car got punctured. Now I have to repair it. You are required to write the seven stages of Gulf of Execution and Evaluation to solve the scenario. Human computer interaction and user experience design. One of the topics he covers in his book is a model/framework of how people act when they’re interacting in the world to reach their larger goals. This model is called the seven stages of action (or Norman’s Action Cycle) The model belongs to one of the most famous Interaction theories that have been used to model user behavior, evaluation, and to set up policies like to create user-friendly interfaces. The model can be divided into an execution phase and a phase of the evaluation. Scenario is: Suppose I want to go to market, but the tyre of my car got punctured. Now I have to repair it. It starts with the execution part • Specifying/forming a goal about something that you want to accomplish (My goal is going to market across the street but car tyre in punctured so I find first tyre shop ) • Forming an intention to act (I form the intention of crossing the street to reach the tyre puncture shop) • Selecting an action or a sequence of actions that will lead you to your set goal (I select the action to press the key to start the car and crosswalk signal for crossing the street ) • Execution of the action(s) (I actually do press the key to start the car and with the help to other to crosswalk signal by physical action and I do cross the street). After the execution part, the evaluation part begins: • Perception the state of the world/system (I Perceive that I’m now across the street to reach the shop) • Interpretation of this perception based on your expectations (I interpret this perception and help of other to find it) • Evaluating the outcome: Is the evaluation successful the problem is solved , goal reached and now go to the market . Question No. 2 Consider a scenario; you are an HCI specialist in a renowned software house. Here your task is to check out design principles for two given websites. • https://www.freelancer.pk/ • https://www.fiverr.com/ You are required to explain four Design principles according to the given websites. https://www.freelancer.pk/ ANS: Design Principles There is no real consensus in the design community about what the main principles of design actually are. That said, the following twelve principles are those mentioned most often in articles and books on the subject. Contrast One of the most common complaints designers have about client feedback often revolves around clients who say a design needs to “pop” more. While that sounds like a completely arbitrary term, what the client generally means is that the design needs more contrast. Contrast refers to how different elements are in a design, particularly adjacent elements. These differences make various elements stand out. Contrast is also a very important aspect of creating accessible designs. Insufficient contrast can make text content in particular very difficult to read, especially for people with visual impairments. Balance Every element of a design—typography, colors, images, shapes, patterns, etc.—carries a visual weight. Some elements are heavy and draw the eye, while other elements are lighter. The way these elements are laid out on a page should create a feeling of balance. There are two basic types of balance: symmetrical and asymmetrical. Symmetrical designs layout elements of equal weight on either side of an imaginary center line. Asymmetrical balance uses elements of differing weights, often laid out in relation to a line that is not centered within the overall design. Emphasis Emphasis deals with the parts of a design that are meant to stand out. In most cases, this means the most important information the design is meant to convey.Emphasis can also be used to reduce the impact of certain information. This is most apparent in instances where “fine print” is used for ancillary information in a design. Tiny typography tucked away at the bottom of a page carries much less weight than almost anything else in a design, and is therefore deemphasized. Proportion Proportion is one of the easier design principles to understand. Simply put, it’s the size of elements in relation to one another. Proportion signals what’s important in a design and what isn’t. Larger elements are more important, smaller elements less. Pattern Patterns are nothing more than a repetition of multiple design elements working together. Wallpaper patterns are the most ubiquitous example of patterns that virtually everyone is familiar with. In design, however, patterns can also refer to set standards for how certain elements are designed. For example, top navigation is a design pattern that the majority of internet users have interacted with. You are required to explain four Design principles according to the given websites. https://www.fiverr.com/ ANS: Security guarantee We build wordpress websites that have solid security measures build in to make them less prone to hacking and spam attacks. To date, none of the sites we have developed have been hacked or ddos attacked! Loading speed guarantee In our fast-paced world, your website needs to load fast too, under 3 seconds, if not visitors will leave, bounce rates increase and your conversions nosedive! We guarantee load speeds of under 2-3 seconds. Seo optimized guarantee Your site will be built with all the latest seo measures in place to make sure when Google crawls your site, your rankings will increase. We guarantee a seo optimized site. Mobile optimized guarantee With over 60% of internet traffic going over mobile devices, your site should work seamless on all platforms. We guarantee a mobile optimized site. User friendly guarantee We build clean designed sites and follow the latest ux and ui design principles, making sure your website users have a pleasant experience on your site and you will enjoy low bounce rates.
  • 0 Votes
    10 Posts
    2k Views
    zareenZ
    <!DOCTYPE html> <html> <head> <title>IT430 ASSIGNMENT NO 2 </title> </head> <body bgcolor="@B6D53B"> <center> <h2>Grade Book Calculator</h2> <h4 >Welcom To Grade Book Calculator</h4> <form id="myform"> <table> <tr> <td> Student_ID: </td> <td> <input id="studentid" oninvalid="alert('Please Enter Student_ID ')" type="text" placeholder="Enter your VU ID" required="required" /> </td> </tr> <tr> <td> Name: </td> <td> <input id="nameid" oninvalid="alert('Please Enter Name ')" type="text" required="required" /> </td> </tr> <tr> <td> Father Name: </td> <td> <input id="fathernameid" oninvalid="alert('Please Enter Father Name ')" type="text" required="required" /> </td> </tr> <tr> <td> CNIC: </td> <td><input id="cnicid" pattern="^[0-9+]{5}-[0-9+]{7}-[0-9]{1}$" oninvalid="alert('Please Enter CNIC ')" type="text" required="required" /> </td> </tr> <tr> <td> English: </td> <td><input type="text" id="englishid" oninvalid="alert('Please Enter English Marks ')" name="english" required="required" /> </td> </tr> <tr> <td> Computer: </td> <td><input type="text" id="computerid" oninvalid="alert('Please Enter Computer Marks ')" name="computer" required="required" /> </td> </tr> <tr> <td> Math: </td> <td><input type="text" id="mathid" oninvalid="alert('Please Enter Math Marks ')" name="math" required="required" /> </td> </tr> <tr> <td> <input type="submit" onclick="calculate()"/> <input type="reset"> </td> </table> </form> </center> <script> function calculate(){ var field1 = parseInt(document.getElementById("englishid").value); var field2 = parseInt(document.getElementById("computerid").value); var field3 = parseInt(document.getElementById("mathid").value); var result = (field1+field2+field3)/3; alert(result); } </script> </body> </html>
  • 0 Votes
    5 Posts
    2k Views
    zareenZ
    @zareen said in CS205 Assignment 2 Solution and Discussion: A user noticed that someone is using his Facebook account after stealing his credentials. After investigation, he observed that it happened after installing a software downloaded from an un-authentic website. Aug 25, 2019 - Hacked Facebook accounts are being sold on the dark web, showing the … Problem is that since so many web sites make you use your email for log in name, I’m not … 90 EACH days after the ‘worst ever’ hack of 50 million users (and here’s … a hacker has claimed he sold the plaintext passwords and email … link text
  • 0 Votes
    3 Posts
    1k Views
    zareenZ
    //<!--CS602 ASSIGNMENT 2 SOLUTION--> //<!--FALL 2019--> //<!--DUE DATE: 27 NOVEMBER, 2019--> //PRE-PARED BY: SUPERSTARWEBTECH.COM //CONNECT WITH US:FACEBOOK.COM/SUPERSTARWEBTECH //E-MAIL: SUPERSTARWEBTECH@GMAIL.COM #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <graphics.h> #include <math.h> class House { private: int x1,x2,x3,x4,x5; int y1,y2,y3; int dx1, dx2; int dy1, dy2; int xc,yc; public: House() { xc=45; yc=65; //center of figure x1=30; x2=x1+50; x3=20; x4=x3+20; x5=x4+50; y1=30; y2=y1+20; y3=y2+50; dx1=x3+5; dx2=dx1+10; dy1=y2+30; dy2=dy1+20; } void translate(int tx, int ty) //draw translate house { x1+=tx; x2+=tx; x3+=tx; x4+=tx; x5+=tx; y1+=ty; y2+=ty; y3+=ty; dx1+=tx; dx2+=tx; dy1+=ty; dy2+=ty; } void scale(int sx, int sy) //draw scaled house { x1=xc+(x1-xc)*sx; x2=xc+(x2-xc)*sx; x3=xc+(x3-xc)*sx; x4=xc+(x4-xc)*sx; x5=xc+(x5-xc)*sx; y1=yc+(y1-yc)*sy; y2=yc+(y2-yc)*sy; y3=yc+(y3-yc)*sy; dx1=xc+(dx1-xc)*sx; dx2=xc+(dx2-xc)*sx; dy1=yc+(dy1-yc)*sy; dy2=yc+(dy2-yc)*sy; } void reflectx(int rx) { y1=-y1+rx; y2=-y2+rx; y3=-y3+rx; dy1=-dy1+rx; dy2=-dy2+rx; } void reflecty(int ry) { x1=-x1+ry; x2=-x2+ry; x3=-x3+ry; x4=-x4+ry; x5=-x5+ry; dx1=-dx1+ry; dx2=-dx2+ry; } void drawH() //draw house { int arr[]={x1,y1,x2,y1,x5,y2,x5,y3,x3,y3,x3,y2,x1,y1,x4,y2,x4,y3,x3,y3,x3,y2,x5,y2}; drawpoly(12,arr); //draw house rectangle(dx1,dy1,dx2,dy2); //draw house door } void fillH() { setfillstyle(HATCH_FILL,GREEN); floodfill(x1+1,y1+10,WHITE); floodfill(x1+1,y1+1,WHITE); setfillstyle(SOLID_FILL,RED); floodfill(x3+1,y2+1,WHITE); setfillstyle(SOLID_FILL,YELLOW); floodfill(x4+1,y2+1,WHITE); setfillstyle(SOLID_FILL,GREEN); floodfill(dx1+1,dy1+1,WHITE); } void fillH2(){ setfillstyle(HATCH_FILL,GREEN); floodfill(x1+1,y1-10,WHITE); floodfill(x1+1,y1-1,WHITE); setfillstyle(SOLID_FILL,RED); floodfill(x3+1,y2-1,WHITE); setfillstyle(SOLID_FILL,YELLOW); floodfill(x4+1,y2-1,WHITE); setfillstyle(SOLID_FILL,GREEN); floodfill(dx1+1,dy1-1,WHITE); } }; int main() { int gd=DETECT, gm; initgraph(&gd,&gm,(char*)" "); setcolor(WHITE); settextstyle(DEFAULT_FONT, HORIZ_DIR, 2); outtextxy(2, 2, (char*)"BC123456789"); House house; //draw main house house.drawH(); house.fillH(); outtextxy(2, 110, (char*)"1) Original"); //draw translated house house.translate(200,0); house.drawH(); house.fillH(); outtextxy(200, 110, (char*)"2) Translated"); //draw scaled house house.translate(-190,70); house.scale(2,2); house.drawH(); house.fillH(); outtextxy(2, 280, (char*)"3) Scaled"); int x=90; int y=350; House h2; // draw reflected house h2.translate(200,70); h2.reflecty(x); h2.reflectx(y); h2.reflecty(x); h2.drawH(); h2.fillH2(); outtextxy(200, 270, (char*)"4) Reflected"); getch(); closegraph(); } //<!--NOTE--> //<!--MAKE CHANGES ACCORDING TO YOUR REQUIREMENTS--> //<!--DO NOT POST ON OTHER PORTALS THIS WILL LEAD TO COPYING OF CODE AND THEN YOU WILL GET ZERO MARKS FOR IT--> //<!--PLUS TYPE YOUR OWN SOLUTION FOR NOT LOSING MARKS--> //<!--DO NOT COPY PASTE--> //<!--WE ARE NOT RESPONSIBLE FOR GETTING ZERO MARKS IN ASSIGNMENT--> //PRE-PARED BY: SUPERSTARWEBTECH.COM //CONNECT WITH US:FACEBOOK.COM/SUPERSTARWEBTECH //E-MAIL: SUPERSTARWEBTECH@GMAIL.COM CS602_2_FALL_2019.txt Displaying CS602_2_FALL_2019.txt.
  • 0 Votes
    3 Posts
    914 Views
    zareenZ
    Solution: // Header Files #include<stdio.h> #include<conio.h> #include<BIOS.H> #inlcude<DOS.H> void interrupt (*oldTimer)(*void); // To store current Timer vector void interrupt newTimer(); //New Timer Function char far *scr= (char far *)0xB8000000; //Screen segment int in, t=0; void main() { clrscr(); oldTimer=getvect(8); setvect(8,newTimer); getch(); } void interrupt newTimer(); { *(scr+t)=0x2A; t++; if(t>=126) { for(i=0;i<4000;i+=2) { *(scr+i)=0x20; // Blank screen *(scr+i+1)=0x07; } t=0; } (*oldTimer)(); } }
  • 0 Votes
    3 Posts
    2k Views
    zareenZ
    ASSIGNMENT NO:2 Course: CS302 1: Write the SOP expression for the given sum. Sol: A B C D E 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 A B C D E OUTPUT (F) 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 0 FOR SOP WE FOCUS ON 1 VALUE. A B C D E MINTERM 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 ABCDE SOP EXPRESSION: SUM OF PRODUCT EXPRESSION 2: Find Prime Implicant of minterm using QuineMcculsky method. Step-1 00010 2 00100 4 01000 8 10000 16 00110 6 01010 10 01100 12 10010 18 10100 20 11000 24 01110 14 10110 22 11010 26 11100 28 11110 30 Step-2 2,6(00-10) 2,10(0-010) 2,18(-0010) 4,12(0-100) 4,6(001-0) 4,20(-0100) 8,10(010-0) 8,24(-1000) 16,18(100-0) 16,20(10-00) 16,24(10-00) 6,14(0-110) 6,22(-0110) 10,14(01-10)10,26(-1010) 12,14(011-0) 12,28(-1100) 18,26(1-010) 18,22(10-10) 20,22(101-0) 20,22(1-100) 24,26(110-0) 24,28(11-00) 14,30(-1110) 22,30(1-110) 26,30(11-10) 28,30(111-0) Step-3 2,6,18,22(-0-10) 2,6,10,14( 0–10)2,10,18,26(–010)2,18,6,22(-0-10) 2,18,10,26(–010)4,12,6,14(0-1-0) 4,6,12,14 (0-1-0) 4,6,20,22(-01-0)4,20,6,22(-01-0) 4,20,12,28(–100) 8,10,12,14(01–0) 8,24,10,26(-10-0) 8,24,12,28 (-1-00) 6,14,22,30 (–110) 6,22,14,30(–110) 10,14,26,30(-1-10) 10,26,14,30(-1-10) 12,14,28,30(-11-0) 12,14,28,30(-11-0) 18,26,22,30(1–10) 18,22,26,30(1–10) 20,22,28,30(1-1-0) 20,22,22,30(1-1-0) 24,26,28,30(11–0) 24,28,26,30(11–0) Step-3 2,6,18,22(-0-10) 4,6,20,22(-01-0) 2,18,10,22(-0-10) 4,20,6,22(-01-0) 2,10,18,26(–010) 4,12,6,14(0-1-0) 2,18,6,22(–010) 4,6,12,14 (0-1-0) 4,20,12,28(–100) 10,14,26,30(-1-10) 6,14,22,30 (–110) 10,26,14,30(-1-10) 12,14,28,30(-11-0) 18,26,22,30(1–10) 12,14,28,30(-11-0) 18,22,26,30(1–10) 20,22,28,30(1-1-0) 24,26,28,30(11–0) 20,22,22,30(1-1-0) 24,28,26,30(11–0) 6,22,14,30(–110) 8,10,12,14(01–0) 8,24,12,28 (-1-00) 8,24,10,26(-10-0) Step-4 2,6,8,22(-0-10) 4,6,20,22(-01-0) 2,10,18,26(–010) 4,12,6,14(0-1-0) 4,20,12,28(–100) 10,14,26,30(-1-10) 12,14,28,30(-11-0) 18,26,22,30(1–10) 20,22,28,30(1-1-0) 24,26,28,30(11–0) 6,22,14,30(–110) 8,10,12,14(01–0) 8,24,12,28 (-1-00) 8,24,10,26(-10-0) These are the prime implicates cs302-assign 2.docx
  • 2 Votes
    14 Posts
    10k Views
    zareenZ
    Solution # 1 Instruction Processor Hexadecimal Code Behavioral RTL JPL R5, [26] Falcon - A 10000 101 00011010, 1000 0101 0001 1010, 851A (R[5] ≥ 0): PC ← PC+ (26-PC); STS R7, R2 (100) Falcon - E 00101 111 010, 000000000000001100100, 0010 1111 0100 0000, 0000 0000 0110 0100, 2F40 0064 M[R[2]+100] ← R [7] STACC R4, 36 Modified EAGLE 10111 100 00100100, 1011 1100 0010 0100, BC24 M[R[4] + (8@C<7>)©C] ← ACC C represents the constant 36 DIV R2 EAGLE 10000 010, 1000 0010, 82 R[0] ← R[0]/R[2] R[2] ← R[0]%R[2] SHIFTL R5, R2, 7 FALCON - A 01100 101 010 00111, 0110 0101 0100 0111, 6547 R[5]<15…0> ← R [2]<(15- N)…0>©(N@0) N represents constant 7 Solution # 2 Instruction Value of Destination Operand Data Bus <15…0> Address Bus (15…0> LDACC B 55CEh 55CEh 3320h SUB R1 55B9h N/A N/A LDACC C 2015h 2015h AB0Eh ADD R2 45E0h N/A N/A STACC A 45E0h 45E0h AB10h Table 3 Data Bus and Address Bus Contents for Modified Eagle Calculation Steps (Instruction-By-Instruction) • LDACC B LDACC stands for load accumulator. In LDACC, the destination operand is accumulator and source operand is the memory location labelled as B. The memory label B points to the memory address 3320h. When this instruction is executed, the value stored at memory address 3320h will be read and loaded in Accumulator register. This address 3320h will be copied into Address Bus which will then read its contents from memory and load the contents at data bus. The operand size in Modified EAGLE is 2-byte. Therefore, the values stored at addresses 3320h and 3321h will be loaded at data bus. These values are CEh and 55h respectively. Since, Modified EAGLE employs Little endian notation hence, the 2-bye value will be read as 55CEh. The value of data bus will also be 55CEh and this will be loaded into destination operand Accumulator. • SUB R1 SUB R1 means to subtract the value of source operand register R1 which is 0015h, from the destination operand Accumulator (ACC) register which contains 55CEh. The result of subtraction will be stored back into ACC. After subtraction, the value stored in ACC will be 55B9h. Because SUB is not a memory instruction, we are not concerned with the contents of Data Bus or Address Bus because the values we need to execute the instruction are already available in registers. Hence, Data Bus and Address Bus values will be labelled as N/A. • LDACC C When this instruction is executed, the value stored at memory address labelled with C is read and loaded in Accumulator register ACC. In this case, the address of the C is AB0Eh which is also the value of address bus. The operands in Modified EAGLE are 2-byte values. The contents at addresses AB0Eh and AB0Fh will be copied into data bus which will then be loaded into ACC register. These contents are 15h and 20h. Due to Little endian notation, the 2-bye value will be 2015h. The value of data bus will be 2015h and same will be loaded in destination register ACC. • ADDR2 When ADD is executed, the value of register R2 is added to ACC register. Hence, after the execution, the ACC register will hold 45E0h. AS usual, ADD is not a memory instruction, so we are not concerned with the values of Data Bus and Address Bus and both are labelled as N/A. • STACC A STACC stands for Store ACC. There is one destination operand which is a memory label A. When the instruction is executed, the value of Accumulator register ACC is stored at the memory address labelled by A. The destination memory address will be AB10h. The value of ACC is 45E0h will be stored as address AB10h. However, due to Little-Endian notation, the address will be stored as E0h at memory location AB10h and then 45h at memory location AB11h.
  • 0 Votes
    4 Posts
    4k Views
    zareenZ
    Ideas Solution Code #include <iostream> #include <time.h> #include <stdlib.h> using namespace std; const int rows = 10; const int cols = 10; int selectOption(){ int choice = 0; cout<<"Press 1 to populate a two-dimensional array with integers from 1 to 100\n"; cout<<"Press 2 to display the array elements\n"; cout<<"Press 3 to display the largest element present in the array along with its row and column index\n"; cout<<"Press 4 to find and show the transpose of the array\n"; cout<<"Press 5 To Exit\n"; cout<<"\nPlease select an option, use numbers from 1 to 5: "; do { cin>>choice; if(choice >= 1 && choice <= 5){ break; } else { cout<<"\nChoice should be between 1 and 5\n"; cout<<"Invalid choice, please select again: "; } } while(true); cout<<"___________________________________________________\n"; return choice; } // end selectOption function void populateArray(int data[rows][cols]){ srand(time(0)); for(int i = 0; i < rows; i++){ for(int j = 0; j < cols; j++){ data[i][j] = rand() % 100 + 1; } } cout<<"Array populated sucessfully\n"; } // end of poulateArray function void showElements(int data[rows][cols]){ for(int i = 0; i < rows; i++){ for(int j = 0; j < cols; j++){ cout<<data[i][j]<<"\t"; } cout<<endl; } } // end of showElements function void showLargestElement(int data[rows][cols]){ int largest = 1, row =0, col = 0; for(int i = 0; i < rows; i++){ for(int j = 0; j < cols; j++){ if(data[i][j] > largest){ largest = data[i][j]; row = i; col = j; } } } cout<<"Largest element is "<<largest<<" which is at row = "<<row+1<<" or index = "<<row<<" and column "<<col+1<<" or index "<<col<<endl; } // end of showLargestElement function void transposeArray(int data[rows][cols]){ for(int i = 0; i < cols; i++){ for(int j = 0; j < rows; j++){ cout<<data[j][i]<<'\t'; } cout<<endl; } } // end of transposeArray function main(){ int choice = 0, data[rows][cols] = {0}; do{ choice = selectOption(); switch(choice){ case 1: cout<<endl; populateArray(data); cout<<endl; break; case 2: if(data[0][0] == 0){ cout<<"\nSorry the array is empty, first populate it by pressing 1 to perform this task"<<endl<<endl<<endl; continue; } cout<<endl; showElements(data); cout<<endl; break; case 3: if(data[0][0] == 0){ cout<<"\nSorry the array is empty, first populate it by pressing 1 to perform this task"<<endl<<endl<<endl; continue; } cout<<endl; showLargestElement(data); cout<<endl; break; case 4: if(data[0][0] == 0){ cout<<"\nSorry the array is empty, first populate it by pressing 1 to perform this task"<<endl<<endl<<endl; continue; } cout<<endl; transposeArray(data); cout<<endl; break; } }while(choice != 5); // end of do-while loop } // end of main function
  • 0 Votes
    4 Posts
    1k Views
    zareenZ
    Fall 2019_CS508_2_SOL-1.rar
  • 0 Votes
    6 Posts
    2k Views
    zareenZ
    Solution: Question No. 01: The name of the algorithm being used for sorting the given array has given below. Selection sort Question No. 02: The Pseudo code for the algorithm used for sorting the given array has given below. Pseudo code: 1 Selection sort (A) { 2 For i 1 to A.lenght-1 { 3 imin i 4 for j i+1 to A.length { 5 If (A[j] < A[imin]) Imin j } 6 Temp A[i] 7 A[i] A[imin] 8 A[imin] Temp } } Question No. 03: The step by stem analysis of the algorithm designed in question 2 is as follow, The time taken by each statement (step) is given as follows, [image: PetMmcY.png] Selection sort (A) Cost Times { For i 1 to A.length-1 |c1 | n { imin i--------------------> c2 n-1 for j i+1 to A.length { c3 n+n-1+…1=n(n+1)/2 If (A[j] < A[imin]) imin j } Temp A[i] c4 n-1 A[i] A[imin] c5 n-1 A[imin] Temp c6 n-1 } } Total time T(n) can be calculated as follows, T(n)= c1n+c2(n-1)+c3(n(n+1)/2)+c4(n-1)+c5(n-1)+c6(n-1) c1n+c2n-c2+c3 (n2+n/2) +c4n-c4+c5n-c5+c6n-c6 collect the like terms c3n2/2+ (c1+c2+c3/2+c4+c5+c6) n + (-c2-c4-c5-c6) This is equivalent to a polynomial an2+bn+c Therefore T (n) = Big O (n2) by taking the highest order term of the equation. Note: a, b, c in polynomial represents constants // Ignoring constant terms T(n) = O (n2)
  • 0 Votes
    8 Posts
    2k Views
    zareenZ
    Solution: Q. 1 Answer P0 P4 P3 P2 P1 P5 0 2 5 9 10 16 24 Total Waiting Time = 0+2+5+1+10+16 = 34 Seconds Average Waiting Time = 34/6 = 5.66 Seconds Q.2 Answer: Solution 1: P0 P1 P3 P0 P2 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time- Arrival Time Turnaround time for P0 = 31-0 = 31 P1 = 16-4 = 12 P2 = 66-18 = 48 P3 = 57- 5= 52 Total Turnaround Time = 39+12+48+52 = 143 Average Turnaround Time = 143 / 4 =35.75 millisecond Waiting Time= Turnaround Time- Burst Time Waiting time for P0 = 31-15 = 16 P1 = 12-8 = 4 P2 = 48-25 = 23 P3 = 52-18 = 34 Total Waiting Time = 16+4+23+34 =77 Average Waiting Time = 77 / 4 =19.25 millisecond Solution 2: P0 P1 P3 P2 P0 P3 P2 P3 P2 P2 0 8 16 24 31 39 47 55 57 65 66 Turnaround time= Exit Time- Arrival Time Turnaround time for P0 = 39-0 = 39 P1 = 16-4 = 12 P2 = 66-18 = 48 P3 = 57- 5= 52 Total Turnaround Time = 39+12+48+52 = 151 Average Turnaround Time = 151 / 4 =37.75 millisecond Waiting Time= Turnaround Time- Burst Time Waiting time for P0 = 39-15 = 24 P1 = 12-8= 4 P2 = 48-25= 23 P3 = 52-18 = 34 Total Waiting Time = 24+0+5+29 = 85 Average Waiting Time = 85 / 4 =21.25 millisecond
  • 0 Votes
    1 Posts
    521 Views
    No one has replied
Reputation Earning
How to Build a $1,000/Month World CUP LIVE Matches Live Cricket Streaming
Ads
File Sharing
Stats

0

Online

3.0k

Users

2.8k

Topics

8.6k

Posts
Popular Tags
Online User
| |