Free Essay

Lab 3 Stacks and Queues

In:

Submitted By robertop
Words 341
Pages 2
Q1: What is the initial value of variable Top?
The initial value of Top is blank. It is initialized under the array. It is waiting for a number to be set to set a value.

Q2: What is the difference between Pop and Peek operations?
Pop operations takes of the value at the top of the array. Each time that it is pressed it removes the first value at the top of the array. Peek only returns the value of the item to the top of the stack. So, if the button push is pressed, then that value is inserted to the top of the array.

Q3: What are the initial values of Front and Rear?
The initial value of the variable Front is the slot in the array spot for 0. The index 0 is where front is placed. The Rear variable is waiting for a value to be inserted to take a spot. This variable will always be the value that was last inserted to the array.

Q4: What is the difference between Rem and Peek operations?
The operations remove deletes the value at the top of the array. In other words on the rear variable. The peek operation returns the value that the variable rear is pointing to.

Q5: What technique in array it used to allow 50 inserted into the queue?
Once the array was filled all the way to the top, the pointer came back to the bottom of the array where we had deleted two values. It came down to index 0 and stored the value 50.

Q6: What is the difference between priority queue and the regular queue at insertion operations?
There is a difference between priority and regular queue. Regular queue stores the value at the next slot open at the top of the array. Priority queue stores the value from largest to smallest. Therefore, it has to make space if the value has to go in the middle of the array.

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

[pic]

Similar Documents

Premium Essay

Computer Science

...Instruction Plan for CSE240 Lab on Data Structure and N/Ws Term: 4th Course No: CSE240 Course Title: Lab on Data Structures and Networks L: 0 T: 0 P: 4 Textbook: 1. Data Structures – Seymour Lipschutz :India Adapted Edition 2006 2. Data communication and networks- Forouzan-4TH Edition Reference Books: 3.Data Structures & Algorithms Using C- R.S Salaria-2nd Edition 4.Data Structures,Algorithms and applications in C++ --Sartaj Sahni—2nd Edition 5.PC Hardware in a Nutshell-Robert Bruce Thomsan and Barbara Fritchman Thomsan—July2003 :Second Edition Other readings: |Sr.No. |Journal articles as compulsory readings (Complete reference) | |6. |Cisco system advanced exam guide-CISCO press | |7. |Cisco system CCNA Exam dump guide –CISCO press | Relevant websites: |S.No. |Web address |Salient Features | |8. |http://www.java2s.com/Tutorial/C/0260__Data-Structure |A web page on Data Structure| | | ...

Words: 1499 - Pages: 6

Free Essay

Soley

...FORMAT108 views * M I C R O P R O C E S S O R S A N D I N T E R F A C I N G J N T U M O D E L …630 views * M.sc I-sem-8086 notes796 views * M.sc I-sem-8086 notes1049 views * Unit 12899 views * Lect 51529 views * microprocessor & programming1835 views * Evolution Of Microprocessor34001 views * 1326 Introduction To 8086 Microprocessor9356 views * 8086 introduction159 views * Mc1702 micro processor317 views * Micro Lec 11859 views * Evolution Of Microprocessors13171 views * Microprocessors 1-8086168 views * Ei502microprocessorsmicrtocontrollerspart5 sixteen bit8086 1335 views * Course plan mp2067 views * Microprocessor laboratory1086 views * Microprocessor and microcontroller lab viva questions1325 views * CPU HISTORY MUKUND532 views * The x86 Family7890 views * 13402 lecture 1877 views * 14910 ece301 hw266 views * Al2ed chapter3219 views * Sistem mikroprosessor701 views * M1 l3132 views * 23145586 views * 231455 281 views * Microprocessors80852959 views * Chapter8-mikroprocessor399 views * Processor481...

Words: 2369 - Pages: 10

Free Essay

Sociology

... | | | | | |Note: Please provide the program assignment documentation according to | | | | | |SyllabusCS901.doc and Project Submittals.doc. | | | |1 |Ch1 |Problems: 26 p.69. Unit conversion. |09-09 |2 | | |Ch2 |Problems: 4 p.153. Stacks separated | | | |2 |Ch2 - 3 |See the exercise assignment description below |09-21 |3 | | | | |Tue | | |3 |Ch2 |Problem: 39 p.156 - provide a Gantt chart for each case and calculate AWT,| 09-30 |3 | | | |ATT and ART. Problems 44. |Thu | | | | |Provide the solution in the PowerPoint slides. Bring a hard and electronic| | | | | |(floppy) copies of your solutions. | | | |4 |Ch3 |QUEUING SYSTEM AND BATCH SCHEDULING. See the programming...

Words: 5471 - Pages: 22

Free Essay

The Merits of Uploading a Paper

...Matthew Hendrickson Tree Lab Questions 1. Recursive algorithms work well for trees because recursion allows for storing areas that have been traversed on the system stack, so that all avenues can be explored. Similar to the maze example from the chapter on recursion. Recursion also works well when the same steps have to be repeated on different parts of a data structure and is often simpler and more elegant than iteration with a loop. The same way an array is continuously broken and half and searched for a binary search, traversing a tree requires breaking a large tree into smaller trees. 2. Binary trees are only efficient when they are balanced. A balanced binary tree can be searched quickly, with growth of O(log n). If the tree is unbalanced, it can become similar to a linked list, which has a search growth of O(n). Inserting elements in binary trees requires similar operations no matter what type it is, and are similar to a Doubly Linked List in efficiency. The most efficient types of binary trees are self balancing. 3. A level order traversal requires the use of some kind of collection to hold all the elements in a level, then those items are searched in order. A Queue is the best type of collection for this, since the items can be added to the queue from left to right and then dealt with in order, for each level. A recursive level order traversal is possible, but it requires visiting each node twice, which makes it much less efficient than using a while loop and...

Words: 269 - Pages: 2

Free Essay

Android

...Section ?? outlines the system architecture, history and detail management configuration. Section ?? discusses the iPhone system. In Section ??, a comparison between these two systems is presented. 1 Android Android, originally meaning “robot”, is a mobile operating system using a modified version of the Linux kernel. It was initially developed by Android Inc., a firm later purchased by Google,[?]and lately by the Open Handset Alliance[?]. It allows developers to write managed code in the Java language, controlling the device via Google-developed Java libraries.[8] It empolys the software stack architecture, as shown in Figure 1. • Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack. It is implemented by programming language C. • The middleware level includes Runtime and Libraries. The Runtime includes core libraries, providing most of the functionality available in the core libraries of the Java programming language, and Dalvik virtual machine which allows every Android application runs in its own process. The Libraries is used by various components of the Android system, such as Media Libraries, 3D libraries, and etc. • The upper level is Application framework and Application. Application framework is offering developers the ability to build extremely rich and innovative applications...

Words: 6786 - Pages: 28

Free Essay

Strategic Management

...1. Aptitude test 2. Technical Round 3. Managerial Round 4. HR Round. 1. For the king's revelry 30 barrels of beer have b een ordered . howerver, it was found that one of them is  poisoned. The poison takes effect even if consumed in the tiniest amount after 14 hours. Yhou need to find  within 24 hours the poisoned barrel and have at your disposal some beer guzzling mice. The smallest number of  mice required to find the poisoned barrel is 1) 2 2) 1 3) 4 4) 3 hint: 2^n> no of barrels ans:4 2. Given a collection of points P in the plane a 1-set is a point in P that can be separated from the rest by a  line; i.e the pint lies on one side of the line while the others lie on the other side. The number of 1-sets of  P is denoted by n1(P) . The maximum value of n1(P) over all configurations P of 15 points in the plane is 1) 5  2) 10 3) 15 4) 9 Ans: 15(Same as given number of points) 3. The pacelength P is the distance between the rear of two consecutive footprints for men the formula n/P=190  gives an approximate relationship between n and P where n= number os steps per minute and P= CX in meters.  Bernard knows his Pace Length is 104cm the formula applies to Bernards walking. Calculate Bernards walking speed  in kmph. 4. A hare and a tortoise have a race along a circle of 100 yards diameter. The tortoise goes in one direction  and the hare I the other. The hare starts after the tortoise had coveredc 1/7 of its distance and that...

Words: 3201 - Pages: 13

Free Essay

C++ Objects Solutions

...Statement, p. 175 Solving the Time Calculator Problem, p. 236 The while Loop, p. 249 The for Loop, p. 263 Nested Loops, p. 277 Solving the Ocean Levels Problem, p. 299 Defining and Calling Functions, p. 306 Using Function Arguments, p. 316 Value-Returning Functions, p. 326 Solving the Markup Problem, p. 380 Creating a Class, p. 391 Creating and Using Class Objects, p. 393 Creating and Using Structures, p. 436 Solving the Car Class Problem, p. 480 Accessing Array Elements, p. 487 Passing an Array to a Function, p. 517 Two-Dimensional Arrays, p. 526 Solving the Chips and Salsa Problem, p. 567 Performing a Binary Search, p. 580 Sorting a Set of Data, p. 587 Solving the Lottery Winners Problem, p. 616 (continued on next page) Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 LOCATION OF VIDEONOTES IN THE TEXT Chapter 10 Pointer Variables, p. 621 Dynamically Allocating an Array, p. 645 Solving the Days in Current Month Problem, p. 676 (continued) Chapter 11 Operator Overloading, p. 704 Aggregation and Composition, p. 734 Overriding Base Class Functions, p. 755 Solving the Number of Days Worked Problem, p. 768 Converting Strings to Numbers, p. 788 Writing a C-String Handling Function, p. 800 Solving the Backward...

Words: 11246 - Pages: 45

Free Essay

Performance Tuning for Windows Server 2008

...Performance Tuning Guidelines for Windows Server 2012 April 12, 2013 Abstract This guide describes important tuning parameters and settings that you can adjust to improve the performance and energy efficiency of the Windows Server 2012 operating system. It describes each setting and its potential effect to help you make an informed decision about its relevance to your system, workload, and performance goals. The guide is for information technology (IT) professionals and system administrators who need to tune the performance of a server that is running Windows Server 2012. For the most current version of this guide, see Performance Tuning Guidelines for Windows Server 2012. ------------------------------------------------- Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet website references, may change without notice. Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here. You bear the risk of using it. ------------------------------------------------- Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. ------------------------------------------------- This document does not provide you with any legal rights to any intellectual...

Words: 50142 - Pages: 201

Premium Essay

Computer Networking

...COMPUTER NETWORKING SIXTH EDITION A Top-Down Approach James F. Kurose University of Massachusetts, Amherst Keith W. Ross Polytechnic Institute of NYU Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Vice President and Editorial Director, ECS: Marcia Horton Editor in Chief: Michael Hirsch Editorial Assistant: Emma Snider Vice President Marketing: Patrice Jones Marketing Manager: Yez Alayan Marketing Coordinator: Kathryn Ferranti Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Art Director, Cover: Anthony Gemmellaro Art Coordinator: Janet Theurer/ Theurer Briggs Design Art Studio: Patrice Rossi Calkin/ Rossi Illustration and Design Cover Designer: Liz Harasymcuk Text Designer: Joyce Cosentino Wells Cover Image: ©Fancy/Alamy Media Editor: Dan Sandin Full-Service Vendor: PreMediaGlobal Senior Project Manager: Andrea Stefanowicz Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Color This book was composed in Quark. Basal font is Times. Display font is Berkeley. Copyright © 2013, 2010, 2008, 2005, 2003 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States of...

Words: 69922 - Pages: 280

Premium Essay

Hai, How Are U

...UNIVERSITY OF KERALA B. TECH. DEGREE COURSE 2008 ADMISSION REGULATIONS and I  VIII SEMESTERS SCHEME AND SYLLABUS of COMPUTER SCIENCE AND ENGINEERING B.Tech Comp. Sc. & Engg., University of Kerala 2 UNIVERSITY OF KERALA B.Tech Degree Course – 2008 Scheme REGULATIONS 1. Conditions for Admission Candidates for admission to the B.Tech degree course shall be required to have passed the Higher Secondary Examination, Kerala or 12th Standard V.H.S.E., C.B.S.E., I.S.C. or any examination accepted by the university as equivalent thereto obtaining not less than 50% in Mathematics and 50% in Mathematics, Physics and Chemistry/ Bio- technology/ Computer Science/ Biology put together, or a diploma in Engineering awarded by the Board of Technical Education, Kerala or an examination recognized as equivalent thereto after undergoing an institutional course of at least three years securing a minimum of 50 % marks in the final diploma examination subject to the usual concessions allowed for backward classes and other communities as specified from time to time. 2. Duration of the course i) The course for the B.Tech Degree shall extend over a period of four academic years comprising of eight semesters. The first and second semester shall be combined and each semester from third semester onwards shall cover the groups of subjects as given in the curriculum and scheme of examination ii) Each semester shall ordinarily comprise of not less than 400 working periods each of 60 minutes duration...

Words: 34195 - Pages: 137

Premium Essay

Computer Organization and Architecture Designing for Performance 8th Edition

...COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE EIGHTH EDITION William Stallings Prentice Hall Upper Saddle River, NJ 07458 Library of Congress Cataloging-in-Publication Data On File Vice President and Editorial Director: Marcia J. Horton Editor-in-Chief: Michael Hirsch Executive Editor: Tracy Dunkelberger Associate Editor: Melinda Haggerty Marketing Manager: Erin Davis Senior Managing Editor: Scott Disanno Production Editor: Rose Kernan Operations Specialist: Lisa McDowell Art Director: Kenny Beck Cover Design: Kristine Carney Director, Image Resource Center: Melinda Patelli Manager, Rights and Permissions: Zina Arabia Manager, Visual Research: Beth Brenzel Manager, Cover Visual Research & Permissions: Karen Sanatar Composition: Rakesh Poddar, Aptara®, Inc. Cover Image: Picturegarden /Image Bank /Getty Images, Inc. Copyright © 2010, 2006 by Pearson Education, Inc., Upper Saddle River, New Jersey, 07458. Pearson Prentice Hall. All rights reserved. Printed in the United States of America. This publication is protected by Copyright and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to: Rights and Permissions Department. Pearson Prentice Hall™ is a trademark of Pearson Education, Inc. Pearson® is a registered trademark of...

Words: 239771 - Pages: 960

Premium Essay

Analysis

...SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C This page intentionally left blank SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C Jeri R. Hanly, University of Wyoming Elliot B. Koffman, Temple University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director, ECS: Marcia Horton Editor-in-Chief: Michael Hirsch Senior Project Manager: Carole Snyder Director of Marketing: Patrice Jones Marketing Manager: Yezan Alayan Senior Marketing Coordinator: Kathryn Ferranti Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Production Manager: Pat Brown Creative Director: Jayne Conte Designer: Suzanne Behnke Media Editor: Daniel Sandin Media Project Manager: John Cassar Cover Image: (c) michael Holcomb/Shutterstock.com Full-Service Project Management: Mohinder Singh/ Aptara®, Inc. Composition: Aptara®, Inc. Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Photo Credits: Page 4: Fig. 0.1: akg-images/Paul Almasy/Newscom. Page 11: Fig. 0.4: © 2008 IEEE/Journal of Microelectromechanical Systems (2006). Page 15:...

Words: 158087 - Pages: 633

Premium Essay

Syllabus

...Structures 3 1 0 4 4 50 2. 3. 4. 5. 6. 7. 8. 9. Total Second Year -Fourth Semester Sr.No Paper Code 1. 2. 3. 4. 5. 6. CSE411 CSE461 CSE412 CSE462 CSE414 CSE464 Subject Title Scheme of Teaching L 3 0 3 0 3 0 T 1 0 1 0 1 0 P 0 3 0 3 0 3 Hours 4 3 4 3 4 3 Credit 4 2 4 2 4 2 University External Marks 50 50 50 CSE361 CSE313 CSE363 AS301 EC316 EC366 EC317 EC367 Data Structures (Practical) Peripheral Devices & Interfaces Hardware Lab (Practical) Engineering Mathematics – III Digital Electronics Digital Electronics (Practical) Microprocessors Microprocessors (Practical) 0 3 0 3 3 0 3 0 15 0 1 0 1 1 0 1 0 5 3 0 2 0 0 2 0 2 09 3 4 2 4 4 2 4 2 29 2 4 1 4 4 1 4 1 25 50 50 50 50 250 Internal Total Sessional Marks 50 50 50 50 50 50 50 50 50 450 100 50 100 50 100 100 50 100 50 700 7. 8. Total ASC405 CSE 415 Analysis & Design of Algorithms Analysis & Design of Algorithms (Practical) Database Management System Database Management System (Practical) Object Oriented Programming Object Oriented Programming (Practical) Cyber Law & IPR Computer Architecture & Organization Internal Total Sessional Marks 50 100 50 50 50 50 50 50 100 50 100 50 3 3 15 0 1 4 0 0 9 3 4 28 3 4 25 50 50 250 50 50 400 100 100 650 2 Scheme of Examination of B.E. in Computer Science & Engineering Third Year - Fifth Semester Sr. Paper Subject Title Scheme of Teaching Univesity Internal Sessional Code External L T P Hou Credit Marks Total Marks rs s 1. CSE511 Operating System 3 1 0 4 4...

Words: 14784 - Pages: 60

Premium Essay

History of Computing

...1950–1979 1980–1989 1990–1999 2000–2009 2010–2019 more timelines ... Category Category v t e Computer operating systems (OSes) provide a set of functions needed and used by most application programs on a computer, and the linkages needed to control and synchronize computer hardware. On the first computers, with no operating system, every program needed the full hardware specification to run correctly and perform standard tasks, and its own drivers for peripheral devices like printers and punched paper card readers. The growing complexity of hardware and application programs eventually made operating systems a necessity. Contents [hide] 1 Background 2 Mainframes 2.1 Systems on IBM hardware 2.2 Other mainframe operating systems 3 Minicomputers and the rise of Unix 4 Microcomputers: 8-bit home computers and game consoles 4.1 Home computers 4.2 Rise of OS in video games and consoles 5 Personal computer era 6 Rise of virtualization 7 See also 8 Notes 9 References 10 Further reading Background[edit] Question book-new.svg This section does not cite any references or sources. Please help...

Words: 4042 - Pages: 17

Free Essay

Introduction to Computer

...1) A computer is unique compared to any other machine because of its ability to ________. process large amounts of information simultaneously process complex math functions change its programming use many different types of software Score: 1 2) Bits are used to measure ________. storage capacity data transfer and Internet connection rates the size of files the amount of time a user is connected to the Internet Score: 1 3) The smallest, most lightweight, and inexpensive computer is the ________. notebook laptop netbook client Score: 0 4) Distributed computing distributes ________. the processing of tasks across a group of computers power ability across all users Internet usage across the entire network disk storage for all computer users Score: 1 5) Smartphones use ________ technology, allowing users to perform several functions with one device. embedded design invisible computing convergence grid computing Score: 1 6) The intersection of a row and a column in a spreadsheet is called a ________. field text cell record Score: 1 7) Shaynia has been working with her colleagues on a Word...

Words: 2580 - Pages: 11