• Home
  • Interactive Resume
  • Blog
    • Coding
    • Health & Fitness
    • Success & Lifestyle
  • Contact
  • About

BAOSS

  • Home
  • Interactive Resume
  • Blog
    • Coding
    • Health & Fitness
    • Success & Lifestyle
  • Contact
  • About

Week 12 Day 2 – Dynamic Arrays and Ring Buffers

Home Coding Week 12 Day 2 – Dynamic Arrays and Ring Buffers
Week 12 Day 2 – Dynamic Arrays and Ring Buffers

Week 12 Day 2 – Dynamic Arrays and Ring Buffers

Apr 13, 2017 | Posted by Bao Le | Coding |

I haven’t made any progress with my JS project since yesterday was jam packed with work and lectures. In addition, we had about 2-3 hours of algorithms homework at night, which basically brought me all the way to 12 AM of continuous work. Additionally, I couldn’t finish the homework last night since my brain checked out for the day, so I went and made some fixes to my resume and cover letter, that brought me all the way up to 2 AM. This is going to be my schedule for the next two weeks or so, since I do want to crank out projects and keep up with the rest of my cohort in regards to the job search curriculum, as well as the job search timeline.

Last night’s homework was pretty awesome. We expanded on some concepts we studied previously towards the beginning of the start of our cohort. Last night’s concepts were dynamic arrays and buffer rings. The point of these algorithms projects is to deepen our understanding of how these concepts work by implementing them from scratch.

In dynamic arrays, we really focused on building the array methods shift, unshift, push and pop. We built a StaticArray class that simulated places in the computer’s physical memory, and the only operations you could do with the static array was set and get values via indices.

We built a DynamicArray  class on top of the StaticArray class that would have the above array methods, and compared the time complexity of each method with that of the RingBuffer class. To keep it short, through writing our own methods, for dynamic arrays, setting, getting, pushing and popping array methods are constant time in regards to time complexity, but shift and unshift are linear time complexity. This is because every time shift or unshift is executed, every element within the array needs to be shifted either forward or backwards, meaning there’s a full iteration and reassignment that occurs.

However, in ring buffers, as long as there’s space within array, shifting and unshifting are also constant time(amortized in the methods push and unshift), because the pointer of the starting index is moved around to simulate shifting and unshifting. This means that the start of the array that a user sees could have a starting index that actually shows up AFTER the rest of elements in the array in physical memory. If that’s a bit confusing, definitely google some images to get a better idea, there’s some really awesome ones out there.

Anyways, back to work! Today’s algorithms project is awesomely nostalgic: HashMaps and LRU Caches! Yeee!

0
Share

About Bao Le

Web Developer at Dropbox. Reach out, I'd love to connect!

Latest Posts

From Bootcamp to Dropbox: Part 2 – Success in the Program

From Bootcamp to Dropbox: Part 2 – Success in the Program

November 27, 2017

Before reading Part 2, make sure you’ve read Part 1!...

From Bootcamp to Dropbox: Part 1 – Application Process

From Bootcamp to Dropbox: Part 1 – Application Process

October 9, 2017

The Decision The decision to go into programming, without...

Signed with Dropbox!

Signed with Dropbox!

September 8, 2017

After a grueling 3 months or so, my job search has come to...

How I Overcome Rejection and Stay Motivated

How I Overcome Rejection and Stay Motivated

July 17, 2017

Having just had my first real rejection from a company I...

How I Overcome Imposter Syndrome Every Single Day

How I Overcome Imposter Syndrome Every Single Day

May 22, 2017

Before I really go into how I personally overcome imposter...

Future Googler

Future Googler

May 2, 2017

I’m finally “finished” with my interactive...

Introducing the Graduate Job Seeker Program

Introducing the Graduate Job Seeker Program

April 26, 2017

I almost forgot to blog today haha. Please expect not as...

Progress on Progress

Progress on Progress

April 25, 2017

The end of Week X Day X titles are here! And with it marks...

Week 13 Day 5 – Google Co-Working Meetup

Week 13 Day 5 – Google Co-Working Meetup

April 24, 2017

The Google meetup was absolutely dope. It was an incredible...

Week 13 Day 4 – Catching Up

Week 13 Day 4 – Catching Up

April 21, 2017

I think I have a pretty solid game plan of how to attack my...

Contact Us

We're currently offline. Send us an email and we'll get back to you, asap.

Send Message

Let’s Connect!

© 2025 · imbaoss.com

  • Facebook
  • Twitter
  • Instagram
  • LinkedIn
  • GitHub
Prev Next