AI study guide maker from notes

Turn Your Notes into a Study Guide

Turn lecture notes into a study guide you can use before an exam. Organize key terms, review the main ideas, and work through examples from your class.

AI study guide maker from notes

Paste your class notes or upload a PDF or TXT file.

From Study Material to a Study Guide

See how a bubble sort article becomes a study guide with key concepts, exam points, and a worked example.

Study Material

The Bubble Sort Algorithm - DEV Community

Maximilian

Intro

I recently took a data structures and algorithms course as part of my pursuit to learn lower level programming and computer science concepts. As the saying goes, the best way of solidifying your knowledge in something is to teach it, and since I've already filled my quota for boring my partner with coding talk for the month (probably the year), I thought I'd write a series of posts with some of the things I've learned. This is one such post.

What is the Bubble Sort Algorithm

The Bubble Sort algorithm is typically applied where simplicity is favoured over efficiency. It has a time complexity of O(n^2) which is less than ideal when dealing with larger lists.

How does it work

To explain how it works, here's some pseudo-code:

for pointer1 in list
    for pointer2 in list
        if list[j] > list[j + 1]
            swap list[j] and list[j + 1]
        pointer2++

    pointer1++


The idea of this algorithm is to 'bubble up' the larger items in the list to the end. We can think of this with 2 pointers, pointer1 and pointer2. We start by setting both pointers to the first item in the list. We then go through the entire list with pointer2 and swap the item at pointer2's position if the item at position pointer2 + 1 is greater in value. We keep repeating this process until we reach the end of the list. We then move pointer1 up by 1 and we start the process again with pointer2.

You may have noticed that we need a way of avoiding checking items that we have already sorted. Seeing as the aim of each iteration is to move the larger items to the end of the list, we can do this by limiting the boundary of pointer2 by the value of pointer1 + 1.

How do we implement it

Here's a heavily commented implementation in Typescript:

function bubbleSort(arr: number[]): void {
    // pointer 1
    for (let i = 0; i < arr.length; ++i) { 
       // pointer 2 + limit iterations by pointer1 + 1
        for (let j = 0; j < arr.length - 1 - i; ++j) {
            // check if current item is larger than the next item
            if (arr[j] > arr[j + 1]) {
                // temporarily store the current item so we don't lose it
                const tmp = arr[j];
                // swap the items in the array
                arr[j] = arr[j + 1];
                arr[j + 1] = tmp;
            }
        }
    }
}

Sorted

This isn't a likely go-to algorithm in most cases, but I think it's a nice and easy one to get started. I hope you found it useful or, at least, a little bit interesting!

Sample Study Guide

πŸ“š The Bubble Sort Algorithm

🧠 Key Concepts

  • Comparison-based sorting. The algorithm compares adjacent elements to determine their order.
  • In-place sorting. It swaps elements within the original array with no extra array.
  • Bubble effect. Each pass moves the largest remaining element to the end of the unsorted portion.

⭐ Key & High-Frequency Exam Points

  • Time complexity. The worst case takes O(nΒ²) time, which makes bubble sort inefficient for large lists.
  • Loop boundary. The inner loop runs while j < n - 1 - i. The -1 keeps j + 1 in bounds, and the -i skips the elements already in their final positions.
  • Swap mechanism. The implementation uses a temporary variable to hold one value while swapping the two adjacent elements.

🧩 Structured Overview

Logic flow

  1. Use the outer loop to count passes through the list.
  2. In the inner loop, compare arr[j] with arr[j + 1].
  3. If arr[j] > arr[j + 1], swap the two values.

Optimization

  • After each pass, the largest remaining value is in its final position.
  • Shorten the next pass by one position to skip the sorted end of the list.

πŸͺ„ Memory Aids

  • Bubbles in soda. Think of the largest number as a bubble that rises to the end of the unsorted portion.
  • A closing gate. The inner loop’s boundary moves one position to the left after each pass, keeping the values already in place out of the next round.

πŸ“ Examples

Input [5, 1, 4, 2]

Pass 1

  1. Compare 5 and 1. Swap β†’ [1, 5, 4, 2].
  2. Compare 5 and 4. Swap β†’ [1, 4, 5, 2].
  3. Compare 5 and 2. Swap β†’ [1, 4, 2, 5]. The 5 is in its final position.

Pass 2

  1. Compare 1 and 4. Leave them in place.
  2. Compare 4 and 2. Swap β†’ [1, 2, 4, 5].

πŸ“ One-Sentence Summary

Bubble sort repeatedly compares adjacent values and swaps any that are out of order until the list is sorted.

Use the blank study guide template

How to Make a Study Guide from Your Notes

  1. Add the material you’ll be tested on

    Paste your notes from one lecture or chapter, or upload the file. Include examples your instructor worked through and any topics they marked for the exam.

  2. Generate your study guide

    Read through the main topics and key terms. Check definitions, formulas, and examples against your original notes.

  3. Try one topic from memory

    Cover a definition or the next step in a worked example. Explain it in your own words and mark the part you need to review again.

Practice What You Just Learned

  • Notes to Quiz

    Answer practice questions from your notes to see which topics you need to review again.

    Make a practice quiz→
  • Notes to Flashcards

    Recall key terms and definitions from memory, then flip each card to check your answer.

    Make flashcards→

Study Guide Maker FAQ

A study guide groups related ideas by topic and explains the terms you need to know. It can also include worked examples and review points. The exact sections depend on the material you provide.

Yes. Upload a PDF in the File tab, or copy the relevant pages into the Text tab if you only want to study one section.

Yes. You can generate a study guide without an account. Sign in to save a guide to HyNote.

Yes. Paste a section of your guide into Notes to Quiz for practice questions, or use Notes to Flashcards to review the key terms.

A study guide covers what to learn, including concepts, definitions, and examples. A study plan schedules when to review each topic. Use your guide’s headings to decide what to put on your schedule.

Make a Study Guide from Your Class Notes

Start with one lecture or chapter you need to review.