3 Pages

assign2

Course: CSE 120A, Spring 2009
School: UC Irvine
Rating:
 
 
 
 
 

Word Count: 466

Document Preview

2: Assignment Heap Sort (Due: Monday, October 27th 2008, 11:59pm) Forbes list of 50 richest people in the world for year 2007 was recently released. The attached forbes50.list is a copy of that list with the first name, last name and net worth in billions. Part A: Implement heap sort and use it to rewrite the list in ascending order. Use the persons first name as the key. Sample Input: 4 John Doe 50 Peter Han 44...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> UC Irvine >> CSE 120A

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
2: Assignment Heap Sort (Due: Monday, October 27th 2008, 11:59pm) Forbes list of 50 richest people in the world for year 2007 was recently released. The attached forbes50.list is a copy of that list with the first name, last name and net worth in billions. Part A: Implement heap sort and use it to rewrite the list in ascending order. Use the persons first name as the key. Sample Input: 4 John Doe 50 Peter Han 44 Pete Willis 35 Jane Doe 24 Sample Output: 4 Jane Doe 24 John Doe 50 Pete Willis 35 Peter Han 44 Refer to chapter 6 of the textbook for additional information. Part B: i) State the complexity of YOUR algorithm using big-Oh notation. Complexity will be based upon the loops and various statements executed by your algorithm to perform sorting. ii) What is the complexity of the heap construction step alone, in big-Oh notation for your algorithm? iii) What is the complexity of the selection step, in big-Oh notation for your algorithm? Implementation Aspects The program must accept a command-line argument corresponding to the name of a .list file. The file is a simple text file in the following format. Number_of_Entries First_Name Last_Name Net_Worth_in_Billions Your program must be able to load any number of entries. Test cases with 100-1000 entries may be used to test your program. Java string class which is available in the default java.lang may package be used to load the dataset. File IO operations for reading and writing text files will require you to include import java.io.* statement in your .java file. The output of your heap sort implementation (i.e. a sorted list of names with corresponding net worth) should be written into a ForbesSort.txt file. The format of this file will be as shown in the above sample output and is similar to input file format. Submission Details: Use your editor to create a Java file named hw2heap.java. The file should state your name and assignment number in a comment. Compile and execute your code as in hw1. A brief text file, hw2.txt, must be submitted as well that shows all executions. Limit the number of print statements to a maximum of 15. Also include your name and student ID in the hw2.txt file. Checklist: In the hw2 directory, you should have the following files in your unix account: hw2heap.java hw2.txt ForbesSort.txt You will need to run the turnin114 script to make the submission. To do this, type /ecelib/bin/turnin114 to copy your files from your working directory for final submission. This script only works on the machines malibu.eecs.uci.edu and vivian.eecs.uci.edu. For more information on java programming, submitting files, typescript, unix commands and java editors, please refer to Assignment 1. Due : October 27th, 2008 (11:59pm)
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UC Irvine - CSE - 120A
Assignment 3: Spell Checker (Due: Tuesday, November 18th, 11:59pm)1. Design a spell checkerYou are required to design a java spell checker that checks the existence of a given word in a dictionary. The input to your program will be a word and the o
UC Irvine - CSE - 120A
Assignment 4: Max Flow (Due: Friday, December 5th, 11:59pm)Part A: Max Flow prgram Write a Java program that computes the max flow in a weighted directed graph. You should use Edmonds Karp to solve the problem. The input graph to your program is des
UC Irvine - CSE - 120A
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer Networking Telephone NetworksScott JordanQ. What are the steps in a typical telephone call, from the point of view of the telephone company? A. (1) Wait for "off-hook" (2)
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer Networking Telephone NetworksScott JordanTopology: (Tanenbaum fig. 2-14)UCIUniversity of California, IrvineEECS 161 - Introduction to Computer Networking Telephone Net
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer Networking Telephone NetworksScott JordanTrunking Trunk lines carry more than 1 call simultaneously Frequency Division Multiplexing (FDM):UCIUniversity of California, Ir
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / ALOHAComputer Networks: Design: Computer networks were engineered for data. Service characteristics:UCIUniversity of Califo
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / ALOHACoin Tossing: Suppose you toss a coin N times, and each toss is independent of previous tosses. Suppose the probability t
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / EthernetEthernet - Topology:Ethernet MAC:Single collision domainHubHubHubRelayCollision!After a collision, stop
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / EthernetCSMA-CD protocol: (1) Wait until channel is idle. (2) Transmit & listen. (3) If collision, stop transmitting packet, t
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / EthernetEthernets connected by Routers:(Walrand fig. 2.5) A Packet Router is like a Packet Switch, but it can also modify th
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLocal Area Networks / RingsToken Ring - Topology:(Walrand fig. 4.5) Token Ring - Physical Layer: - Logical bits are encoded using differential Man
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLAN performanceShared Ethernet - Performance: We want to find the performance of shared Ethernet (the hub version). We consider a simplified model,
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanLayered ArchitecturesNetwork Architectures: - Circuit Switching, e.g. telephone networks - Virtual Circuit Packet Switching, e.g. ATM - Datagram Pac
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 148 - Introduction to Computer NetworkingScott JordanInternet / TopologyTerminology:(Walrand, fig. 2.6) "internet" = a network containing multiple heterogeneous subnetworks "Internet" = the public gl
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineIntroduction to Computer Networking IPScott JordanIP Class-based Addressing All IPv4 addresses have 4 bytes. The first 1, 2, or 3 bytes correspond to the "network", and the remaining bytes correspond to the "
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineIntroduction to Computer Networking IPScott JordanDomain Name System (DNS): IP addresses and domain names are managed by Internet registries. Names are written as hostname.subdomain.domain, with an abitrary n
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanInternet / RoutingOpen Shortest Path First (OSPF): General Idea: Part (A): Within a small network called an "Autonomous System" (AS), each router se
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanInternet / Flow ControlFlow Control: Problem: Congestion causes delay and/or packet loss. Solution: - retransmission of lost packets - control when
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanInternet / Flow ControlSelective Repeat Protocol (SRP): Idea: Increase window size to W>1, and only retransmit dropped packets. Example for W=4: 0 S
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanPerformanceDiscrete Random Variables set of outcomes = { x 1, x 2, , x n } . associated probabilities = { p 1, p 2, , p n } , i.e. P ( X = x i ) = p
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanPerformanceA Model of Packet Arrivals We want to model the times at which packets arrive at a router: x T1 T2 x T3 x tIdea: split time into small
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanPerformanceA Router Model Example: 1 0 2) long term proportion of time spent in state 0, ( 0 ), = 2/3 General case: x i-1 y x (i) = - (i 1) - y i
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanInternet / Quality of ServiceAsynchronous Transfer Mode (ATM): Goal: a protocol that can accommodate a wide range of applications including data, in
UC Irvine - CSE - 120A
UCIUniversity of California, IrvineEECS 161 - Introduction to Computer NetworkingScott JordanInternet / Quality of ServiceInternet QoS: Two ideas: Integrated Services "IntServ": - Reservation of bandwidth along a route, for each flow or for
UC Irvine - CSE - 120A
UC Irvine - CSE - 120A
BRIEFEXERCISE25 Workingcapital=CurrentassetsCurrentliabilities Currentassets Currentliabilities Workingcapital Currentratio: $47, 500,000 Currentassets = $145, 800,000 Currentliabilities =.33:1 ($47,500,000 145,800,000 ($ 98,300,000 )EXERCISE32
UC Irvine - CSE - 120A
EXERCISE45 (a) ServiceRevenue OperatingExpenses InsuranceExpense NetIncome CashBasis $22,000 13,000 3,600 $5,400 AccrualBasis $28,000 14,500 $13,500(b) The accrual basis of accounting provides more useful information for decision mak
UC Irvine - CSE - 120A
BRIEFEXERCISE62 (a) TheendinginventoryunderFIFOconsistsof400unitsat$9 foratotalallocationof$3,600. (b) TheendinginventoryunderLIFOconsistsof300unitsat$6+ 100unitsat$8foratotalallocationof$2,600($1,800+$800).EXERCISE61 Endinginventoryphysicalcount.
UC Irvine - CSE - 120A
BRIEFEXERCISE72 (a) Segregationofduties. (b) Independentinternalverification. (c) Documentationprocedures.BRIEFEXERCISE85 (a) BadDebtsExpense. [($500,000X2%)$1,500] AllowanceforDoubtfulAccounts. 8,500 (b) BadDebtsExpense. [($500,000X2%)+$600] Allow
UC Irvine - CSE - 120A
BRIEFEXERCISE94 Bookvalue,1/1/07($32,000$14,000). .$18,000 Less:Salvagevalue.. . 2,000 Depreciablecost. .. $16,000 Remainingusefullife.. . 2years Revisedannualdepreciation($16,0002). . $8,000 EXERCISE93 $96, 000 $6, 000 Straightli
UC Irvine - CSE - 120A
DEMO 3-1: ACCOUNTING EQUATIONAssetsCash 1 2 3 4 5 6 7 8 9 10 11 (1,900) (200) $18,700 # $10,000 # $3,000 # $3,600 # (3,600) $20,000 10,000 (10,000) 5,500 2,400 (3,500) 3,000 3,600 10,000 + Equipment Accounts Received Prepaid Rent=Supplies = Note
UC Irvine - CSE - 120A
UC Irvine - CSE - 120A
UC Irvine - CSE - 120A
UC Irvine - CSE - 120A
Stony Brook University - PHY - 132
Lecture PowerPoint Chapter 29 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in te
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 21 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 22 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 23 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 24 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 25 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 26 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 27 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - PHY - 132
Lecture PowerPoints Chapter 28 Physics for Scientists and Engineers, with Modern Physics, 4th edition Giancoli 2009 Pearson Education, Inc. This work is protected by United States copyright laws and is provided solely for the use of instructors in t
Stony Brook University - CHE - 131
Professor Carlos Simmerling CMM Bldg, Room G80 Graduate Chemistry Bldg, Room 579 Office hours listed on blackboardChapter 10 Gases and the AtmosphereCommon Gases and their UsesEarths AtmosphereProperties of Gases Composition of Dry Air
Penn State - PHYS - 211
Physics211R:LabTemplate Kinematicsin2DimensionsProjectileMotionScore:_100_ Name:ElizabethDonofrio Section#:002 Name:TylerHess Section#:001 Name:SeanHeaster Section#:002 Name:ToddFisher Section#:001NOTE: Remember to SAVE this template as a Word do
Cornell - BEE - 3299
Genetically modified organisms (GMOs) are created by using recombinant DNA technology and artificially inserting genes from a different species to create a transgenic plant. Despite the appeal of this technology to some, there is constant debate over
Cornell - BEE - 3299
Without question, I believe that global warming is a very pressing issueand is directly attributable to human actions. Increased CO2 emissions attributable to the burning of fossil fuels are indisputably correlated with increased greenhouse gases bei
Cornell - BEE - 3299
Devon Siegel das257 Assignment 4, Parts 1-3Part 1: StakeholdersPresident Barack Obama As the leader of the most powerful nation in the world, Barack Obama is at the forefront of environmental policy that directly affects not only the United Stat
Cornell - BEE - 3299
Devon Siegel das257 Assignment 4: Ecosystems Part 1: The Cayuga Lake ecosystem has many biotic and abiotic factors. The biotic factors include the plants, animals (mostly fish) and microorganisms that live in/on the lake. The abiotic factors include
Cornell - BEE - 3299
Devon Siegel das257 Assignment 5: Global Processes 1. In 1999, the U.S. Department of Energy (DOE) in conjunction with the U.S. Environmental Protection Agency (EPA) and the Energy Information Administration (EIA) produced a report which outlined th
Cornell - BEE - 3299
Devon Siegel das257 Human systems: Assignment 1 Part 1: college student in Ithaca, NY in 2009 I need / I use or do the following to meet that need: Air: breathe in and out, stay in an oxygen-rich environment Water: drink clean water from the tap or
Cornell - BEE - 3299
Devon Siegel das257 Human systems Part 2 Values: Honesty: Honesty is a big part of the way I have chosen to live my life, as it is my decision to be honest every situation. Honesty is extremely important, and a value that is consistent part of my e
Cornell - BEE - 3299
I divided the problems facing the world into three categories: environmental, economic and social. Environmental problems I thought of are: pollution (air, water, etc.), deforestation, global warming, desertification and extinction of both plant and
Cornell - BEE - 3299
Pro-sustainability articles: 1. Obama directs regulators to tighten auto rules John M. Broder, NY Times 1/26/2009 Source: http:/www.nytimes.com/2009/01/27/us/politics/27calif.html Summary:President Obama directed federal regulators to set strict limi
Cornell - BEE - 3299
Of the problems I listed in the previous assignment, the environmental problems are most important to me. These problems included pollution, resource degradation and plant/animal extinction, among many others. These problems are most important to me
Cornell - BEE - 3299
Devon Siegel Lesson 3 Assignment 1: Feedback Control Systems Kate leaves her apartment on a chilly February morning on a mission to get to class before the freshmen take the good seats in the last row. Even as she starts her walk, multiple systems a
Cornell - BEE - 3299
Part A: One system in which I live is Hunterdon County. Hunterdon County is part of a larger system called New Jersey, which is part of an even larger system called the United States of America. Within Hunterdon County, there are subsystems called to
Cornell - FD SC - 430
Beer/Wine Log Devon Siegel Beers Name Style Production Location Alcohol Content Cost per pint Tasting notes Food pairing recommendations Name Style Production Location Alcohol Content Cost per 6-pack Tasting notes Food pairing recommendations Wines N
Cornell - PSYCH - 2090
Devon Siegel PSYCH 2090, Spring 09 Assignment 2: Babies in the wild Video 1 URL: http:/www.youtube.com/watch?v=q6BMiscDVGA Substage represented by the video: Secondary circular reactions Why is the video a good example? This video is a good example o