Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment S's runtime was too siow -- a couple of minutes or so. It's because of the duplicate-checking, with over 4 billion compares. Rewrite the

image text in transcribedimage text in transcribedimage text in transcribed
Assignment S's runtime was too siow -- a couple of minutes or so. It's because of the duplicate-checking, with over 4 billion compares. Rewrite the duplicate-checking logic from Assignment 5, using a technique from "Techniques For Big Data, Reading" to do fewer compares. The numbers used below were from an older input le with less entries. But the principle is the same though. - Doing Fewer Compares: Using 2-D array: How to declare the 2-D array for the two options below? 1. Option 1: {Static Array contains Dynamic Arrays} 0 There are less than 100 terms l 3 terms leach year]I ' 20 years} 0 Average 1500 sections in each term E 60 " 1500 = 90k} 0 If 50. average comparison will become 30 +750 = 780 {comparisons} o 800 vs 40,000. it is much LESS!! 0 64M vs 3200M comparison; 6 sec vs 5 min 2. Option 2: {Static Array contains Static Arrays} 0 There are 9999 section numbers, let's create one size of 10,000 array to contain another array of term. 0 By using the section number as the index of the array, we can directly nd the corresponding term array to see if it is a duplicated section 0 How many comparisons we need? Maybe just one... o The fastest runtime, but waste lots of memory ATE- 0 There are most 1500 sections in a term. but create 10k-size array. Only 15% indexes with valid data. 0 The default stack memory may need to enlarge than 1MB \fIDSGN 30 sections INTD 23 sections ITAL 302 sections JAPAN 594 sections JRNAL 339 sections KINES 344 sections KNACT 1490 sections KNCMB 95 sections KNDAN 179 sections KNICA 418 sections 96 sections LATIN 14 sections LRNSK 184 sections LS 241 sections LT 53 sections MATEC 34 sections MATH 9418 sections MLT 60 sections MUL TM 357 sections MUSIC 3013 sections MUSLT 275 sections MUSPF 376 sections MUSX 285 sections NUTRI 631 sections OCEAN 493 sections PE 3919 sections PEADP 81 sections PECMB 284 sections PEDAN 838 sections PEIC 239 sections PERSN 60 sections PETHE 386 sections PHILO 808 sections PHYS 1291 sections PHYSC 96 sections PLUMB 193 sections POLSC 1025 sections PORT 3 sections PSYCH 3427 sections RE 310 sections RUSS 67 sections SIGN 605 sections SOCIO 1220 sections SOCSC 407 sections SPAN 1145 sections SPCH 1616 sections SPEDU 67 sections SPTUT 12 sections STMFT 239 sections TAGLG 8 sections WRKP 5 sections WRKX 366 sections Total duplicates: 2962 Total counts: 97341 Total subjects: 118

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions