Skip to content

About

Classic Data Structures and Algos implmented in the Salesforce Apex Programming Language and JavaScript

Topics

Resources

Stars

12 stars

Watchers

2 watching

Forks

Repository files navigation

Algorithms and Data Structures in Apex

Image of Cody from Salesforce

Welcome this repo is meant as a companion to my youtube series.

  • intro to recursion
    • Watch it on Youtube
    • I provided some code challenges for writing recursive code. The answers are in the repo. But try to solve these first.
      1. Get the sum or a range of numbers.
      2. Compute a number to a certain power.
      3. Determine if a word is a palindrome
      4. Compute a number in the fibonacci sequence
      5. Reverse a string
  • Linear Search
  • Watch it on Youtube
    • just fine for a small data set. Runs at o(N)
  • Binary Search
    • The algo that made me feel like a genius the first time I saw it and understood it. It needs a sorted list to work but runs at o(Log N).
  • Bubble Sort
    • Watch it on Youtube
    • Pretty much only used as an example of what not do it. But perfect for undertanding why nested for loops are bad.
  • Selection Sort
    • Like Bubble Sort but puts the smallest value into sorted position instead of the largest. Algo runs at O(n^2) but is slightly optomized compared to Bubble Sort. It does one swap per pass for the lowest value.
  • Insertion Sort
    • Runs at O(n^2). Iterates from index 1 to final position in the collection. If value is smaller than its predecessor it compares to elements before and swaps.
  • Merg Sort -The first of our "advanced sorting algos" and an important one to understand. It is a divide and conquer algo and runs at O(nLogn). It has a space complexity of O(n).
  • Singly Linked List 🚧
    • A data structure with a head, tail and length property. Unlike a Apex List it has no index. Each node in the list contains a pointer to the next element. You can not use collection[i] instead it is collection.next().
    • It contains the properties head, length and tail.

About

Classic Data Structures and Algos implmented in the Salesforce Apex Programming Language and JavaScript

Topics

Resources

Stars

12 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages