E81 CSE 131 Lecture 5: CSE131E - Module 5, Prep for Studio

32 views2 pages
Verified Note

Document Summary

Video 1: introduction to merge-combining two sorted arrays. ( https://www. youtube. com/watch?v=ygxwdgzai4s ) You have two alphabetical arrays of equal length that have already been individually sorted. Each of these two arrays are 3 entries long. ( video at 0:24) Your goal is to combine those two arrays and create a new array of length 6 combines the two arrays into one new alphabetically sorted array. You have to keep track of each read index when reading both of the arrays. You also have to keep another index which keeps track of where you"re writing into the new, merged array: because the two arrays are sorted, you start by looking at the first letter of both arrays. Whichever one is lexicographically earlier will be the first entry in the new array. Compare the first entry from the first array that you did not end up taking from (e) to the next entry (i). Input the earlier entry (e) into the new array.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents